@nx/vitest 0.0.1-alpha.0 → 22.1.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.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ <p style="text-align: center;">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
+ <img alt="Nx - Smart Repos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
+ </picture>
6
+ </p>
7
+
8
+ <div style="text-align: center;">
9
+
10
+ [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
11
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
12
+ [![NPM Version](https://badge.fury.io/js/nx.svg)](https://www.npmjs.com/package/nx)
13
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
14
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
15
+ [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
16
+ [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
17
+
18
+ </div>
19
+
20
+
21
+ <hr>
22
+
23
+ # Nx: Smart Repos · Fast Builds
24
+
25
+ Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
26
+
27
+ This package is a [Vitest plugin for Nx](https://nx.dev/nx-api/vitest).
28
+
29
+ ## Getting Started
30
+
31
+ ### Creating an Nx Workspace
32
+
33
+ **Using `npx`**
34
+
35
+ ```bash
36
+ npx create-nx-workspace
37
+ ```
38
+
39
+ **Using `npm init`**
40
+
41
+ ```bash
42
+ npm init nx-workspace
43
+ ```
44
+
45
+ **Using `yarn create`**
46
+
47
+ ```bash
48
+ yarn create nx-workspace
49
+ ```
50
+
51
+ ### Adding Nx to an Existing Repository
52
+
53
+ Run:
54
+
55
+ ```bash
56
+ npx nx@latest init
57
+ ```
58
+
59
+ ## Documentation & Resources
60
+
61
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
62
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
63
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
64
+ - [Blog Posts About Nx](https://nx.dev/blog)
65
+
66
+ <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
67
+ width="100%" alt="Nx - Smart Repos · Fast Builds"></a></p>
68
+
package/executors.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { VitestExecutorOptions } from './src/executors/test/schema';
2
+ export { vitestExecutor } from './src/executors/test/vitest.impl';
3
+ //# sourceMappingURL=executors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executors.d.ts","sourceRoot":"","sources":["../../../packages/vitest/executors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
package/executors.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.vitestExecutor = void 0;
4
+ var vitest_impl_1 = require("./src/executors/test/vitest.impl");
5
+ Object.defineProperty(exports, "vitestExecutor", { enumerable: true, get: function () { return vitest_impl_1.vitestExecutor; } });
package/index.d.ts CHANGED
@@ -1,5 +1,2 @@
1
1
  export { createNodesV2, VitestPluginOptions } from './src/plugins/plugin';
2
- export { VitestExecutorOptions } from './src/executors/test/schema';
3
- export { vitestExecutor } from './src/executors/test/vitest.impl';
4
- export { configurationGenerator } from './src/generators/configuration/configuration';
5
2
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/vitest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/vitest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
package/index.js CHANGED
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configurationGenerator = exports.vitestExecutor = exports.createNodesV2 = void 0;
3
+ exports.createNodesV2 = void 0;
4
4
  var plugin_1 = require("./src/plugins/plugin");
5
5
  Object.defineProperty(exports, "createNodesV2", { enumerable: true, get: function () { return plugin_1.createNodesV2; } });
6
- var vitest_impl_1 = require("./src/executors/test/vitest.impl");
7
- Object.defineProperty(exports, "vitestExecutor", { enumerable: true, get: function () { return vitest_impl_1.vitestExecutor; } });
8
- var configuration_1 = require("./src/generators/configuration/configuration");
9
- Object.defineProperty(exports, "configurationGenerator", { enumerable: true, get: function () { return configuration_1.configurationGenerator; } });
package/migrations.json CHANGED
@@ -4,6 +4,34 @@
4
4
  "version": "20.3.0-beta.2",
5
5
  "description": "Add gitignore entry for temporary vitest config files.",
6
6
  "implementation": "./src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore"
7
+ },
8
+ "update-22-1-0": {
9
+ "version": "22.1.0-beta.8",
10
+ "description": "Create AI Instructions to help migrate users workspaces past breaking changes for Vitest 4.",
11
+ "implementation": "./src/migrations/update-22-1-0/create-ai-instructions-for-vitest-4"
12
+ }
13
+ },
14
+ "packageJsonUpdates": {
15
+ "22.1.0": {
16
+ "version": "22.1.0-beta.8",
17
+ "packages": {
18
+ "vitest": {
19
+ "version": "^4.0.0",
20
+ "alwaysAddToPackageJson": false
21
+ },
22
+ "@vitest/coverage-v8": {
23
+ "version": "^4.0.0",
24
+ "alwaysAddToPackageJson": false
25
+ },
26
+ "@vitest/coverage-istanbul": {
27
+ "version": "^4.0.0",
28
+ "alwaysAddToPackageJson": false
29
+ },
30
+ "@vitest/ui": {
31
+ "version": "^4.0.0",
32
+ "alwaysAddToPackageJson": false
33
+ }
34
+ }
7
35
  }
8
36
  }
9
37
  }
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": "0.0.1-alpha.0",
4
+ "version": "22.1.0-beta.8",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,6 +33,10 @@
33
33
  "types": "./generators.d.ts",
34
34
  "default": "./generators.js"
35
35
  },
36
+ "./executors": {
37
+ "types": "./executors.d.ts",
38
+ "default": "./executors.js"
39
+ },
36
40
  "./package.json": "./package.json",
37
41
  "./generators.json": "./generators.json",
38
42
  "./executors.json": "./executors.json",
@@ -44,11 +48,11 @@
44
48
  "executors": "./executors.json",
45
49
  "generators": "./generators.json",
46
50
  "dependencies": {
47
- "@nx/devkit": "workspace:*",
48
- "@nx/js": "workspace:*",
49
- "tslib": "catalog:typescript",
50
- "semver": "catalog:",
51
- "@phenomnomnominal/tsquery": "catalog:typescript"
51
+ "@nx/devkit": "22.1.0-beta.8",
52
+ "@nx/js": "22.1.0-beta.8",
53
+ "tslib": "^2.3.0",
54
+ "semver": "^7.6.3",
55
+ "@phenomnomnominal/tsquery": "~5.0.1"
52
56
  },
53
57
  "peerDependencies": {
54
58
  "vitest": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0",
@@ -63,7 +67,7 @@
63
67
  }
64
68
  },
65
69
  "devDependencies": {
66
- "nx": "workspace:*"
70
+ "nx": "22.1.0-beta.8"
67
71
  },
68
72
  "types": "./src/index.d.ts"
69
- }
73
+ }
package/project.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "targets": {
7
7
  "build": {
8
8
  "command": "node ./scripts/copy-readme.js vitest",
9
- "outputs": ["{workspaceRoot}/build/packages/vitest/README.md"]
9
+ "outputs": ["{workspaceRoot}/dist/packages/vitest/README.md"]
10
10
  },
11
11
  "legacy-post-build": {
12
12
  "executor": "@nx/workspace-plugin:legacy-post-build",
@@ -1,4 +1,5 @@
1
- import type { File, Reporter } from 'vitest';
1
+ import type { RunnerTestFile } from 'vitest/node';
2
+ import type { Reporter } from 'vitest/reporters';
2
3
  export declare class NxReporter implements Reporter {
3
4
  private watch;
4
5
  deferred: {
@@ -13,7 +14,7 @@ export declare class NxReporter implements Reporter {
13
14
  /** Vitest ≥ 0.29 */
14
15
  onTestRunEnd(files: any[], errors?: any): void;
15
16
  /** Vitest ≤ 0.28 */
16
- onFinished(files: File[], errors?: unknown[]): void;
17
+ onFinished(files: RunnerTestFile[], errors?: unknown[]): void;
17
18
  private _handleFinished;
18
19
  }
19
20
  //# sourceMappingURL=nx-reporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nx-reporter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vitest/src/executors/test/lib/nx-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE7C,qBAAa,UAAW,YAAW,QAAQ;IAM7B,OAAO,CAAC,KAAK;IALzB,QAAQ,EAAE;QACR,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;KACjC,CAAC;gBAEkB,KAAK,EAAE,OAAO;IAI3B,CAAC,MAAM,CAAC,aAAa,CAAC;;;IAQ7B,OAAO,CAAC,aAAa;IAUrB,oBAAoB;IACpB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,GAAG;IAGvC,oBAAoB;IACpB,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE;IAK5C,OAAO,CAAC,eAAe;CAKxB"}
1
+ {"version":3,"file":"nx-reporter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vitest/src/executors/test/lib/nx-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,UAAW,YAAW,QAAQ;IAM7B,OAAO,CAAC,KAAK;IALzB,QAAQ,EAAE;QACR,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;KACjC,CAAC;gBAEkB,KAAK,EAAE,OAAO;IAI3B,CAAC,MAAM,CAAC,aAAa,CAAC;;;IAQ7B,OAAO,CAAC,aAAa;IAUrB,oBAAoB;IACpB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,GAAG;IAIvC,oBAAoB;IACpB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE;IAKtD,OAAO,CAAC,eAAe;CAKxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/vitest/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EASjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAcpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAQjD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,qBAAqB,EAC7B,SAAS,UAAQ,8BAOlB;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,qBAAqB,EAC7B,SAAS,UAAQ,8BAqLlB;AA2LD,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/vitest/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EASjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAcpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAQjD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,qBAAqB,EAC7B,SAAS,UAAQ,8BAOlB;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,qBAAqB,EAC7B,SAAS,UAAQ,8BAqLlB;AAgMD,eAAe,sBAAsB,CAAC"}
@@ -279,6 +279,10 @@ function isAngularV20(tree) {
279
279
  return true;
280
280
  }
281
281
  const cleanedAngularVersion = (0, semver_1.clean)(angularVersion) ?? (0, semver_1.coerce)(angularVersion).version;
282
+ if (typeof cleanedAngularVersion !== 'string') {
283
+ // assume the latest version will be installed,
284
+ return true;
285
+ }
282
286
  return (0, semver_1.major)(cleanedAngularVersion) >= 20;
283
287
  }
284
288
  exports.default = configurationGenerator;
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function createAiInstructionsForVitest(tree: Tree): Promise<string[]>;
3
+ //# sourceMappingURL=create-ai-instructions-for-vitest-4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-ai-instructions-for-vitest-4.d.ts","sourceRoot":"","sources":["../../../../../../packages/vitest/src/migrations/update-22-1-0/create-ai-instructions-for-vitest-4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,wBAA8B,6BAA6B,CAAC,IAAI,EAAE,IAAI,qBAerE"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = createAiInstructionsForVitest;
4
+ const path_1 = require("path");
5
+ const fs_1 = require("fs");
6
+ async function createAiInstructionsForVitest(tree) {
7
+ const pathToAiInstructions = (0, path_1.join)(__dirname, 'files', 'ai-instructions-for-vitest-4.md');
8
+ if (!(0, fs_1.existsSync)(pathToAiInstructions)) {
9
+ return;
10
+ }
11
+ const contents = (0, fs_1.readFileSync)(pathToAiInstructions);
12
+ tree.write('ai-migrations/MIGRATE_VITEST_4.md', contents);
13
+ return [
14
+ `We created 'ai-migrations/MIGRATE_VITEST_4.md' with instructions for an AI Agent to help migrate your Vitest projects to Vitest 4.`,
15
+ ];
16
+ }