Skip to content

Commit 7c8d5e1

Browse files
committed
test(cli): rename and configure unit and integration tests in cli
1 parent c6afe8a commit 7c8d5e1

13 files changed

+31
-17
lines changed

packages/cli/project.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,17 @@
3737
]
3838
}
3939
},
40-
"test": {
40+
"unit-test": {
41+
"executor": "@nx/vite:test",
42+
"outputs": ["{options.reportsDirectory}"],
43+
"options": {
44+
"reportsDirectory": "../../coverage/cli"
45+
}
46+
},
47+
"integration-test": {
4148
"executor": "@nx/vite:test",
4249
"outputs": ["{options.reportsDirectory}"],
4350
"options": {
44-
"passWithNoTests": true,
4551
"reportsDirectory": "../../coverage/cli"
4652
}
4753
},

packages/cli/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"path": "./tsconfig.lib.json"
1818
},
1919
{
20-
"path": "./tsconfig.spec.json"
20+
"path": "./tsconfig.test.json"
2121
}
2222
]
2323
}

packages/cli/tsconfig.lib.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
},
88
"include": ["src/**/*.ts"],
99
"exclude": [
10-
"vite.config.ts",
11-
"src/**/*.spec.ts",
10+
"vite.config.unit.ts",
11+
"vite.config.integration.ts",
1212
"src/**/*.test.ts",
1313
"src/**/*.mock.ts",
1414
"test/**/*.ts"

packages/cli/tsconfig.spec.json packages/cli/tsconfig.test.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
66
},
77
"include": [
8-
"vite.config.ts",
8+
"vite.config.unit.ts",
9+
"vite.config.integration.ts",
910
"test/**/*.ts",
1011
"src/**/*.test.ts",
11-
"src/**/*.spec.ts",
1212
"src/**/*.test.tsx",
13-
"src/**/*.spec.tsx",
1413
"src/**/*.test.js",
15-
"src/**/*.spec.js",
1614
"src/**/*.test.jsx",
17-
"src/**/*.spec.jsx",
1815
"src/**/*.d.ts"
1916
]
2017
}

packages/cli/vite.config.ts packages/cli/vite.config.integration.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@ import { defineConfig } from 'vite';
55
export default defineConfig({
66
cacheDir: '../../node_modules/.vite/cli',
77
plugins: [nxViteTsPaths()],
8-
9-
// Uncomment this if you are using workers.
10-
// worker: {
11-
// plugins: [ nxViteTsPaths() ],
12-
// },
13-
148
test: {
159
globals: true,
1610
cache: {
1711
dir: '../../node_modules/.vitest',
1812
},
1913
environment: 'node',
20-
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
14+
include: ['src/**/*.integration.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
2115
globalSetup: ['global-setup.ts'],
2216
},
2317
});

packages/cli/vite.config.unit.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// <reference types="vitest" />
2+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
3+
import { defineConfig } from 'vite';
4+
5+
export default defineConfig({
6+
cacheDir: '../../node_modules/.vite/cli',
7+
plugins: [nxViteTsPaths()],
8+
test: {
9+
globals: true,
10+
cache: {
11+
dir: '../../node_modules/.vitest',
12+
},
13+
environment: 'node',
14+
include: ['src/**/*.unit.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
15+
globalSetup: ['global-setup.ts'],
16+
},
17+
});

0 commit comments

Comments
 (0)