@angular/build 21.0.0-next.9 → 21.0.0-rc.1
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/package.json +5 -5
- package/src/builders/application/schema.d.ts +6 -6
- package/src/builders/application/schema.js +3 -3
- package/src/builders/application/schema.json +1 -1
- package/src/builders/dev-server/options.d.ts +3 -0
- package/src/builders/dev-server/options.js +2 -1
- package/src/builders/dev-server/options.js.map +1 -1
- package/src/builders/dev-server/schema.d.ts +9 -0
- package/src/builders/dev-server/schema.json +7 -0
- package/src/builders/dev-server/vite/index.js +11 -2
- package/src/builders/dev-server/vite/index.js.map +1 -1
- package/src/builders/karma/progress-reporter.js +2 -0
- package/src/builders/karma/progress-reporter.js.map +1 -1
- package/src/builders/unit-test/builder.js +0 -1
- package/src/builders/unit-test/builder.js.map +1 -1
- package/src/builders/unit-test/options.d.ts +4 -1
- package/src/builders/unit-test/options.js +22 -13
- package/src/builders/unit-test/options.js.map +1 -1
- package/src/builders/unit-test/runners/karma/executor.js +25 -3
- package/src/builders/unit-test/runners/karma/executor.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/browser-provider.js +1 -1
- package/src/builders/unit-test/runners/vitest/browser-provider.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/build-options.js +24 -1
- package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/configuration.d.ts +15 -0
- package/src/builders/unit-test/runners/vitest/configuration.js +57 -0
- package/src/builders/unit-test/runners/vitest/configuration.js.map +1 -0
- package/src/builders/unit-test/runners/vitest/executor.js +25 -53
- package/src/builders/unit-test/runners/vitest/executor.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/index.js +7 -1
- package/src/builders/unit-test/runners/vitest/index.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/plugins.d.ts +12 -5
- package/src/builders/unit-test/runners/vitest/plugins.js +188 -105
- package/src/builders/unit-test/runners/vitest/plugins.js.map +1 -1
- package/src/builders/unit-test/schema.d.ts +25 -0
- package/src/builders/unit-test/schema.js.map +1 -1
- package/src/builders/unit-test/schema.json +10 -0
- package/src/tools/esbuild/application-code-bundle.js +1 -1
- package/src/tools/esbuild/application-code-bundle.js.map +1 -1
- package/src/tools/esbuild/javascript-transformer.js.map +1 -1
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/prerender.js +2 -25
- package/src/utils/server-rendering/prerender.js.map +1 -1
- package/src/utils/server-rendering/render-worker.js +6 -1
- package/src/utils/server-rendering/render-worker.js.map +1 -1
- package/src/utils/server-rendering/utils.d.ts +10 -0
- package/src/utils/server-rendering/utils.js +25 -0
- package/src/utils/server-rendering/utils.js.map +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Finds the Vitest configuration file in the given search directories.
|
|
10
|
+
*
|
|
11
|
+
* @param searchDirs An array of directories to search for the configuration file.
|
|
12
|
+
* @returns The path to the configuration file, or `false` if no file is found.
|
|
13
|
+
* Returning `false` is used to disable Vitest's default configuration file search.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findVitestBaseConfig(searchDirs: string[]): Promise<string | false>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.findVitestBaseConfig = findVitestBaseConfig;
|
|
14
|
+
/**
|
|
15
|
+
* @fileoverview
|
|
16
|
+
* This file contains utility functions for finding the Vitest base configuration file.
|
|
17
|
+
*/
|
|
18
|
+
const promises_1 = require("node:fs/promises");
|
|
19
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
20
|
+
/**
|
|
21
|
+
* A list of potential Vitest configuration filenames.
|
|
22
|
+
* The order of the files is important as the first one found will be used.
|
|
23
|
+
*/
|
|
24
|
+
const POTENTIAL_CONFIGS = [
|
|
25
|
+
'vitest-base.config.ts',
|
|
26
|
+
'vitest-base.config.mts',
|
|
27
|
+
'vitest-base.config.cts',
|
|
28
|
+
'vitest-base.config.js',
|
|
29
|
+
'vitest-base.config.mjs',
|
|
30
|
+
'vitest-base.config.cjs',
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Finds the Vitest configuration file in the given search directories.
|
|
34
|
+
*
|
|
35
|
+
* @param searchDirs An array of directories to search for the configuration file.
|
|
36
|
+
* @returns The path to the configuration file, or `false` if no file is found.
|
|
37
|
+
* Returning `false` is used to disable Vitest's default configuration file search.
|
|
38
|
+
*/
|
|
39
|
+
async function findVitestBaseConfig(searchDirs) {
|
|
40
|
+
const uniqueDirs = new Set(searchDirs);
|
|
41
|
+
for (const dir of uniqueDirs) {
|
|
42
|
+
try {
|
|
43
|
+
const entries = await (0, promises_1.readdir)(dir, { withFileTypes: true });
|
|
44
|
+
const files = new Set(entries.filter((e) => e.isFile()).map((e) => e.name));
|
|
45
|
+
for (const potential of POTENTIAL_CONFIGS) {
|
|
46
|
+
if (files.has(potential)) {
|
|
47
|
+
return node_path_1.default.join(dir, potential);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Ignore directories that cannot be read
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["configuration.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AA8BH,oDAkBC;AA9CD;;;GAGG;AAEH,+CAA2C;AAC3C,0DAA6B;AAE7B;;;GAGG;AACH,MAAM,iBAAiB,GAAG;IACxB,uBAAuB;IACvB,wBAAwB;IACxB,wBAAwB;IACxB,uBAAuB;IACvB,wBAAwB;IACxB,wBAAwB;CACzB,CAAC;AAEF;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB,CAAC,UAAoB;IAC7D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAA,kBAAO,EAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;YAC5D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAE5E,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE,CAAC;gBAC1C,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;oBACzB,OAAO,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,yCAAyC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -47,9 +47,9 @@ exports.VitestExecutor = void 0;
|
|
|
47
47
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
48
48
|
const node_path_1 = __importDefault(require("node:path"));
|
|
49
49
|
const error_1 = require("../../../../utils/error");
|
|
50
|
-
const path_1 = require("../../../../utils/path");
|
|
51
50
|
const results_1 = require("../../../application/results");
|
|
52
51
|
const browser_provider_1 = require("./browser-provider");
|
|
52
|
+
const configuration_1 = require("./configuration");
|
|
53
53
|
const plugins_1 = require("./plugins");
|
|
54
54
|
class VitestExecutor {
|
|
55
55
|
vitest;
|
|
@@ -103,7 +103,7 @@ class VitestExecutor {
|
|
|
103
103
|
if (source) {
|
|
104
104
|
modifiedSourceFiles.add(source);
|
|
105
105
|
}
|
|
106
|
-
vitest.invalidateFile(
|
|
106
|
+
vitest.invalidateFile(this.normalizePath(node_path_1.default.join(this.options.workspaceRoot, modifiedFile)));
|
|
107
107
|
}
|
|
108
108
|
const specsToRerun = [];
|
|
109
109
|
for (const file of modifiedSourceFiles) {
|
|
@@ -135,7 +135,8 @@ class VitestExecutor {
|
|
|
135
135
|
return testSetupFiles;
|
|
136
136
|
}
|
|
137
137
|
async initializeVitest() {
|
|
138
|
-
const { coverage, reporters, outputFile, workspaceRoot, browsers, debug, watch, browserViewport, } = this.options;
|
|
138
|
+
const { coverage, reporters, outputFile, workspaceRoot, browsers, debug, watch, browserViewport, ui, } = this.options;
|
|
139
|
+
const projectName = this.projectName;
|
|
139
140
|
let vitestNodeModule;
|
|
140
141
|
try {
|
|
141
142
|
vitestNodeModule = await Promise.resolve().then(() => __importStar(require('vitest/node')));
|
|
@@ -155,12 +156,10 @@ class VitestExecutor {
|
|
|
155
156
|
}
|
|
156
157
|
(0, node_assert_1.default)(this.buildResultFiles.size > 0, 'buildResult must be available before initializing vitest');
|
|
157
158
|
const testSetupFiles = this.prepareSetupFiles();
|
|
158
|
-
const
|
|
159
|
+
const projectPlugins = (0, plugins_1.createVitestPlugins)({
|
|
159
160
|
workspaceRoot,
|
|
160
161
|
projectSourceRoot: this.options.projectSourceRoot,
|
|
161
|
-
projectName
|
|
162
|
-
include: this.options.include,
|
|
163
|
-
exclude: this.options.exclude,
|
|
162
|
+
projectName,
|
|
164
163
|
buildResultFiles: this.buildResultFiles,
|
|
165
164
|
testFileToEntryPoint: this.testFileToEntryPoint,
|
|
166
165
|
});
|
|
@@ -171,18 +170,18 @@ class VitestExecutor {
|
|
|
171
170
|
fileParallelism: false,
|
|
172
171
|
}
|
|
173
172
|
: {};
|
|
173
|
+
const runnerConfig = this.options.runnerConfig;
|
|
174
|
+
const externalConfigPath = runnerConfig === true
|
|
175
|
+
? await (0, configuration_1.findVitestBaseConfig)([this.options.projectRoot, this.options.workspaceRoot])
|
|
176
|
+
: runnerConfig;
|
|
174
177
|
return startVitest('test', undefined, {
|
|
175
|
-
|
|
176
|
-
config: false,
|
|
178
|
+
config: externalConfigPath,
|
|
177
179
|
root: workspaceRoot,
|
|
178
|
-
project:
|
|
179
|
-
name: 'base',
|
|
180
|
-
include: [],
|
|
181
|
-
testNamePattern: this.options.filter,
|
|
182
|
-
reporters: reporters ?? ['default'],
|
|
180
|
+
project: projectName,
|
|
183
181
|
outputFile,
|
|
182
|
+
testNamePattern: this.options.filter,
|
|
184
183
|
watch,
|
|
185
|
-
|
|
184
|
+
ui,
|
|
186
185
|
...debugOptions,
|
|
187
186
|
}, {
|
|
188
187
|
server: {
|
|
@@ -190,46 +189,19 @@ class VitestExecutor {
|
|
|
190
189
|
// be enabled as it controls other internal behavior related to rerunning tests.
|
|
191
190
|
watch: null,
|
|
192
191
|
},
|
|
193
|
-
plugins
|
|
192
|
+
plugins: [
|
|
193
|
+
(0, plugins_1.createVitestConfigPlugin)({
|
|
194
|
+
browser: browserOptions.browser,
|
|
195
|
+
coverage,
|
|
196
|
+
projectName,
|
|
197
|
+
reporters,
|
|
198
|
+
setupFiles: testSetupFiles,
|
|
199
|
+
projectPlugins,
|
|
200
|
+
include: [...this.testFileToEntryPoint.keys()],
|
|
201
|
+
}),
|
|
202
|
+
],
|
|
194
203
|
});
|
|
195
204
|
}
|
|
196
205
|
}
|
|
197
206
|
exports.VitestExecutor = VitestExecutor;
|
|
198
|
-
async function generateCoverageOption(coverage, projectName) {
|
|
199
|
-
if (!coverage) {
|
|
200
|
-
return {
|
|
201
|
-
enabled: false,
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
let defaultExcludes = [];
|
|
205
|
-
if (coverage.exclude) {
|
|
206
|
-
try {
|
|
207
|
-
const vitestConfig = await Promise.resolve().then(() => __importStar(require('vitest/config')));
|
|
208
|
-
defaultExcludes = vitestConfig.coverageConfigDefaults.exclude;
|
|
209
|
-
}
|
|
210
|
-
catch { }
|
|
211
|
-
}
|
|
212
|
-
return {
|
|
213
|
-
enabled: true,
|
|
214
|
-
excludeAfterRemap: true,
|
|
215
|
-
include: coverage.include,
|
|
216
|
-
reportsDirectory: (0, path_1.toPosixPath)(node_path_1.default.join('coverage', projectName)),
|
|
217
|
-
thresholds: coverage.thresholds,
|
|
218
|
-
watermarks: coverage.watermarks,
|
|
219
|
-
// Special handling for `exclude`/`reporters` due to an undefined value causing upstream failures
|
|
220
|
-
...(coverage.exclude
|
|
221
|
-
? {
|
|
222
|
-
exclude: [
|
|
223
|
-
// Augment the default exclude https://vitest.dev/config/#coverage-exclude
|
|
224
|
-
// with the user defined exclusions
|
|
225
|
-
...coverage.exclude,
|
|
226
|
-
...defaultExcludes,
|
|
227
|
-
],
|
|
228
|
-
}
|
|
229
|
-
: {}),
|
|
230
|
-
...(coverage.reporters
|
|
231
|
-
? { reporter: coverage.reporters }
|
|
232
|
-
: {}),
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
207
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["executor.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,8DAAiC;AACjC,0DAA6B;
|
|
1
|
+
{"version":3,"file":"executor.js","sour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|
checker.check('jsdom');
|
|
31
31
|
}
|
|
32
|
-
if (options.coverage) {
|
|
32
|
+
if (options.coverage.enabled) {
|
|
33
33
|
checker.check('@vitest/coverage-v8');
|
|
34
34
|
}
|
|
35
35
|
checker.report();
|
|
@@ -40,6 +40,12 @@ const VitestTestRunner = {
|
|
|
40
40
|
async createExecutor(context, options, testEntryPointMappings) {
|
|
41
41
|
const projectName = context.target?.project;
|
|
42
42
|
(0, node_assert_1.default)(projectName, 'The builder requires a target.');
|
|
43
|
+
if (typeof options.runnerConfig === 'string') {
|
|
44
|
+
context.logger.info(`Using Vitest configuration file: ${options.runnerConfig}`);
|
|
45
|
+
}
|
|
46
|
+
else if (options.runnerConfig) {
|
|
47
|
+
context.logger.info('Automatically searching for and using Vitest configuration file.');
|
|
48
|
+
}
|
|
43
49
|
return new executor_1.VitestExecutor(projectName, options, testEntryPointMappings);
|
|
44
50
|
},
|
|
45
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAEH,8DAAiC;AAEjC,8DAA0D;AAC1D,mDAAwD;AACxD,yCAA4C;AAE5C;;GAEG;AACH,MAAM,gBAAgB,GAAe;IACnC,IAAI,EAAE,QAAQ;IAEd,oBAAoB,CAAC,OAAO;QAC1B,MAAM,OAAO,GAAG,IAAI,sCAAiB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACjE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAExB,IAAI,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;YAC7B,OAAO,CAAC,QAAQ,CACd,CAAC,YAAY,EAAE,aAAa,CAAC,EAC7B,sFAAsF,CACvF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,+CAA+C;YAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;QAED,IAAI,OAAO,CAAC,QA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C,CAAC;QAClF,CAAC;aAAM,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YAChC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,IAAI,yBAAc,CAAC,WAAW,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IAC1E,CAAC;CACF,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -5,19 +5,26 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import type { VitestPlugin } from 'vitest/node';
|
|
8
|
+
import type { BrowserConfigOptions, VitestPlugin } from 'vitest/node';
|
|
9
9
|
import type { ResultFile } from '../../../application/results';
|
|
10
10
|
import type { NormalizedUnitTestBuilderOptions } from '../../options';
|
|
11
|
-
import type { BrowserConfiguration } from './browser-provider';
|
|
12
11
|
type VitestPlugins = Awaited<ReturnType<typeof VitestPlugin>>;
|
|
13
12
|
interface PluginOptions {
|
|
14
13
|
workspaceRoot: string;
|
|
15
14
|
projectSourceRoot: string;
|
|
16
15
|
projectName: string;
|
|
17
|
-
include?: string[];
|
|
18
|
-
exclude?: string[];
|
|
19
16
|
buildResultFiles: ReadonlyMap<string, ResultFile>;
|
|
20
17
|
testFileToEntryPoint: ReadonlyMap<string, string>;
|
|
21
18
|
}
|
|
22
|
-
|
|
19
|
+
interface VitestConfigPluginOptions {
|
|
20
|
+
browser: BrowserConfigOptions | undefined;
|
|
21
|
+
coverage: NormalizedUnitTestBuilderOptions['coverage'];
|
|
22
|
+
projectName: string;
|
|
23
|
+
reporters?: string[] | [string, object][];
|
|
24
|
+
setupFiles: string[];
|
|
25
|
+
projectPlugins: VitestPlugins;
|
|
26
|
+
include: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function createVitestConfigPlugin(options: VitestConfigPluginOptions): VitestPlugins[0];
|
|
29
|
+
export declare function createVitestPlugins(pluginOptions: PluginOptions): VitestPlugins;
|
|
23
30
|
export {};
|
|
@@ -6,127 +6,210 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
9
42
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
43
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
44
|
};
|
|
12
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.createVitestConfigPlugin = createVitestConfigPlugin;
|
|
13
47
|
exports.createVitestPlugins = createVitestPlugins;
|
|
14
48
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
15
49
|
const promises_1 = require("node:fs/promises");
|
|
16
50
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
51
|
const assets_middleware_1 = require("../../../../tools/vite/middlewares/assets-middleware");
|
|
18
52
|
const path_1 = require("../../../../utils/path");
|
|
19
|
-
function
|
|
20
|
-
const {
|
|
53
|
+
function createVitestConfigPlugin(options) {
|
|
54
|
+
const { include, browser, projectName, reporters, setupFiles, projectPlugins } = options;
|
|
55
|
+
return {
|
|
56
|
+
name: 'angular:vitest-configuration',
|
|
57
|
+
async config(config) {
|
|
58
|
+
const testConfig = config.test;
|
|
59
|
+
const projectConfig = {
|
|
60
|
+
test: {
|
|
61
|
+
...testConfig,
|
|
62
|
+
name: projectName,
|
|
63
|
+
setupFiles,
|
|
64
|
+
include,
|
|
65
|
+
globals: testConfig?.globals ?? true,
|
|
66
|
+
...(browser ? { browser } : {}),
|
|
67
|
+
// If the user has not specified an environment, use `jsdom`.
|
|
68
|
+
...(!testConfig?.environment ? { environment: 'jsdom' } : {}),
|
|
69
|
+
},
|
|
70
|
+
optimizeDeps: {
|
|
71
|
+
noDiscovery: true,
|
|
72
|
+
},
|
|
73
|
+
plugins: projectPlugins,
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
test: {
|
|
77
|
+
coverage: await generateCoverageOption(options.coverage, projectName),
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
+
...(reporters ? { reporters } : {}),
|
|
80
|
+
projects: [projectConfig],
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function createVitestPlugins(pluginOptions) {
|
|
87
|
+
const { workspaceRoot, buildResultFiles, testFileToEntryPoint } = pluginOptions;
|
|
21
88
|
return [
|
|
22
89
|
{
|
|
23
|
-
name: 'angular:
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
configureServer: (server) => {
|
|
107
|
-
server.middlewares.use((0, assets_middleware_1.createBuildAssetsMiddleware)(server.config.base, buildResultFiles));
|
|
108
|
-
},
|
|
109
|
-
},
|
|
90
|
+
name: 'angular:test-in-memory-provider',
|
|
91
|
+
enforce: 'pre',
|
|
92
|
+
resolveId: (id, importer) => {
|
|
93
|
+
if (importer && (id[0] === '.' || id[0] === '/')) {
|
|
94
|
+
let fullPath;
|
|
95
|
+
if (testFileToEntryPoint.has(importer)) {
|
|
96
|
+
fullPath = (0, path_1.toPosixPath)(node_path_1.default.join(workspaceRoot, id));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
fullPath = (0, path_1.toPosixPath)(node_path_1.default.join(node_path_1.default.dirname(importer), id));
|
|
100
|
+
}
|
|
101
|
+
const relativePath = node_path_1.default.relative(workspaceRoot, fullPath);
|
|
102
|
+
if (buildResultFiles.has((0, path_1.toPosixPath)(relativePath))) {
|
|
103
|
+
return fullPath;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (testFileToEntryPoint.has(id)) {
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
(0, node_assert_1.default)(buildResultFiles.size > 0, 'buildResult must be available for resolving.');
|
|
110
|
+
const relativePath = node_path_1.default.relative(workspaceRoot, id);
|
|
111
|
+
if (buildResultFiles.has((0, path_1.toPosixPath)(relativePath))) {
|
|
112
|
+
return id;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
load: async (id) => {
|
|
116
|
+
(0, node_assert_1.default)(buildResultFiles.size > 0, 'buildResult must be available for in-memory loading.');
|
|
117
|
+
// Attempt to load as a source test file.
|
|
118
|
+
const entryPoint = testFileToEntryPoint.get(id);
|
|
119
|
+
let outputPath;
|
|
120
|
+
if (entryPoint) {
|
|
121
|
+
outputPath = entryPoint + '.js';
|
|
122
|
+
// To support coverage exclusion of the actual test file, the virtual
|
|
123
|
+
// test entry point only references the built and bundled intermediate file.
|
|
124
|
+
return {
|
|
125
|
+
code: `import "./${outputPath}";`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// Attempt to load as a built artifact.
|
|
130
|
+
const relativePath = node_path_1.default.relative(workspaceRoot, id);
|
|
131
|
+
outputPath = (0, path_1.toPosixPath)(relativePath);
|
|
132
|
+
}
|
|
133
|
+
const outputFile = buildResultFiles.get(outputPath);
|
|
134
|
+
if (outputFile) {
|
|
135
|
+
const sourceMapPath = outputPath + '.map';
|
|
136
|
+
const sourceMapFile = buildResultFiles.get(sourceMapPath);
|
|
137
|
+
const code = outputFile.origin === 'memory'
|
|
138
|
+
? Buffer.from(outputFile.contents).toString('utf-8')
|
|
139
|
+
: await (0, promises_1.readFile)(outputFile.inputPath, 'utf-8');
|
|
140
|
+
const sourceMapText = sourceMapFile
|
|
141
|
+
? sourceMapFile.origin === 'memory'
|
|
142
|
+
? Buffer.from(sourceMapFile.contents).toString('utf-8')
|
|
143
|
+
: await (0, promises_1.readFile)(sourceMapFile.inputPath, 'utf-8')
|
|
144
|
+
: undefined;
|
|
145
|
+
// Vitest will include files in the coverage report if the sourcemap contains no sources.
|
|
146
|
+
// For builder-internal generated code chunks, which are typically helper functions,
|
|
147
|
+
// a virtual source is added to the sourcemap to prevent them from being incorrectly
|
|
148
|
+
// included in the final coverage report.
|
|
149
|
+
const map = sourceMapText ? JSON.parse(sourceMapText) : undefined;
|
|
150
|
+
if (map) {
|
|
151
|
+
if (!map.sources?.length && !map.sourcesContent?.length && !map.mappings) {
|
|
152
|
+
map.sources = ['virtual:builder'];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
code,
|
|
157
|
+
map,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
configureServer: (server) => {
|
|
162
|
+
server.middlewares.use((0, assets_middleware_1.createBuildAssetsMiddleware)(server.config.base, buildResultFiles));
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'angular:html-index',
|
|
167
|
+
transformIndexHtml: () => {
|
|
168
|
+
// Add all global stylesheets
|
|
169
|
+
if (buildResultFiles.has('styles.css')) {
|
|
170
|
+
return [
|
|
110
171
|
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (buildResultFiles.has('styles.css')) {
|
|
115
|
-
return [
|
|
116
|
-
{
|
|
117
|
-
tag: 'link',
|
|
118
|
-
attrs: { href: 'styles.css', rel: 'stylesheet' },
|
|
119
|
-
injectTo: 'head',
|
|
120
|
-
},
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
return [];
|
|
124
|
-
},
|
|
172
|
+
tag: 'link',
|
|
173
|
+
attrs: { href: 'styles.css', rel: 'stylesheet' },
|
|
174
|
+
injectTo: 'head',
|
|
125
175
|
},
|
|
126
|
-
]
|
|
127
|
-
}
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
return [];
|
|
128
179
|
},
|
|
129
180
|
},
|
|
130
181
|
];
|
|
131
182
|
}
|
|
183
|
+
async function generateCoverageOption(coverage, projectName) {
|
|
184
|
+
let defaultExcludes = [];
|
|
185
|
+
if (coverage.exclude) {
|
|
186
|
+
try {
|
|
187
|
+
const vitestConfig = await Promise.resolve().then(() => __importStar(require('vitest/config')));
|
|
188
|
+
defaultExcludes = vitestConfig.coverageConfigDefaults.exclude;
|
|
189
|
+
}
|
|
190
|
+
catch { }
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
enabled: coverage.enabled,
|
|
194
|
+
excludeAfterRemap: true,
|
|
195
|
+
include: coverage.include,
|
|
196
|
+
reportsDirectory: (0, path_1.toPosixPath)(node_path_1.default.join('coverage', projectName)),
|
|
197
|
+
thresholds: coverage.thresholds,
|
|
198
|
+
watermarks: coverage.watermarks,
|
|
199
|
+
// Special handling for `exclude`/`reporters` due to an undefined value causing upstream failures
|
|
200
|
+
...(coverage.exclude
|
|
201
|
+
? {
|
|
202
|
+
exclude: [
|
|
203
|
+
// Augment the default exclude https://vitest.dev/config/#coverage-exclude
|
|
204
|
+
// with the user defined exclusions
|
|
205
|
+
...coverage.exclude,
|
|
206
|
+
...defaultExcludes,
|
|
207
|
+
],
|
|
208
|
+
}
|
|
209
|
+
: {}),
|
|
210
|
+
...(coverage.reporters
|
|
211
|
+
? { reporter: coverage.reporters }
|
|
212
|
+
: {}),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
132
215
|
//# sourceMappingURL=plugins.js.map
|