-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathvitest.config.ts
More file actions
37 lines (35 loc) · 1.65 KB
/
Copy pathvitest.config.ts
File metadata and controls
37 lines (35 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
import { defineConfig } from 'vitest/config';
import path from 'node:path';
/**
* [#10772] This package had no vitest config until
* `plugin-shutdown-stops-auto-enqueuer.test.ts` needed a REAL kernel to prove
* that `await kernel.shutdown()` reaches `WebhookOutboxPlugin.destroy()`. That
* is the package's first VALUE import of `@objectstack/core` — the plugin's own
* `import type { Plugin, PluginContext }` is erased before resolution and so was
* never a hazard — and an unaliased value import resolves through `exports` to
* `core/dist`, which would make the verdict a function of build state rather
* than of the source in the checkout.
*
* `pnpm check:test-source-alias` reds on exactly that and names this remedy:
* alias it to source rather than widen `KNOWN_UNALIASED_TEST_IMPORTS`, which is
* shrink-only.
*
* ANCHORED regex, array form, deliberately. A bare string `find` matches by
* PREFIX, so with a FILE replacement it would also swallow the published
* `@objectstack/core/logger` subpath and resolve it to
* `…/core/src/index.ts/logger` — `ENOTDIR`, at run time, from a config that
* reads as correct. Anchoring leaves that subpath to `exports`, where it
* belongs.
*
* `test` is deliberately left unset: this package's `test` script is a bare
* `vitest run` and was relying on the defaults, so declaring any of them here
* would silently narrow what the suite collects.
*/
export default defineConfig({
resolve: {
alias: [
{ find: /^@objectstack\/core$/, replacement: path.resolve(__dirname, '../../core/src/index.ts') },
],
},
});