@nx/node 23.2.0-beta.7 → 23.2.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/generators/application/application.js +20 -0
- package/dist/src/generators/application/files/fastify/src/app/app.spec.ts__tmpl__ +2 -1
- package/dist/src/generators/application/files/fastify/src/app/app.ts__tmpl__ +1 -1
- package/dist/src/generators/application/files/fastify/src/app/plugins/sensible.ts__tmpl__ +1 -1
- package/dist/src/generators/application/files/fastify/src/app/routes/root.ts__tmpl__ +1 -1
- package/dist/src/generators/application/schema.d.ts +2 -2
- package/dist/src/generators/application/schema.json +6 -1
- package/dist/src/generators/library/schema.d.ts +1 -2
- package/dist/src/generators/library/schema.json +1 -7
- package/package.json +9 -8
|
@@ -146,6 +146,26 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
146
146
|
};
|
|
147
147
|
(0, devkit_1.updateProjectConfiguration)(tree, options.name, projectConfig);
|
|
148
148
|
}
|
|
149
|
+
else if (options.unitTestRunner === 'vitest') {
|
|
150
|
+
(0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
|
|
151
|
+
// CommonJS `require` instead of dynamic ESM `import`: `ensurePackage`
|
|
152
|
+
// exposes the temp install via `Module._initPaths`, which ESM ignores.
|
|
153
|
+
const { configurationGenerator, } = require('@nx/vitest/generators');
|
|
154
|
+
const vitestTask = await configurationGenerator(tree, {
|
|
155
|
+
project: options.name,
|
|
156
|
+
uiFramework: 'none',
|
|
157
|
+
coverageProvider: 'v8',
|
|
158
|
+
testEnvironment: 'node',
|
|
159
|
+
runtimeTsconfigFileName: 'tsconfig.app.json',
|
|
160
|
+
// Only the fastify template ships a spec, so the other frameworks would
|
|
161
|
+
// otherwise fail `nx test` on a freshly generated app.
|
|
162
|
+
passWithNoTests: true,
|
|
163
|
+
addPlugin: options.addPlugin,
|
|
164
|
+
skipPackageJson: options.skipPackageJson,
|
|
165
|
+
skipFormat: true,
|
|
166
|
+
});
|
|
167
|
+
tasks.push(vitestTask);
|
|
168
|
+
}
|
|
149
169
|
else {
|
|
150
170
|
// No need for default spec file if unit testing is not setup.
|
|
151
171
|
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/app/app.spec.ts'));
|
|
@@ -5,10 +5,10 @@ export interface Schema {
|
|
|
5
5
|
name?: string;
|
|
6
6
|
skipFormat?: boolean;
|
|
7
7
|
skipPackageJson?: boolean;
|
|
8
|
-
unitTestRunner?: 'jest' | 'none';
|
|
8
|
+
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
9
9
|
e2eTestRunner?: 'jest' | 'none';
|
|
10
10
|
linter?: LinterType;
|
|
11
|
-
formatter?: 'none' | 'prettier';
|
|
11
|
+
formatter?: 'none' | 'prettier' | 'oxfmt';
|
|
12
12
|
tags?: string;
|
|
13
13
|
frontendProject?: string;
|
|
14
14
|
swcJest?: boolean;
|
|
@@ -39,9 +39,14 @@
|
|
|
39
39
|
"enum": ["eslint", "oxlint", "none"],
|
|
40
40
|
"x-priority": "important"
|
|
41
41
|
},
|
|
42
|
+
"formatter": {
|
|
43
|
+
"description": "The tool to use for code formatting.",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": ["none", "prettier", "oxfmt"]
|
|
46
|
+
},
|
|
42
47
|
"unitTestRunner": {
|
|
43
48
|
"type": "string",
|
|
44
|
-
"enum": ["jest", "none"],
|
|
49
|
+
"enum": ["jest", "vitest", "none"],
|
|
45
50
|
"description": "Test runner to use for unit tests.",
|
|
46
51
|
"default": "none",
|
|
47
52
|
"x-priority": "important",
|
|
@@ -7,12 +7,11 @@ export interface Schema {
|
|
|
7
7
|
skipTsConfig?: boolean;
|
|
8
8
|
skipFormat?: boolean;
|
|
9
9
|
tags?: string;
|
|
10
|
-
unitTestRunner?: 'jest' | 'none';
|
|
10
|
+
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
11
11
|
linter?: LinterType;
|
|
12
12
|
buildable?: boolean;
|
|
13
13
|
publishable?: boolean;
|
|
14
14
|
importPath?: string;
|
|
15
|
-
testEnvironment?: 'jsdom' | 'node';
|
|
16
15
|
rootDir?: string;
|
|
17
16
|
babelJest?: boolean;
|
|
18
17
|
js?: boolean;
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"unitTestRunner": {
|
|
43
43
|
"type": "string",
|
|
44
|
-
"enum": ["jest", "none"],
|
|
44
|
+
"enum": ["jest", "vitest", "none"],
|
|
45
45
|
"description": "Test runner to use for unit tests.",
|
|
46
46
|
"default": "none",
|
|
47
47
|
"x-prompt": "Which unit test runner would you like to use?",
|
|
@@ -90,12 +90,6 @@
|
|
|
90
90
|
"type": "string",
|
|
91
91
|
"description": "Sets the `rootDir` for TypeScript compilation. When not defined, it uses the project's root property, or `srcRootForCompilationRoot` if it is defined."
|
|
92
92
|
},
|
|
93
|
-
"testEnvironment": {
|
|
94
|
-
"type": "string",
|
|
95
|
-
"enum": ["jsdom", "node"],
|
|
96
|
-
"description": "The test environment to use if `unitTestRunner` is set to `jest`.",
|
|
97
|
-
"default": "jsdom"
|
|
98
|
-
},
|
|
99
93
|
"babelJest": {
|
|
100
94
|
"type": "boolean",
|
|
101
95
|
"description": "Use `babel` instead of `ts-jest`.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/node",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -73,15 +73,16 @@
|
|
|
73
73
|
"semver": "^7.6.3",
|
|
74
74
|
"tcp-port-used": "^1.0.2",
|
|
75
75
|
"kill-port": "^1.6.1",
|
|
76
|
-
"@nx/devkit": "23.2.0-beta.
|
|
77
|
-
"@nx/jest": "23.2.0-beta.
|
|
78
|
-
"@nx/js": "23.2.0-beta.
|
|
79
|
-
"@nx/eslint": "23.2.0-beta.
|
|
80
|
-
"@nx/docker": "23.2.0-beta.
|
|
76
|
+
"@nx/devkit": "23.2.0-beta.9",
|
|
77
|
+
"@nx/jest": "23.2.0-beta.9",
|
|
78
|
+
"@nx/js": "23.2.0-beta.9",
|
|
79
|
+
"@nx/eslint": "23.2.0-beta.9",
|
|
80
|
+
"@nx/docker": "23.2.0-beta.9"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"nx": "23.2.0-beta.
|
|
84
|
-
"@nx/webpack": "23.2.0-beta.
|
|
83
|
+
"nx": "23.2.0-beta.9",
|
|
84
|
+
"@nx/webpack": "23.2.0-beta.9",
|
|
85
|
+
"@nx/vitest": "23.2.0-beta.9"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
88
|
"express": ">=4.0.0 <6.0.0",
|