-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvitest.config.ts
More file actions
73 lines (69 loc) · 2.53 KB
/
Copy pathvitest.config.ts
File metadata and controls
73 lines (69 loc) · 2.53 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
// The sibling packages are peers (a dev/regular dep would create a package
// cycle — client/worker devDepend on this package), so their specifiers are
// aliased to source for the test runtime, mirroring tsconfig.json's `paths`.
const sibling = (path: string) => fileURLToPath(new URL(path, import.meta.url));
const workspaceAliases = [
{ find: /^@temporal-contract\/client$/, replacement: sibling("../client/src/index.ts") },
{ find: /^@temporal-contract\/contract$/, replacement: sibling("../contract/src/index.ts") },
{
find: /^@temporal-contract\/contract\/errors$/,
replacement: sibling("../contract/src/errors.ts"),
},
{
find: /^@temporal-contract\/contract\/internal$/,
replacement: sibling("../contract/src/internal.ts"),
},
{
find: /^@temporal-contract\/worker\/activity$/,
replacement: sibling("../worker/src/activity.ts"),
},
{ find: /^@temporal-contract\/worker\/worker$/, replacement: sibling("../worker/src/worker.ts") },
{
find: /^@temporal-contract\/worker\/workflow$/,
replacement: sibling("../worker/src/workflow.ts"),
},
];
export default defineConfig({
test: {
reporters: ["default"],
coverage: {
provider: "v8",
reporter: ["text", "json", "json-summary", "html"],
include: ["src/**", "!src/__tests__/**"],
},
projects: [
{
resolve: { alias: workspaceAliases },
test: {
name: "unit",
include: ["src/**/*.spec.ts"],
exclude: ["src/**/__tests__/*.spec.ts"],
setupFiles: ["./src/vitest.setup.ts"],
// The unit specs exercise `extension.ts` with mocked Temporal
// connections, so the address normally provided by the
// testcontainers global setup is stubbed statically here.
provide: {
__TESTCONTAINERS_TEMPORAL_IP__: "127.0.0.1",
__TESTCONTAINERS_TEMPORAL_PORT_7233__: 7233,
},
},
},
{
resolve: { alias: workspaceAliases },
test: {
name: "integration",
globalSetup: "./src/global-setup.ts",
include: ["src/**/__tests__/*.spec.ts"],
setupFiles: ["./src/vitest.setup.ts"],
testTimeout: 30_000,
// Fixture setup opens Temporal connections and builds a workflow
// bundle before the test body runs; Vitest's 10s hook default is
// too tight for that on a loaded CI runner.
hookTimeout: 60_000,
},
},
],
},
});