@nx/vitest 23.2.0-beta.7 → 23.2.0-beta.8

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.
@@ -132,6 +132,7 @@ getTestBed().initTestEnvironment(
132
132
  imports: [`import angular from '@analogjs/vite-plugin-angular'`],
133
133
  plugins: ['angular()'],
134
134
  setupFile: relativeTestSetupPath,
135
+ passWithNoTests: schema.passWithNoTests,
135
136
  useEsmExtension: true,
136
137
  }, true, { skipPackageJson: schema.skipPackageJson });
137
138
  }
@@ -155,6 +156,7 @@ getTestBed().initTestEnvironment(
155
156
  coverageProvider: schema.coverageProvider === 'none'
156
157
  ? undefined
157
158
  : schema.coverageProvider,
159
+ passWithNoTests: schema.passWithNoTests,
158
160
  useEsmExtension: true,
159
161
  }, true, { skipPackageJson: schema.skipPackageJson });
160
162
  }
@@ -11,6 +11,7 @@ export interface VitestGeneratorSchema {
11
11
  addPlugin?: boolean;
12
12
  runtimeTsconfigFileName?: string;
13
13
  compiler?: 'babel' | 'swc'; // default: babel
14
+ passWithNoTests?: boolean;
14
15
  // internal options
15
16
  projectType?: 'application' | 'library';
16
17
  viteVersion?: 5 | 6 | 7 | 8;
@@ -66,6 +66,12 @@
66
66
  "description": "Do not add dependencies to `package.json`.",
67
67
  "x-priority": "internal"
68
68
  },
69
+ "passWithNoTests": {
70
+ "type": "boolean",
71
+ "default": false,
72
+ "description": "Exit with a zero status when the project has no test files.",
73
+ "x-priority": "internal"
74
+ },
69
75
  "zoneless": {
70
76
  "type": "boolean",
71
77
  "description": "Whether the Angular project is zoneless. When not provided, it is auto-detected from the project configuration.",
@@ -26,6 +26,7 @@ export interface ViteConfigFileOptions {
26
26
  imports?: string[];
27
27
  plugins?: string[];
28
28
  coverageProvider?: 'v8' | 'istanbul' | 'custom' | 'none';
29
+ passWithNoTests?: boolean;
29
30
  setupFile?: string;
30
31
  useEsmExtension?: boolean;
31
32
  port?: number;
@@ -119,6 +119,7 @@ function createOrEditViteConfig(tree, options, onlyVitest, extraOptions = {}) {
119
119
  globals: true,
120
120
  environment: '${options.testEnvironment ?? 'jsdom'}',
121
121
  include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
122
+ ${options.passWithNoTests ? ` passWithNoTests: true,\n` : ''}\
122
123
  ${options.setupFile ? ` setupFiles: ['${options.setupFile}'],\n` : ''}\
123
124
  ${options.inSourceTests
124
125
  ? ` includeSource: ['src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],\n`
@@ -229,6 +230,7 @@ function handleViteConfigFileExists(tree, viteConfigPath, options, buildOption,
229
230
  globals: true,
230
231
  environment: options.testEnvironment ?? 'jsdom',
231
232
  include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
233
+ ...(options.passWithNoTests ? { passWithNoTests: true } : {}),
232
234
  reporters: ['default'],
233
235
  coverage: {
234
236
  reportsDirectory: reportsDirectory,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/vitest",
3
3
  "description": "The Nx Plugin for Vitest to enable fast unit testing with Vitest.",
4
- "version": "23.2.0-beta.7",
4
+ "version": "23.2.0-beta.8",
5
5
  "type": "commonjs",
6
6
  "files": [
7
7
  "dist",
@@ -81,13 +81,13 @@
81
81
  "tslib": "^2.3.0",
82
82
  "semver": "^7.6.3",
83
83
  "@phenomnomnominal/tsquery": "~6.2.0",
84
- "@nx/devkit": "23.2.0-beta.7",
85
- "@nx/js": "23.2.0-beta.7"
84
+ "@nx/devkit": "23.2.0-beta.8",
85
+ "@nx/js": "23.2.0-beta.8"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "vitest": "^3.0.0 || ^4.0.0",
89
89
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
90
- "@nx/eslint": "23.2.0-beta.7"
90
+ "@nx/eslint": "23.2.0-beta.8"
91
91
  },
92
92
  "peerDependenciesMeta": {
93
93
  "@nx/eslint": {
@@ -101,6 +101,6 @@
101
101
  }
102
102
  },
103
103
  "devDependencies": {
104
- "nx": "23.2.0-beta.7"
104
+ "nx": "23.2.0-beta.8"
105
105
  }
106
106
  }