@analogjs/vitest-angular 3.0.0-alpha.99 → 3.0.0-beta.2
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/_virtual/{_@oxc-project_runtime@0.124.0/helpers → _@oxc-project_runtime@0.149.0/helpers/esm}/decorate.js +2 -2
- package/package.json +1 -1
- package/setup-serializers.js.map +1 -1
- package/setup-snapshots.js.map +1 -1
- package/setup-testbed.js +1 -1
- package/setup-testbed.js.map +1 -1
- package/setup-zone.js.map +1 -1
- package/src/lib/builders/build/devkit.js.map +1 -1
- package/src/lib/builders/build/plugins/angular-memory-plugin.js.map +1 -1
- package/src/lib/builders/build/plugins/downlevel-plugin.js.map +1 -1
- package/src/lib/builders/build/schema.js +53 -47
- package/src/lib/builders/build/vitest.impl.js +13 -17
- package/src/lib/builders/build/vitest.impl.js.map +1 -1
- package/src/lib/builders/test/schema.js +49 -44
- package/src/lib/builders/test/vitest.impl.js +2 -2
- package/src/lib/builders/test/vitest.impl.js.map +1 -1
- package/src/lib/snapshot-serializers/angular-fixture.js.map +1 -1
- package/src/lib/snapshot-serializers/html-comment.js.map +1 -1
- package/src/lib/snapshot-serializers/no-ng-attributes.js +1 -1
- package/src/lib/snapshot-serializers/no-ng-attributes.js.map +1 -1
- package/src/lib/tools/schematics/setup/index.js +2 -1
- package/src/lib/tools/schematics/setup/index.js.map +1 -1
- package/src/lib/tools/schematics/utils/angular.js.map +1 -1
- package/src/lib/tools/schematics/utils/dependencies.js +2 -1
- package/src/lib/tools/schematics/utils/dependencies.js.map +1 -1
- package/src/lib/tools/schematics/utils/index.js +18 -4
- package/src/lib/tools/schematics/utils/versions.d.ts +1 -1
- package/src/lib/tools/schematics/utils/versions.js +1 -1
- package/src/lib/tools/schematics/utils/versions.js.map +1 -1
- package/src/lib/tools/schematics/utils/workspace.js.map +1 -1
- package/src/lib/tools/src/schematics/utils/versions.d.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
2
2
|
function __decorate(decorators, target, key, desc) {
|
|
3
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6,4 +6,4 @@ function __decorate(decorators, target, key, desc) {
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
|
-
export { __decorate };
|
|
9
|
+
export { __decorate as default };
|
package/package.json
CHANGED
package/setup-serializers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-serializers.js","names":[],"sources":["../setup-serializers.ts"],"sourcesContent":["import {\n createHtmlCommentSnapshotSerializer,\n createNoNgAttributesSnapshotSerializer,\n} from './snapshot-serializers.js';\n\nconst env = globalThis as any;\n\n['expect'].forEach((methodName) => {\n const originalVitestFn = env[methodName];\n if (!originalVitestFn) {\n return;\n }\n originalVitestFn.addSnapshotSerializer(createHtmlCommentSnapshotSerializer());\n originalVitestFn.addSnapshotSerializer(\n createNoNgAttributesSnapshotSerializer(),\n );\n});\n"],"mappings":";;;AAKA,IAAM,MAAM;AAEZ,CAAC,
|
|
1
|
+
{"version":3,"file":"setup-serializers.js","names":[],"sources":["../setup-serializers.ts"],"sourcesContent":["import {\n createHtmlCommentSnapshotSerializer,\n createNoNgAttributesSnapshotSerializer,\n} from './snapshot-serializers.js';\n\nconst env = globalThis as any;\n\n['expect'].forEach((methodName) => {\n const originalVitestFn = env[methodName];\n if (!originalVitestFn) {\n return;\n }\n originalVitestFn.addSnapshotSerializer(createHtmlCommentSnapshotSerializer());\n originalVitestFn.addSnapshotSerializer(\n createNoNgAttributesSnapshotSerializer(),\n );\n});\n"],"mappings":";;;AAKA,IAAM,MAAM;AAEZ,CAAC,QAAQ,CAAC,CAAC,SAAS,eAAe;CACjC,MAAM,mBAAmB,IAAI;CAC7B,IAAI,CAAC,kBACH;CAEF,iBAAiB,sBAAsB,oCAAoC,CAAC;CAC5E,iBAAiB,sBACf,uCAAuC,CACzC;AACF,CAAC"}
|
package/setup-snapshots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-snapshots.js","names":[],"sources":["../setup-snapshots.ts"],"sourcesContent":["import { createAngularFixtureSnapshotSerializer } from './snapshot-serializers.js';\n\nconst env = globalThis as any;\n\n['expect'].forEach((methodName) => {\n const originalVitestFn = env[methodName];\n if (!originalVitestFn) {\n return;\n }\n originalVitestFn.addSnapshotSerializer(\n createAngularFixtureSnapshotSerializer(),\n );\n});\n"],"mappings":";;AAEA,IAAM,MAAM;AAEZ,CAAC,
|
|
1
|
+
{"version":3,"file":"setup-snapshots.js","names":[],"sources":["../setup-snapshots.ts"],"sourcesContent":["import { createAngularFixtureSnapshotSerializer } from './snapshot-serializers.js';\n\nconst env = globalThis as any;\n\n['expect'].forEach((methodName) => {\n const originalVitestFn = env[methodName];\n if (!originalVitestFn) {\n return;\n }\n originalVitestFn.addSnapshotSerializer(\n createAngularFixtureSnapshotSerializer(),\n );\n});\n"],"mappings":";;AAEA,IAAM,MAAM;AAEZ,CAAC,QAAQ,CAAC,CAAC,SAAS,eAAe;CACjC,MAAM,mBAAmB,IAAI;CAC7B,IAAI,CAAC,kBACH;CAEF,iBAAiB,sBACf,uCAAuC,CACzC;AACF,CAAC"}
|
package/setup-testbed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import __decorate from "./_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/decorate.js";
|
|
2
2
|
import { NgModule, provideZonelessChangeDetection } from "@angular/core";
|
|
3
3
|
import { getTestBed, ɵgetCleanupHook } from "@angular/core/testing";
|
|
4
4
|
import { BrowserTestingModule, platformBrowserTesting } from "@angular/platform-browser/testing";
|
package/setup-testbed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-testbed.js","names":[],"sources":["../setup-testbed.ts"],"sourcesContent":["import {\n EnvironmentProviders,\n NgModule,\n Provider,\n provideZonelessChangeDetection,\n} from '@angular/core';\nimport {\n ɵgetCleanupHook as getCleanupHook,\n getTestBed,\n} from '@angular/core/testing';\nimport {\n BrowserTestingModule,\n platformBrowserTesting,\n} from '@angular/platform-browser/testing';\nimport { afterEach, beforeEach } from 'vitest';\n\nconst ANGULAR_TESTBED_SETUP = Symbol.for('testbed-setup');\n\ntype TestBedSetupOptions = {\n zoneless?: boolean;\n providers?: (Provider | EnvironmentProviders)[];\n teardown?: {\n destroyAfterEach: boolean;\n };\n errorOnUnknownElements?: boolean;\n errorOnUnknownProperties?: boolean;\n};\n\nexport function setupTestBed({\n zoneless = true,\n providers = [],\n teardown,\n errorOnUnknownElements,\n errorOnUnknownProperties,\n}: TestBedSetupOptions = {}): void {\n beforeEach(getCleanupHook(false));\n afterEach(getCleanupHook(true));\n\n if (!(globalThis as any)[ANGULAR_TESTBED_SETUP]) {\n (globalThis as any)[ANGULAR_TESTBED_SETUP] = true;\n\n @NgModule({\n providers: [\n ...(zoneless ? [provideZonelessChangeDetection()] : []),\n ...providers,\n ],\n })\n class TestModule {}\n\n getTestBed().initTestEnvironment(\n [BrowserTestingModule, TestModule],\n platformBrowserTesting(),\n {\n teardown: {\n destroyAfterEach: true,\n ...teardown,\n },\n errorOnUnknownElements,\n errorOnUnknownProperties,\n },\n );\n }\n}\n"],"mappings":";;;;;;AAgBA,IAAM,wBAAwB,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"setup-testbed.js","names":[],"sources":["../setup-testbed.ts"],"sourcesContent":["import {\n EnvironmentProviders,\n NgModule,\n Provider,\n provideZonelessChangeDetection,\n} from '@angular/core';\nimport {\n ɵgetCleanupHook as getCleanupHook,\n getTestBed,\n} from '@angular/core/testing';\nimport {\n BrowserTestingModule,\n platformBrowserTesting,\n} from '@angular/platform-browser/testing';\nimport { afterEach, beforeEach } from 'vitest';\n\nconst ANGULAR_TESTBED_SETUP = Symbol.for('testbed-setup');\n\ntype TestBedSetupOptions = {\n zoneless?: boolean;\n providers?: (Provider | EnvironmentProviders)[];\n teardown?: {\n destroyAfterEach: boolean;\n };\n errorOnUnknownElements?: boolean;\n errorOnUnknownProperties?: boolean;\n};\n\nexport function setupTestBed({\n zoneless = true,\n providers = [],\n teardown,\n errorOnUnknownElements,\n errorOnUnknownProperties,\n}: TestBedSetupOptions = {}): void {\n beforeEach(getCleanupHook(false));\n afterEach(getCleanupHook(true));\n\n if (!(globalThis as any)[ANGULAR_TESTBED_SETUP]) {\n (globalThis as any)[ANGULAR_TESTBED_SETUP] = true;\n\n @NgModule({\n providers: [\n ...(zoneless ? [provideZonelessChangeDetection()] : []),\n ...providers,\n ],\n })\n class TestModule {}\n\n getTestBed().initTestEnvironment(\n [BrowserTestingModule, TestModule],\n platformBrowserTesting(),\n {\n teardown: {\n destroyAfterEach: true,\n ...teardown,\n },\n errorOnUnknownElements,\n errorOnUnknownProperties,\n },\n );\n }\n}\n"],"mappings":";;;;;;AAgBA,IAAM,wBAAwB,OAAO,IAAI,eAAe;AAYxD,SAAgB,aAAa,EAC3B,WAAW,MACX,YAAY,CAAC,GACb,UACA,wBACA,6BACuB,CAAC,GAAS;CACjC,WAAW,gBAAe,KAAK,CAAC;CAChC,UAAU,gBAAe,IAAI,CAAC;CAE9B,IAAI,CAAE,WAAmB,wBAAwB;EAC/C,WAAoB,yBAAyB;EAE7C,IAMM,aANN,MAMM,WAAW,CAAC;EANjB,aAAA,WAAA,CAAA,SAAS,EACR,WAAW,CACT,GAAI,WAAW,CAAC,+BAA+B,CAAC,IAAI,CAAC,GACrD,GAAG,SACL,EACF,CAAC,CAAA,GAAA,UAAA;EAGD,WAAW,CAAC,CAAC,oBACX,CAAC,sBAAsB,UAAU,GACjC,uBAAuB,GACvB;GACE,UAAU;IACR,kBAAkB;IAClB,GAAG;GACL;GACA;GACA;EACF,CACF;CACF;AACF"}
|
package/setup-zone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-zone.js","names":[],"sources":["../setup-zone.ts"],"sourcesContent":["import 'zone.js';\nimport 'zone.js/plugins/sync-test';\nimport 'zone.js/plugins/proxy';\nimport 'zone.js/testing';\n\nimport './setup-snapshots.js';\n/**\n * Patch Vitest's describe/test/beforeEach/afterEach functions so test code\n * always runs in a testZone (ProxyZone).\n */\n/* global Zone */\nconst Zone = (globalThis as any)['Zone'];\n\nif (Zone === undefined) {\n throw new Error('Missing: Zone (zone.js)');\n}\n\n// Setup files are re-executed for every test file in a reused worker\n// (e.g. isolate: false, or bundled setup entries). The patched functions\n// live on the same globalThis as this flag, so skip instead of re-patching.\nif ((globalThis as any)['__vitest_zone_patch__'] !== true) {\n (globalThis as any)['__vitest_zone_patch__'] = true;\n const SyncTestZoneSpec = Zone['SyncTestZoneSpec'];\n const ProxyZoneSpec = Zone['ProxyZoneSpec'];\n\n if (SyncTestZoneSpec === undefined) {\n throw new Error('Missing: SyncTestZoneSpec (zone.js/plugins/sync-test)');\n }\n if (ProxyZoneSpec === undefined) {\n throw new Error('Missing: ProxyZoneSpec (zone.js/plugins/proxy.js)');\n }\n\n const env = globalThis as any;\n const ambientZone = Zone.current;\n\n // Create a synchronous-only zone in which to run `describe` blocks in order to\n // raise an error if any asynchronous operations are attempted\n // inside of a `describe` but outside of a `beforeEach` or `it`.\n const syncZone = ambientZone.fork(new SyncTestZoneSpec('vitest.describe'));\n const wrapDescribeInZone = function (describeBody: any) {\n return function (...args: any) {\n return syncZone.run(describeBody, null, args);\n };\n };\n\n // Create a proxy zone in which to run `test` blocks so that the tests function\n // can retroactively install different zones.\n const testProxyZone = ambientZone.fork(new ProxyZoneSpec());\n const wrapTestInZone = function (testBody: string | any[] | undefined) {\n if (testBody === undefined) {\n return;\n }\n\n const wrappedFunc = function () {\n return testProxyZone.run(testBody, null, arguments);\n };\n try {\n Object.defineProperty(wrappedFunc, 'length', {\n configurable: true,\n writable: true,\n enumerable: false,\n });\n wrappedFunc.length = testBody.length;\n } catch (e) {\n return testBody.length === 0\n ? () => testProxyZone.run(testBody, null)\n : (done: any) => testProxyZone.run(testBody, null, [done]);\n }\n\n return wrappedFunc;\n };\n\n /**\n * bind describe method to wrap describe.each function\n */\n const bindDescribe = (\n self: any,\n originalVitestFn: {\n apply: (\n arg0: any,\n arg1: any[],\n ) => {\n (): any;\n new (): any;\n apply: { (arg0: any, arg1: any[]): any; new (): any };\n };\n },\n ) =>\n function (...eachArgs: any) {\n return function (...args: any[]) {\n args[1] = wrapDescribeInZone(args[1]);\n\n // @ts-ignore\n return originalVitestFn.apply(self, eachArgs).apply(self, args);\n };\n };\n\n /**\n * bind test method to wrap test.each function\n */\n const bindTest = (\n self: any,\n originalVitestFn: {\n apply: (\n arg0: any,\n arg1: any[],\n ) => {\n (): any;\n new (): any;\n apply: { (arg0: any, arg1: any[]): any; new (): any };\n };\n },\n ) =>\n function (...eachArgs: any) {\n return function (...args: any[]) {\n args[1] = wrapTestInZone(args[1]);\n\n // @ts-ignore\n return originalVitestFn.apply(self, eachArgs).apply(self, args);\n };\n };\n\n ['describe'].forEach((methodName) => {\n const originalvitestFn = env[methodName];\n env[methodName] = function (...args: any[]) {\n args[1] = wrapDescribeInZone(args[1]);\n\n return originalvitestFn.apply(this, args);\n };\n env[methodName].each = bindDescribe(\n originalvitestFn,\n originalvitestFn.each,\n );\n if (methodName === 'describe') {\n env[methodName].only = bindDescribe(\n originalvitestFn,\n originalvitestFn.only,\n );\n env[methodName].skip = bindDescribe(\n originalvitestFn,\n originalvitestFn.skip,\n );\n }\n });\n\n ['test', 'it'].forEach((methodName) => {\n const originalvitestFn = env[methodName];\n env[methodName] = function (...args: any[]) {\n args[1] = wrapTestInZone(args[1]);\n\n return originalvitestFn.apply(this, args);\n };\n env[methodName].each = bindTest(originalvitestFn, originalvitestFn.each);\n env[methodName].only = bindTest(originalvitestFn, originalvitestFn.only);\n env[methodName].skip = bindTest(originalvitestFn, originalvitestFn.skip);\n\n if (methodName === 'test' || methodName === 'it') {\n env[methodName].todo = function (...args: any) {\n return originalvitestFn.todo.apply(this, args);\n };\n }\n });\n\n ['beforeEach', 'afterEach', 'beforeAll', 'afterAll'].forEach((methodName) => {\n const originalvitestFn = env[methodName];\n\n env[methodName] = function (...args: any[]) {\n args[0] = wrapTestInZone(args[0]);\n\n return originalvitestFn.apply(this, args);\n };\n });\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAM,OAAQ,WAAmB;AAEjC,IAAI,SAAS,KAAA,
|
|
1
|
+
{"version":3,"file":"setup-zone.js","names":[],"sources":["../setup-zone.ts"],"sourcesContent":["import 'zone.js';\nimport 'zone.js/plugins/sync-test';\nimport 'zone.js/plugins/proxy';\nimport 'zone.js/testing';\n\nimport './setup-snapshots.js';\n/**\n * Patch Vitest's describe/test/beforeEach/afterEach functions so test code\n * always runs in a testZone (ProxyZone).\n */\n/* global Zone */\nconst Zone = (globalThis as any)['Zone'];\n\nif (Zone === undefined) {\n throw new Error('Missing: Zone (zone.js)');\n}\n\n// Setup files are re-executed for every test file in a reused worker\n// (e.g. isolate: false, or bundled setup entries). The patched functions\n// live on the same globalThis as this flag, so skip instead of re-patching.\nif ((globalThis as any)['__vitest_zone_patch__'] !== true) {\n (globalThis as any)['__vitest_zone_patch__'] = true;\n const SyncTestZoneSpec = Zone['SyncTestZoneSpec'];\n const ProxyZoneSpec = Zone['ProxyZoneSpec'];\n\n if (SyncTestZoneSpec === undefined) {\n throw new Error('Missing: SyncTestZoneSpec (zone.js/plugins/sync-test)');\n }\n if (ProxyZoneSpec === undefined) {\n throw new Error('Missing: ProxyZoneSpec (zone.js/plugins/proxy.js)');\n }\n\n const env = globalThis as any;\n const ambientZone = Zone.current;\n\n // Create a synchronous-only zone in which to run `describe` blocks in order to\n // raise an error if any asynchronous operations are attempted\n // inside of a `describe` but outside of a `beforeEach` or `it`.\n const syncZone = ambientZone.fork(new SyncTestZoneSpec('vitest.describe'));\n const wrapDescribeInZone = function (describeBody: any) {\n return function (...args: any) {\n return syncZone.run(describeBody, null, args);\n };\n };\n\n // Create a proxy zone in which to run `test` blocks so that the tests function\n // can retroactively install different zones.\n const testProxyZone = ambientZone.fork(new ProxyZoneSpec());\n const wrapTestInZone = function (testBody: string | any[] | undefined) {\n if (testBody === undefined) {\n return;\n }\n\n const wrappedFunc = function () {\n return testProxyZone.run(testBody, null, arguments);\n };\n try {\n Object.defineProperty(wrappedFunc, 'length', {\n configurable: true,\n writable: true,\n enumerable: false,\n });\n wrappedFunc.length = testBody.length;\n } catch (e) {\n return testBody.length === 0\n ? () => testProxyZone.run(testBody, null)\n : (done: any) => testProxyZone.run(testBody, null, [done]);\n }\n\n return wrappedFunc;\n };\n\n /**\n * bind describe method to wrap describe.each function\n */\n const bindDescribe = (\n self: any,\n originalVitestFn: {\n apply: (\n arg0: any,\n arg1: any[],\n ) => {\n (): any;\n new (): any;\n apply: { (arg0: any, arg1: any[]): any; new (): any };\n };\n },\n ) =>\n function (...eachArgs: any) {\n return function (...args: any[]) {\n args[1] = wrapDescribeInZone(args[1]);\n\n // @ts-ignore\n return originalVitestFn.apply(self, eachArgs).apply(self, args);\n };\n };\n\n /**\n * bind test method to wrap test.each function\n */\n const bindTest = (\n self: any,\n originalVitestFn: {\n apply: (\n arg0: any,\n arg1: any[],\n ) => {\n (): any;\n new (): any;\n apply: { (arg0: any, arg1: any[]): any; new (): any };\n };\n },\n ) =>\n function (...eachArgs: any) {\n return function (...args: any[]) {\n args[1] = wrapTestInZone(args[1]);\n\n // @ts-ignore\n return originalVitestFn.apply(self, eachArgs).apply(self, args);\n };\n };\n\n ['describe'].forEach((methodName) => {\n const originalvitestFn = env[methodName];\n env[methodName] = function (...args: any[]) {\n args[1] = wrapDescribeInZone(args[1]);\n\n return originalvitestFn.apply(this, args);\n };\n env[methodName].each = bindDescribe(\n originalvitestFn,\n originalvitestFn.each,\n );\n if (methodName === 'describe') {\n env[methodName].only = bindDescribe(\n originalvitestFn,\n originalvitestFn.only,\n );\n env[methodName].skip = bindDescribe(\n originalvitestFn,\n originalvitestFn.skip,\n );\n }\n });\n\n ['test', 'it'].forEach((methodName) => {\n const originalvitestFn = env[methodName];\n env[methodName] = function (...args: any[]) {\n args[1] = wrapTestInZone(args[1]);\n\n return originalvitestFn.apply(this, args);\n };\n env[methodName].each = bindTest(originalvitestFn, originalvitestFn.each);\n env[methodName].only = bindTest(originalvitestFn, originalvitestFn.only);\n env[methodName].skip = bindTest(originalvitestFn, originalvitestFn.skip);\n\n if (methodName === 'test' || methodName === 'it') {\n env[methodName].todo = function (...args: any) {\n return originalvitestFn.todo.apply(this, args);\n };\n }\n });\n\n ['beforeEach', 'afterEach', 'beforeAll', 'afterAll'].forEach((methodName) => {\n const originalvitestFn = env[methodName];\n\n env[methodName] = function (...args: any[]) {\n args[0] = wrapTestInZone(args[0]);\n\n return originalvitestFn.apply(this, args);\n };\n });\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devkit.js","names":[],"sources":["../../../../../src/lib/builders/build/devkit.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\nconst _require = createRequire(import.meta.url);\n\nexport async function getBuildApplicationFunction(): Promise<{\n buildApplicationInternal: (...args: any[]) => any;\n}> {\n const { VERSION } = await (Function(\n 'return import(\"@angular/compiler-cli\")',\n )() as Promise<{ VERSION: { major: string; minor: string } }>);\n\n if (Number(VERSION.major) < 20) {\n throw new Error(\n 'This builder is not supported with versions earlier than Angular v20',\n );\n }\n\n const { buildApplicationInternal } = _require('@angular/build/private');\n\n return { buildApplicationInternal };\n}\n"],"mappings":";;AAEA,IAAM,WAAW,cAAc,
|
|
1
|
+
{"version":3,"file":"devkit.js","names":[],"sources":["../../../../../src/lib/builders/build/devkit.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\nconst _require = createRequire(import.meta.url);\n\nexport async function getBuildApplicationFunction(): Promise<{\n buildApplicationInternal: (...args: any[]) => any;\n}> {\n const { VERSION } = await (Function(\n 'return import(\"@angular/compiler-cli\")',\n )() as Promise<{ VERSION: { major: string; minor: string } }>);\n\n if (Number(VERSION.major) < 20) {\n throw new Error(\n 'This builder is not supported with versions earlier than Angular v20',\n );\n }\n\n const { buildApplicationInternal } = _require('@angular/build/private');\n\n return { buildApplicationInternal };\n}\n"],"mappings":";;AAEA,IAAM,WAAW,cAAc,YAAY,GAAG;AAE9C,eAAsB,8BAEnB;CACD,MAAM,EAAE,YAAY,MAAO,SACzB,0CACF,CAAC,CAAC;CAEF,IAAI,OAAO,QAAQ,KAAK,IAAI,IAC1B,MAAM,IAAI,MACR,sEACF;CAGF,MAAM,EAAE,6BAA6B,SAAS,wBAAwB;CAEtE,OAAO,EAAE,yBAAyB;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-memory-plugin.js","names":[],"sources":["../../../../../../src/lib/builders/build/plugins/angular-memory-plugin.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// import assert from 'node:assert';\nimport { dirname, join, relative, resolve } from 'node:path';\n\nimport { AngularMemoryOutputFiles } from '../utils';\n\ninterface AngularMemoryPluginOptions {\n workspaceRoot?: string;\n outputFiles: AngularMemoryOutputFiles;\n external?: string[];\n}\n\nexport async function createAngularMemoryPlugin(\n options: AngularMemoryPluginOptions,\n): Promise<{\n name: string;\n enforce: string;\n config: (userConfig: any) => void;\n resolveId: (source: string, importer: string) => Promise<string | undefined>;\n load: (id: string) => { code: string; map: string | undefined } | undefined;\n}> {\n const { normalizePath } = await (Function(\n 'return import(\"vite\")',\n )() as Promise<typeof import('vite')>);\n const { outputFiles, external } = options;\n let config;\n let projectRoot: string;\n const workspaceRoot = options?.workspaceRoot || process.cwd();\n\n return {\n name: 'vite:angular-memory',\n // Ensures plugin hooks run before built-in Vite hooks\n enforce: 'pre',\n config(userConfig: any) {\n config = userConfig;\n projectRoot = resolve(workspaceRoot, config.root || '.');\n },\n async resolveId(source: string, importer: string) {\n // Prevent vite from resolving an explicit external dependency (`externalDependencies` option)\n if (external?.includes(source)) {\n // This is still not ideal since Vite will still transform the import specifier to\n // `/@id/${source}` but is currently closer to a raw external than a resolved file path.\n return source;\n }\n\n if (importer) {\n if (\n source[0] === '.' &&\n normalizePath(importer).startsWith(projectRoot)\n ) {\n // Remove query if present\n const [importerFile] = importer.split('?', 1);\n source =\n '/' + join(dirname(relative(projectRoot, importerFile)), source);\n }\n }\n\n const [file] = source.split('?', 1);\n const fileSplits = file.split('/');\n\n if (outputFiles.has(fileSplits[fileSplits.length - 1])) {\n return fileSplits[fileSplits.length - 1];\n }\n\n if (outputFiles.has(file)) {\n return join(projectRoot, source);\n }\n return;\n },\n load(id: string) {\n const [file] = id.split('?', 1);\n const relativeFile =\n 'spec-' +\n normalizePath(relative(projectRoot, file))\n .replace('.ts', '.js')\n .replace(/^[./]+/, '_')\n .replace(/\\//g, '-');\n\n const codeContents =\n outputFiles.get(relativeFile)?.contents ||\n outputFiles.get(id)?.contents;\n if (codeContents === undefined) {\n return undefined;\n }\n\n const code = Buffer.from(codeContents).toString('utf-8');\n const mapContents = outputFiles.get(relativeFile + '.map')?.contents;\n\n return {\n // Remove source map URL comments from the code if a sourcemap is present.\n // Vite will inline and add an additional sourcemap URL for the sourcemap.\n code: mapContents\n ? code.replace(/^\\/\\/# sourceMappingURL=[^\\r\\n]*/gm, '')\n : code,\n map: mapContents && Buffer.from(mapContents).toString('utf-8'),\n };\n },\n };\n}\n"],"mappings":";;;;;;;;;AAmBA,eAAsB,0BACpB,SAOC;CACD,MAAM,EAAE,kBAAkB,MAAO,SAC/B,
|
|
1
|
+
{"version":3,"file":"angular-memory-plugin.js","names":[],"sources":["../../../../../../src/lib/builders/build/plugins/angular-memory-plugin.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// import assert from 'node:assert';\nimport { dirname, join, relative, resolve } from 'node:path';\n\nimport { AngularMemoryOutputFiles } from '../utils';\n\ninterface AngularMemoryPluginOptions {\n workspaceRoot?: string;\n outputFiles: AngularMemoryOutputFiles;\n external?: string[];\n}\n\nexport async function createAngularMemoryPlugin(\n options: AngularMemoryPluginOptions,\n): Promise<{\n name: string;\n enforce: string;\n config: (userConfig: any) => void;\n resolveId: (source: string, importer: string) => Promise<string | undefined>;\n load: (id: string) => { code: string; map: string | undefined } | undefined;\n}> {\n const { normalizePath } = await (Function(\n 'return import(\"vite\")',\n )() as Promise<typeof import('vite')>);\n const { outputFiles, external } = options;\n let config;\n let projectRoot: string;\n const workspaceRoot = options?.workspaceRoot || process.cwd();\n\n return {\n name: 'vite:angular-memory',\n // Ensures plugin hooks run before built-in Vite hooks\n enforce: 'pre',\n config(userConfig: any) {\n config = userConfig;\n projectRoot = resolve(workspaceRoot, config.root || '.');\n },\n async resolveId(source: string, importer: string) {\n // Prevent vite from resolving an explicit external dependency (`externalDependencies` option)\n if (external?.includes(source)) {\n // This is still not ideal since Vite will still transform the import specifier to\n // `/@id/${source}` but is currently closer to a raw external than a resolved file path.\n return source;\n }\n\n if (importer) {\n if (\n source[0] === '.' &&\n normalizePath(importer).startsWith(projectRoot)\n ) {\n // Remove query if present\n const [importerFile] = importer.split('?', 1);\n source =\n '/' + join(dirname(relative(projectRoot, importerFile)), source);\n }\n }\n\n const [file] = source.split('?', 1);\n const fileSplits = file.split('/');\n\n if (outputFiles.has(fileSplits[fileSplits.length - 1])) {\n return fileSplits[fileSplits.length - 1];\n }\n\n if (outputFiles.has(file)) {\n return join(projectRoot, source);\n }\n return;\n },\n load(id: string) {\n const [file] = id.split('?', 1);\n const relativeFile =\n 'spec-' +\n normalizePath(relative(projectRoot, file))\n .replace('.ts', '.js')\n .replace(/^[./]+/, '_')\n .replace(/\\//g, '-');\n\n const codeContents =\n outputFiles.get(relativeFile)?.contents ||\n outputFiles.get(id)?.contents;\n if (codeContents === undefined) {\n return undefined;\n }\n\n const code = Buffer.from(codeContents).toString('utf-8');\n const mapContents = outputFiles.get(relativeFile + '.map')?.contents;\n\n return {\n // Remove source map URL comments from the code if a sourcemap is present.\n // Vite will inline and add an additional sourcemap URL for the sourcemap.\n code: mapContents\n ? code.replace(/^\\/\\/# sourceMappingURL=[^\\r\\n]*/gm, '')\n : code,\n map: mapContents && Buffer.from(mapContents).toString('utf-8'),\n };\n },\n };\n}\n"],"mappings":";;;;;;;;;AAmBA,eAAsB,0BACpB,SAOC;CACD,MAAM,EAAE,kBAAkB,MAAO,SAC/B,yBACF,CAAC,CAAC;CACF,MAAM,EAAE,aAAa,aAAa;CAClC,IAAI;CACJ,IAAI;CACJ,MAAM,gBAAgB,SAAS,iBAAiB,QAAQ,IAAI;CAE5D,OAAO;EACL,MAAM;EAEN,SAAS;EACT,OAAO,YAAiB;GACtB,SAAS;GACT,cAAc,QAAQ,eAAe,OAAO,QAAQ,GAAG;EACzD;EACA,MAAM,UAAU,QAAgB,UAAkB;GAEhD,IAAI,UAAU,SAAS,MAAM,GAG3B,OAAO;GAGT,IAAI,UAEA;QAAA,OAAO,OAAO,OACd,cAAc,QAAQ,CAAC,CAAC,WAAW,WAAW,GAC9C;KAEA,MAAM,CAAC,gBAAgB,SAAS,MAAM,KAAK,CAAC;KAC5C,SACE,MAAM,KAAK,QAAQ,SAAS,aAAa,YAAY,CAAC,GAAG,MAAM;IACnE;;GAGF,MAAM,CAAC,QAAQ,OAAO,MAAM,KAAK,CAAC;GAClC,MAAM,aAAa,KAAK,MAAM,GAAG;GAEjC,IAAI,YAAY,IAAI,WAAW,WAAW,SAAS,EAAE,GACnD,OAAO,WAAW,WAAW,SAAS;GAGxC,IAAI,YAAY,IAAI,IAAI,GACtB,OAAO,KAAK,aAAa,MAAM;EAGnC;EACA,KAAK,IAAY;GACf,MAAM,CAAC,QAAQ,GAAG,MAAM,KAAK,CAAC;GAC9B,MAAM,eACJ,UACA,cAAc,SAAS,aAAa,IAAI,CAAC,CAAC,CACvC,QAAQ,OAAO,KAAK,CAAC,CACrB,QAAQ,UAAU,GAAG,CAAC,CACtB,QAAQ,OAAO,GAAG;GAEvB,MAAM,eACJ,YAAY,IAAI,YAAY,CAAC,EAAE,YAC/B,YAAY,IAAI,EAAE,CAAC,EAAE;GACvB,IAAI,iBAAiB,KAAA,GACnB;GAGF,MAAM,OAAO,OAAO,KAAK,YAAY,CAAC,CAAC,SAAS,OAAO;GACvD,MAAM,cAAc,YAAY,IAAI,eAAe,MAAM,CAAC,EAAE;GAE5D,OAAO;IAGL,MAAM,cACF,KAAK,QAAQ,sCAAsC,EAAE,IACrD;IACJ,KAAK,eAAe,OAAO,KAAK,WAAW,CAAC,CAAC,SAAS,OAAO;GAC/D;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downlevel-plugin.js","names":[],"sources":["../../../../../../src/lib/builders/build/plugins/downlevel-plugin.ts"],"sourcesContent":["import { type SourceMap, transformSync } from 'oxc-transform';\n\nexport function downlevelPlugin(): {\n name: string;\n transform(\n _code: string,\n id: string,\n ): { code: string; map: SourceMap | undefined } | undefined;\n} {\n return {\n name: 'analogjs-vitest-oxc-downlevel-plugin',\n transform(\n _code: string,\n id: string,\n ): { code: string; map: SourceMap | undefined } | undefined {\n if (_code.includes('async (')) {\n const { code, map } = transformSync(id, _code, {\n lang: 'js',\n target: 'es2016',\n sourcemap: true,\n });\n\n return {\n code,\n map,\n };\n }\n\n return undefined;\n },\n };\n}\n"],"mappings":";;AAEA,SAAgB,kBAMd;
|
|
1
|
+
{"version":3,"file":"downlevel-plugin.js","names":[],"sources":["../../../../../../src/lib/builders/build/plugins/downlevel-plugin.ts"],"sourcesContent":["import { type SourceMap, transformSync } from 'oxc-transform';\n\nexport function downlevelPlugin(): {\n name: string;\n transform(\n _code: string,\n id: string,\n ): { code: string; map: SourceMap | undefined } | undefined;\n} {\n return {\n name: 'analogjs-vitest-oxc-downlevel-plugin',\n transform(\n _code: string,\n id: string,\n ): { code: string; map: SourceMap | undefined } | undefined {\n if (_code.includes('async (')) {\n const { code, map } = transformSync(id, _code, {\n lang: 'js',\n target: 'es2016',\n sourcemap: true,\n });\n\n return {\n code,\n map,\n };\n }\n\n return undefined;\n },\n };\n}\n"],"mappings":";;AAEA,SAAgB,kBAMd;CACA,OAAO;EACL,MAAM;EACN,UACE,OACA,IAC0D;GAC1D,IAAI,MAAM,SAAS,SAAS,GAAG;IAC7B,MAAM,EAAE,MAAM,QAAQ,cAAc,IAAI,OAAO;KAC7C,MAAM;KACN,QAAQ;KACR,WAAW;IACb,CAAC;IAED,OAAO;KACL;KACA;IACF;GACF;EAGF;CACF;AACF"}
|
|
@@ -1,53 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
"tsConfig": {
|
|
38
|
-
"type": "string",
|
|
39
|
-
"description": "The relative path to the TypeScript configuration file for running tests.",
|
|
40
|
-
"default": "tsconfig.spec.json"
|
|
41
|
-
},
|
|
42
|
-
"watch": {
|
|
43
|
-
"type": "boolean",
|
|
44
|
-
"default": false,
|
|
45
|
-
"description": "Run the tests in watch mode"
|
|
46
|
-
}
|
|
1
|
+
//#region packages/vitest-angular/src/lib/builders/build/schema.json
|
|
2
|
+
var $schema = "http://json-schema.org/draft-07/schema";
|
|
3
|
+
var title = "Vitest schema for Test Facade.";
|
|
4
|
+
var description = "Vitest target options";
|
|
5
|
+
var type = "object";
|
|
6
|
+
var properties = {
|
|
7
|
+
"configFile": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The path to the local vitest config",
|
|
10
|
+
"x-completion-type": "file",
|
|
11
|
+
"x-completion-glob": "@vitest.config@(.js|.ts|.mts)",
|
|
12
|
+
"aliases": ["config"]
|
|
13
|
+
},
|
|
14
|
+
"include": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": { "type": "string" },
|
|
17
|
+
"default": ["src/**/*.spec.ts"],
|
|
18
|
+
"description": "Globs of files to include, relative to project root."
|
|
19
|
+
},
|
|
20
|
+
"exclude": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": { "type": "string" },
|
|
23
|
+
"default": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist",
|
|
26
|
+
".idea",
|
|
27
|
+
".git",
|
|
28
|
+
".cache"
|
|
29
|
+
],
|
|
30
|
+
"description": "Globs of files to exclude, relative to the project root."
|
|
31
|
+
},
|
|
32
|
+
"setupFile": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "The path to the setup file.",
|
|
35
|
+
"default": "src/test-setup.ts"
|
|
47
36
|
},
|
|
37
|
+
"tsConfig": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "The relative path to the TypeScript configuration file for running tests.",
|
|
40
|
+
"default": "tsconfig.spec.json"
|
|
41
|
+
},
|
|
42
|
+
"watch": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"default": false,
|
|
45
|
+
"description": "Run the tests in watch mode"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var schema_default = {
|
|
49
|
+
$schema,
|
|
50
|
+
title,
|
|
51
|
+
description,
|
|
52
|
+
type,
|
|
53
|
+
properties,
|
|
48
54
|
additionalProperties: true
|
|
49
55
|
};
|
|
50
56
|
//#endregion
|
|
51
|
-
export { schema_default as default };
|
|
57
|
+
export { $schema, schema_default as default, description, properties, title, type };
|
|
52
58
|
|
|
53
59
|
//# sourceMappingURL=schema.js.map
|
|
@@ -7,13 +7,6 @@ import * as path from "path";
|
|
|
7
7
|
import { globSync } from "tinyglobby";
|
|
8
8
|
//#region packages/vitest-angular/src/lib/builders/build/vitest.impl.ts
|
|
9
9
|
var _require = createRequire(import.meta.url);
|
|
10
|
-
var ResultKind = /* @__PURE__ */ function(ResultKind) {
|
|
11
|
-
ResultKind[ResultKind["Failure"] = 0] = "Failure";
|
|
12
|
-
ResultKind[ResultKind["Full"] = 1] = "Full";
|
|
13
|
-
ResultKind[ResultKind["Incremental"] = 2] = "Incremental";
|
|
14
|
-
ResultKind[ResultKind["ComponentUpdate"] = 3] = "ComponentUpdate";
|
|
15
|
-
return ResultKind;
|
|
16
|
-
}({});
|
|
17
10
|
process.env["VITE_CJS_IGNORE_WARNING"] = "true";
|
|
18
11
|
async function* vitestApplicationBuilder(options, context) {
|
|
19
12
|
process.env["TEST"] = "true";
|
|
@@ -73,15 +66,17 @@ async function* vitestApplicationBuilder(options, context) {
|
|
|
73
66
|
vendor: false
|
|
74
67
|
}
|
|
75
68
|
}, context)) {
|
|
76
|
-
if (buildOutput.kind ===
|
|
77
|
-
else if (buildOutput.kind ===
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
if (buildOutput.kind === 0) return { success: false };
|
|
70
|
+
else if (buildOutput.kind === 2 || buildOutput.kind === 1) {
|
|
71
|
+
if (buildOutput.kind === 1) {
|
|
72
|
+
outputFiles.clear();
|
|
73
|
+
Object.keys(buildOutput.files).forEach((key) => {
|
|
74
|
+
outputFiles.set(key, buildOutput.files[key]);
|
|
75
|
+
});
|
|
76
|
+
} else Object.keys(buildOutput.files).forEach((key) => {
|
|
80
77
|
outputFiles.set(key, buildOutput.files[key]);
|
|
81
78
|
});
|
|
82
|
-
}
|
|
83
|
-
outputFiles.set(key, buildOutput.files[key]);
|
|
84
|
-
});
|
|
79
|
+
}
|
|
85
80
|
if (options.watch) {
|
|
86
81
|
if (!server) server = await startVitest("test", [], config, viteConfig);
|
|
87
82
|
else await server.start([]);
|
|
@@ -94,7 +89,7 @@ async function* vitestApplicationBuilder(options, context) {
|
|
|
94
89
|
yield { success: true };
|
|
95
90
|
}
|
|
96
91
|
async function getExtraArgs(options) {
|
|
97
|
-
const schema = await import("./schema.
|
|
92
|
+
const schema = await import("./schema.js");
|
|
98
93
|
const extraArgs = {};
|
|
99
94
|
for (const key of Object.keys(options)) if (!schema.default.properties[key]) extraArgs[key] = options[key];
|
|
100
95
|
return extraArgs;
|
|
@@ -131,7 +126,8 @@ async function getExtraArgs(options) {
|
|
|
131
126
|
function findIncludes(options) {
|
|
132
127
|
const { normalizePath } = _require("vite");
|
|
133
128
|
const projectRoot = normalizePath(path.resolve(options.workspaceRoot, options.projectRoot));
|
|
134
|
-
|
|
129
|
+
const globs = [...options.include.map((glob) => `${projectRoot}/${glob}`)];
|
|
130
|
+
return globSync(globs, {
|
|
135
131
|
dot: true,
|
|
136
132
|
absolute: true,
|
|
137
133
|
ignore: options.exclude
|
|
@@ -153,6 +149,6 @@ function generateEntryPoints({ projectRoot, testFiles, context }) {
|
|
|
153
149
|
}
|
|
154
150
|
var vitest_impl_default = createBuilder(vitestApplicationBuilder);
|
|
155
151
|
//#endregion
|
|
156
|
-
export { vitest_impl_default as default };
|
|
152
|
+
export { vitest_impl_default as default, getExtraArgs };
|
|
157
153
|
|
|
158
154
|
//# sourceMappingURL=vitest.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.impl.js","names":[],"sources":["../../../../../src/lib/builders/build/vitest.impl.ts"],"sourcesContent":["import { createBuilder } from '@angular-devkit/architect';\nimport { createRequire } from 'node:module';\nimport * as path from 'path';\nimport type { Vitest } from 'vitest/node';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { TestUserConfig as VitestConfig } from 'vitest/node';\nimport { globSync } from 'tinyglobby';\n\nimport { VitestSchema } from './schema';\nimport { createAngularMemoryPlugin } from './plugins/angular-memory-plugin';\nimport { downlevelPlugin } from './plugins/downlevel-plugin';\nimport { getBuildApplicationFunction } from './devkit';\n\nconst _require = createRequire(import.meta.url);\n\nexport enum ResultKind {\n Failure,\n Full,\n Incremental,\n ComponentUpdate,\n}\n\nprocess.env['VITE_CJS_IGNORE_WARNING'] = 'true';\n\nasync function* vitestApplicationBuilder(\n options: VitestSchema,\n context: any,\n): AsyncIterable<{ success: boolean }> {\n process.env['TEST'] = 'true';\n process.env['VITEST'] = 'true';\n\n const { buildApplicationInternal } = await getBuildApplicationFunction();\n const { startVitest } = await (Function(\n 'return import(\"vitest/node\")',\n )() as Promise<typeof import('vitest/node')>);\n\n const projectConfig = await context.getProjectMetadata(context.target);\n const extraArgs = await getExtraArgs(options);\n const workspaceRoot = context.workspaceRoot;\n const projectRoot = projectConfig['root'];\n const setupFile = path.relative(projectRoot, options.setupFile);\n\n const config: VitestConfig = {\n root: `${projectRoot || '.'}`,\n watch: options.watch === true,\n config: options.configFile,\n setupFiles: [setupFile],\n globals: true,\n pool: 'vmThreads',\n reporters: ['default'],\n environment: 'jsdom',\n exclude: options?.exclude || [],\n ...extraArgs,\n };\n\n const includes: string[] = findIncludes({\n workspaceRoot,\n projectRoot,\n include: options.include,\n exclude: options.exclude || [],\n });\n\n const testFiles = [\n path.relative(workspaceRoot, options.setupFile),\n ...includes.map((inc) => path.relative(workspaceRoot, inc)),\n ];\n\n const entryPoints = generateEntryPoints({\n projectRoot: projectRoot,\n testFiles,\n context,\n });\n\n const outputFiles = new Map();\n\n const viteConfig: any = {\n plugins: [\n (await createAngularMemoryPlugin({\n workspaceRoot,\n outputFiles,\n })) as Plugin,\n downlevelPlugin(),\n ],\n };\n\n let server: Vitest | undefined;\n for await (const buildOutput of buildApplicationInternal(\n {\n aot: false,\n index: false,\n progress: false,\n prerender: false,\n optimization: false,\n outputPath: `.angular/.vitest/${projectConfig['name']}`,\n outExtension: 'mjs',\n outputHashing: 2, // None\n tsConfig: path.relative(workspaceRoot, options.tsConfig),\n watch: options.watch === true,\n entryPoints,\n allowedCommonJsDependencies: ['@analogjs/vitest-angular/setup-zone'],\n sourceMap: {\n scripts: true,\n styles: false,\n vendor: false,\n },\n },\n context,\n )) {\n if (buildOutput.kind === ResultKind.Failure) {\n return { success: false };\n } else if (\n buildOutput.kind === ResultKind.Incremental ||\n buildOutput.kind === ResultKind.Full\n ) {\n if (buildOutput.kind === ResultKind.Full) {\n outputFiles.clear();\n Object.keys(buildOutput.files).forEach((key) => {\n outputFiles.set(key, buildOutput.files[key]);\n });\n } else {\n Object.keys(buildOutput.files).forEach((key) => {\n outputFiles.set(key, buildOutput.files[key]);\n });\n }\n }\n\n if (options.watch) {\n if (!server) {\n server = await startVitest('test', [], config, viteConfig);\n } else {\n await server.start([]);\n }\n\n yield { success: true };\n } else {\n server = await startVitest('test', [], config, viteConfig);\n\n const success = server?.state.getCountOfFailedTests() === 0;\n\n yield { success };\n }\n }\n\n yield { success: true };\n}\n\nexport async function getExtraArgs(\n options: VitestSchema,\n): Promise<Record<string, any>> {\n // support passing extra args to Vitest CLI\n const schema = await import('./schema.json', { with: { type: 'json' } });\n const extraArgs: Record<string, any> = {};\n for (const key of Object.keys(options)) {\n if (!(schema as any).default.properties[key]) {\n extraArgs[key] = (options as any)[key];\n }\n }\n\n return extraArgs;\n}\n\n/**\n * Finds test files to include in the Vitest run using tinyglobby pattern matching.\n *\n * This function:\n * 1. Normalizes the project root path to ensure consistent path separators\n * 2. Constructs glob patterns by prepending the project root to each include pattern\n * 3. Uses globSync from tinyglobby to find all files matching the patterns while respecting exclusions\n *\n * @param options Configuration object containing workspace and project paths, include/exclude patterns\n * @returns Array of absolute file paths that match the include patterns\n *\n * Sample output paths:\n * - /workspace/apps/my-app/src/app/app.component.spec.ts\n * - /workspace/apps/my-app/src/app/services/data.service.spec.ts\n * - /workspace/apps/my-app/src/app/components/header/header.component.test.ts\n * - /workspace/apps/my-app/src/app/utils/helpers.spec.ts\n *\n * tinyglobby vs fast-glob comparison:\n * - Both support the same glob patterns and ignore functionality\n * - Both are fast and efficient for file matching\n * - tinyglobby is a lighter alternative with similar API\n * - tinyglobby's globSync returns absolute paths by default when absolute: true is set\n * - tinyglobby has fewer dependencies and smaller bundle size\n *\n * globSync options explained:\n * - dot: true - Includes files/directories that start with a dot (e.g., .env.test)\n * - absolute: true - Returns absolute file paths instead of relative paths\n * - ignore: options.exclude - Excludes files matching the exclude patterns\n */\nfunction findIncludes(options: {\n workspaceRoot: string;\n projectRoot: string;\n include: string[];\n exclude: string[];\n}) {\n const { normalizePath } = _require('vite');\n\n // Normalize project root path to ensure consistent path separators across platforms\n const projectRoot = normalizePath(\n path.resolve(options.workspaceRoot, options.projectRoot),\n );\n\n // Construct glob patterns by prepending project root to each include pattern\n // Example: if include=['**/*.spec.ts'] and projectRoot='/workspace/apps/my-app'\n // Result: ['/workspace/apps/my-app/**/*.spec.ts']\n const globs = [...options.include.map((glob) => `${projectRoot}/${glob}`)];\n\n // Use globSync from tinyglobby to find all files matching the patterns\n // Returns absolute file paths that match the include patterns while respecting exclusions\n return globSync(globs, {\n dot: true, // Include files/directories starting with dot (e.g., .env.test)\n absolute: true, // Return absolute file paths\n ignore: options.exclude, // Exclude files matching these patterns\n });\n}\n\nfunction generateEntryPoints({\n projectRoot,\n testFiles,\n context,\n}: {\n projectRoot: string;\n testFiles: string[];\n context: any;\n}) {\n const seen = new Set();\n\n return new Map(\n Array.from(testFiles, (testFile) => {\n const relativePath = path\n .relative(\n testFile.startsWith(projectRoot)\n ? projectRoot\n : context.workspaceRoot,\n testFile,\n )\n .replace(/^[./]+/, '_')\n .replace(/\\//g, '-');\n\n let uniqueName = `spec-${path.basename(\n relativePath,\n path.extname(relativePath),\n )}`;\n let suffix = 2;\n while (seen.has(uniqueName)) {\n uniqueName = `${relativePath}-${suffix}`;\n ++suffix;\n }\n seen.add(uniqueName);\n\n return [uniqueName, testFile];\n }),\n );\n}\n\nexport default createBuilder(vitestApplicationBuilder) as unknown;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"vitest.impl.js","names":[],"sources":["../../../../../src/lib/builders/build/vitest.impl.ts"],"sourcesContent":["import { createBuilder } from '@angular-devkit/architect';\nimport { createRequire } from 'node:module';\nimport * as path from 'path';\nimport type { Vitest } from 'vitest/node';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { TestUserConfig as VitestConfig } from 'vitest/node';\nimport { globSync } from 'tinyglobby';\n\nimport { VitestSchema } from './schema';\nimport { createAngularMemoryPlugin } from './plugins/angular-memory-plugin';\nimport { downlevelPlugin } from './plugins/downlevel-plugin';\nimport { getBuildApplicationFunction } from './devkit';\n\nconst _require = createRequire(import.meta.url);\n\nexport enum ResultKind {\n Failure,\n Full,\n Incremental,\n ComponentUpdate,\n}\n\nprocess.env['VITE_CJS_IGNORE_WARNING'] = 'true';\n\nasync function* vitestApplicationBuilder(\n options: VitestSchema,\n context: any,\n): AsyncIterable<{ success: boolean }> {\n process.env['TEST'] = 'true';\n process.env['VITEST'] = 'true';\n\n const { buildApplicationInternal } = await getBuildApplicationFunction();\n const { startVitest } = await (Function(\n 'return import(\"vitest/node\")',\n )() as Promise<typeof import('vitest/node')>);\n\n const projectConfig = await context.getProjectMetadata(context.target);\n const extraArgs = await getExtraArgs(options);\n const workspaceRoot = context.workspaceRoot;\n const projectRoot = projectConfig['root'];\n const setupFile = path.relative(projectRoot, options.setupFile);\n\n const config: VitestConfig = {\n root: `${projectRoot || '.'}`,\n watch: options.watch === true,\n config: options.configFile,\n setupFiles: [setupFile],\n globals: true,\n pool: 'vmThreads',\n reporters: ['default'],\n environment: 'jsdom',\n exclude: options?.exclude || [],\n ...extraArgs,\n };\n\n const includes: string[] = findIncludes({\n workspaceRoot,\n projectRoot,\n include: options.include,\n exclude: options.exclude || [],\n });\n\n const testFiles = [\n path.relative(workspaceRoot, options.setupFile),\n ...includes.map((inc) => path.relative(workspaceRoot, inc)),\n ];\n\n const entryPoints = generateEntryPoints({\n projectRoot: projectRoot,\n testFiles,\n context,\n });\n\n const outputFiles = new Map();\n\n const viteConfig: any = {\n plugins: [\n (await createAngularMemoryPlugin({\n workspaceRoot,\n outputFiles,\n })) as Plugin,\n downlevelPlugin(),\n ],\n };\n\n let server: Vitest | undefined;\n for await (const buildOutput of buildApplicationInternal(\n {\n aot: false,\n index: false,\n progress: false,\n prerender: false,\n optimization: false,\n outputPath: `.angular/.vitest/${projectConfig['name']}`,\n outExtension: 'mjs',\n outputHashing: 2, // None\n tsConfig: path.relative(workspaceRoot, options.tsConfig),\n watch: options.watch === true,\n entryPoints,\n allowedCommonJsDependencies: ['@analogjs/vitest-angular/setup-zone'],\n sourceMap: {\n scripts: true,\n styles: false,\n vendor: false,\n },\n },\n context,\n )) {\n if (buildOutput.kind === ResultKind.Failure) {\n return { success: false };\n } else if (\n buildOutput.kind === ResultKind.Incremental ||\n buildOutput.kind === ResultKind.Full\n ) {\n if (buildOutput.kind === ResultKind.Full) {\n outputFiles.clear();\n Object.keys(buildOutput.files).forEach((key) => {\n outputFiles.set(key, buildOutput.files[key]);\n });\n } else {\n Object.keys(buildOutput.files).forEach((key) => {\n outputFiles.set(key, buildOutput.files[key]);\n });\n }\n }\n\n if (options.watch) {\n if (!server) {\n server = await startVitest('test', [], config, viteConfig);\n } else {\n await server.start([]);\n }\n\n yield { success: true };\n } else {\n server = await startVitest('test', [], config, viteConfig);\n\n const success = server?.state.getCountOfFailedTests() === 0;\n\n yield { success };\n }\n }\n\n yield { success: true };\n}\n\nexport async function getExtraArgs(\n options: VitestSchema,\n): Promise<Record<string, any>> {\n // support passing extra args to Vitest CLI\n const schema = await import('./schema.json', { with: { type: 'json' } });\n const extraArgs: Record<string, any> = {};\n for (const key of Object.keys(options)) {\n if (!(schema as any).default.properties[key]) {\n extraArgs[key] = (options as any)[key];\n }\n }\n\n return extraArgs;\n}\n\n/**\n * Finds test files to include in the Vitest run using tinyglobby pattern matching.\n *\n * This function:\n * 1. Normalizes the project root path to ensure consistent path separators\n * 2. Constructs glob patterns by prepending the project root to each include pattern\n * 3. Uses globSync from tinyglobby to find all files matching the patterns while respecting exclusions\n *\n * @param options Configuration object containing workspace and project paths, include/exclude patterns\n * @returns Array of absolute file paths that match the include patterns\n *\n * Sample output paths:\n * - /workspace/apps/my-app/src/app/app.component.spec.ts\n * - /workspace/apps/my-app/src/app/services/data.service.spec.ts\n * - /workspace/apps/my-app/src/app/components/header/header.component.test.ts\n * - /workspace/apps/my-app/src/app/utils/helpers.spec.ts\n *\n * tinyglobby vs fast-glob comparison:\n * - Both support the same glob patterns and ignore functionality\n * - Both are fast and efficient for file matching\n * - tinyglobby is a lighter alternative with similar API\n * - tinyglobby's globSync returns absolute paths by default when absolute: true is set\n * - tinyglobby has fewer dependencies and smaller bundle size\n *\n * globSync options explained:\n * - dot: true - Includes files/directories that start with a dot (e.g., .env.test)\n * - absolute: true - Returns absolute file paths instead of relative paths\n * - ignore: options.exclude - Excludes files matching the exclude patterns\n */\nfunction findIncludes(options: {\n workspaceRoot: string;\n projectRoot: string;\n include: string[];\n exclude: string[];\n}) {\n const { normalizePath } = _require('vite');\n\n // Normalize project root path to ensure consistent path separators across platforms\n const projectRoot = normalizePath(\n path.resolve(options.workspaceRoot, options.projectRoot),\n );\n\n // Construct glob patterns by prepending project root to each include pattern\n // Example: if include=['**/*.spec.ts'] and projectRoot='/workspace/apps/my-app'\n // Result: ['/workspace/apps/my-app/**/*.spec.ts']\n const globs = [...options.include.map((glob) => `${projectRoot}/${glob}`)];\n\n // Use globSync from tinyglobby to find all files matching the patterns\n // Returns absolute file paths that match the include patterns while respecting exclusions\n return globSync(globs, {\n dot: true, // Include files/directories starting with dot (e.g., .env.test)\n absolute: true, // Return absolute file paths\n ignore: options.exclude, // Exclude files matching these patterns\n });\n}\n\nfunction generateEntryPoints({\n projectRoot,\n testFiles,\n context,\n}: {\n projectRoot: string;\n testFiles: string[];\n context: any;\n}) {\n const seen = new Set();\n\n return new Map(\n Array.from(testFiles, (testFile) => {\n const relativePath = path\n .relative(\n testFile.startsWith(projectRoot)\n ? projectRoot\n : context.workspaceRoot,\n testFile,\n )\n .replace(/^[./]+/, '_')\n .replace(/\\//g, '-');\n\n let uniqueName = `spec-${path.basename(\n relativePath,\n path.extname(relativePath),\n )}`;\n let suffix = 2;\n while (seen.has(uniqueName)) {\n uniqueName = `${relativePath}-${suffix}`;\n ++suffix;\n }\n seen.add(uniqueName);\n\n return [uniqueName, testFile];\n }),\n );\n}\n\nexport default createBuilder(vitestApplicationBuilder) as unknown;\n"],"mappings":"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"}
|
|
@@ -1,51 +1,56 @@
|
|
|
1
|
+
var title = "Vitest Builder for Angular";
|
|
2
|
+
var description = "Run unit tests using Vitest.";
|
|
3
|
+
var type = "object";
|
|
4
|
+
var properties = {
|
|
5
|
+
"configFile": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"description": "The path to the local vitest config",
|
|
8
|
+
"x-completion-type": "file",
|
|
9
|
+
"x-completion-glob": "@(vitest|vite).config@(.js|.ts)",
|
|
10
|
+
"aliases": ["config"]
|
|
11
|
+
},
|
|
12
|
+
"reportsDirectory": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Directory to write coverage report to."
|
|
15
|
+
},
|
|
16
|
+
"mode": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Mode for Vite."
|
|
19
|
+
},
|
|
20
|
+
"testFiles": {
|
|
21
|
+
"aliases": ["testFile"],
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": { "type": "string" }
|
|
24
|
+
},
|
|
25
|
+
"watch": {
|
|
26
|
+
"description": "Watch files for changes and rerun tests related to changed files.",
|
|
27
|
+
"type": "boolean"
|
|
28
|
+
},
|
|
29
|
+
"ui": {
|
|
30
|
+
"description": "Run tests using Vitest UI Mode.",
|
|
31
|
+
"type": "boolean"
|
|
32
|
+
},
|
|
33
|
+
"coverage": {
|
|
34
|
+
"description": "Enable code coverage analysis.",
|
|
35
|
+
"type": "boolean"
|
|
36
|
+
},
|
|
37
|
+
"update": {
|
|
38
|
+
"description": "Update snapshot.",
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"aliases": ["u"]
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var required = [];
|
|
1
44
|
var schema_default = {
|
|
2
45
|
version: 2,
|
|
3
46
|
cli: "nx",
|
|
4
|
-
title
|
|
5
|
-
description
|
|
6
|
-
type
|
|
7
|
-
properties
|
|
8
|
-
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "The path to the local vitest config",
|
|
11
|
-
"x-completion-type": "file",
|
|
12
|
-
"x-completion-glob": "@(vitest|vite).config@(.js|.ts)",
|
|
13
|
-
"aliases": ["config"]
|
|
14
|
-
},
|
|
15
|
-
"reportsDirectory": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"description": "Directory to write coverage report to."
|
|
18
|
-
},
|
|
19
|
-
"mode": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "Mode for Vite."
|
|
22
|
-
},
|
|
23
|
-
"testFiles": {
|
|
24
|
-
"aliases": ["testFile"],
|
|
25
|
-
"type": "array",
|
|
26
|
-
"items": { "type": "string" }
|
|
27
|
-
},
|
|
28
|
-
"watch": {
|
|
29
|
-
"description": "Watch files for changes and rerun tests related to changed files.",
|
|
30
|
-
"type": "boolean"
|
|
31
|
-
},
|
|
32
|
-
"ui": {
|
|
33
|
-
"description": "Run tests using Vitest UI Mode.",
|
|
34
|
-
"type": "boolean"
|
|
35
|
-
},
|
|
36
|
-
"coverage": {
|
|
37
|
-
"description": "Enable code coverage analysis.",
|
|
38
|
-
"type": "boolean"
|
|
39
|
-
},
|
|
40
|
-
"update": {
|
|
41
|
-
"description": "Update snapshot.",
|
|
42
|
-
"type": "boolean",
|
|
43
|
-
"aliases": ["u"]
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
required: []
|
|
47
|
+
title,
|
|
48
|
+
description,
|
|
49
|
+
type,
|
|
50
|
+
properties,
|
|
51
|
+
required
|
|
47
52
|
};
|
|
48
53
|
//#endregion
|
|
49
|
-
export { schema_default as default };
|
|
54
|
+
export { schema_default as default, description, properties, required, title, type };
|
|
50
55
|
|
|
51
56
|
//# sourceMappingURL=schema.js.map
|
|
@@ -39,13 +39,13 @@ async function vitestBuilder(options, context) {
|
|
|
39
39
|
return { success: !hasErrors };
|
|
40
40
|
}
|
|
41
41
|
async function getExtraArgs(options) {
|
|
42
|
-
const schema = await import("./schema.
|
|
42
|
+
const schema = await import("./schema.js");
|
|
43
43
|
const extraArgs = {};
|
|
44
44
|
for (const key of Object.keys(options)) if (!schema.default.properties[key]) extraArgs[key] = options[key];
|
|
45
45
|
return extraArgs;
|
|
46
46
|
}
|
|
47
47
|
var vitest_impl_default = createBuilder(vitestBuilder);
|
|
48
48
|
//#endregion
|
|
49
|
-
export { vitest_impl_default as default };
|
|
49
|
+
export { vitest_impl_default as default, getExtraArgs };
|
|
50
50
|
|
|
51
51
|
//# sourceMappingURL=vitest.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.impl.js","names":[],"sources":["../../../../../src/lib/builders/test/vitest.impl.ts"],"sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder,\n} from '@angular-devkit/architect';\n\nimport { VitestSchema } from './schema';\n\nasync function vitestBuilder(\n options: VitestSchema,\n context: BuilderContext,\n): Promise<BuilderOutput> {\n process.env['TEST'] = 'true';\n process.env['VITEST'] = 'true';\n\n const { startVitest } = await (Function(\n 'return import(\"vitest/node\")',\n )() as Promise<typeof import('vitest/node')>);\n\n const projectConfig = await context.getProjectMetadata(\n context.target as unknown as string,\n );\n const { coverageArgs, ...extraArgs } = await getExtraArgs(options);\n const watch = options.watch === true;\n const ui = options.ui === true;\n const coverageEnabled = options.coverage === true;\n const update = options.update === true;\n const config = {\n root: `${projectConfig['root'] || '.'}`,\n watch,\n ui,\n config: options.configFile,\n coverage: {\n enabled: coverageEnabled,\n ...coverageArgs,\n },\n update,\n ...extraArgs,\n };\n const viteOverrides: any = {\n test: { watch },\n };\n\n const server = await startVitest(\n 'test',\n options.testFiles ?? [],\n config,\n viteOverrides,\n );\n\n let hasErrors = false;\n\n const processExit = () => {\n server?.exit();\n if (hasErrors) {\n process.exit(1);\n } else {\n process.exit(0);\n }\n };\n\n // .once() prevents listener stacking across repeated Nx executor runs\n // that share the same host process (avoids MaxListenersExceededWarning).\n if (options.watch) {\n process.once('SIGINT', processExit);\n process.once('SIGTERM', processExit);\n process.once('exit', processExit);\n }\n\n // vitest sets the exitCode = 1 when code coverage isn't met\n hasErrors = (process.exitCode && process.exitCode !== 0) as boolean;\n\n return {\n success: !hasErrors,\n };\n}\n\nexport async function getExtraArgs(\n options: VitestSchema,\n): Promise<Record<string, any>> {\n // support passing extra args to Vitest CLI\n const schema = await import('./schema.json', { with: { type: 'json' } });\n const extraArgs: Record<string, any> = {};\n for (const key of Object.keys(options)) {\n if (!(schema as any).default.properties[key]) {\n extraArgs[key] = (options as any)[key];\n }\n }\n\n return extraArgs;\n}\n\nexport default createBuilder(vitestBuilder) as any;\n"],"mappings":";;AAQA,eAAe,cACb,SACA,SACwB;
|
|
1
|
+
{"version":3,"file":"vitest.impl.js","names":[],"sources":["../../../../../src/lib/builders/test/vitest.impl.ts"],"sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder,\n} from '@angular-devkit/architect';\n\nimport { VitestSchema } from './schema';\n\nasync function vitestBuilder(\n options: VitestSchema,\n context: BuilderContext,\n): Promise<BuilderOutput> {\n process.env['TEST'] = 'true';\n process.env['VITEST'] = 'true';\n\n const { startVitest } = await (Function(\n 'return import(\"vitest/node\")',\n )() as Promise<typeof import('vitest/node')>);\n\n const projectConfig = await context.getProjectMetadata(\n context.target as unknown as string,\n );\n const { coverageArgs, ...extraArgs } = await getExtraArgs(options);\n const watch = options.watch === true;\n const ui = options.ui === true;\n const coverageEnabled = options.coverage === true;\n const update = options.update === true;\n const config = {\n root: `${projectConfig['root'] || '.'}`,\n watch,\n ui,\n config: options.configFile,\n coverage: {\n enabled: coverageEnabled,\n ...coverageArgs,\n },\n update,\n ...extraArgs,\n };\n const viteOverrides: any = {\n test: { watch },\n };\n\n const server = await startVitest(\n 'test',\n options.testFiles ?? [],\n config,\n viteOverrides,\n );\n\n let hasErrors = false;\n\n const processExit = () => {\n server?.exit();\n if (hasErrors) {\n process.exit(1);\n } else {\n process.exit(0);\n }\n };\n\n // .once() prevents listener stacking across repeated Nx executor runs\n // that share the same host process (avoids MaxListenersExceededWarning).\n if (options.watch) {\n process.once('SIGINT', processExit);\n process.once('SIGTERM', processExit);\n process.once('exit', processExit);\n }\n\n // vitest sets the exitCode = 1 when code coverage isn't met\n hasErrors = (process.exitCode && process.exitCode !== 0) as boolean;\n\n return {\n success: !hasErrors,\n };\n}\n\nexport async function getExtraArgs(\n options: VitestSchema,\n): Promise<Record<string, any>> {\n // support passing extra args to Vitest CLI\n const schema = await import('./schema.json', { with: { type: 'json' } });\n const extraArgs: Record<string, any> = {};\n for (const key of Object.keys(options)) {\n if (!(schema as any).default.properties[key]) {\n extraArgs[key] = (options as any)[key];\n }\n }\n\n return extraArgs;\n}\n\nexport default createBuilder(vitestBuilder) as any;\n"],"mappings":";;AAQA,eAAe,cACb,SACA,SACwB;CACxB,QAAQ,IAAI,UAAU;CACtB,QAAQ,IAAI,YAAY;CAExB,MAAM,EAAE,gBAAgB,MAAO,SAC7B,gCACF,CAAC,CAAC;CAEF,MAAM,gBAAgB,MAAM,QAAQ,mBAClC,QAAQ,MACV;CACA,MAAM,EAAE,cAAc,GAAG,cAAc,MAAM,aAAa,OAAO;CACjE,MAAM,QAAQ,QAAQ,UAAU;CAChC,MAAM,KAAK,QAAQ,OAAO;CAC1B,MAAM,kBAAkB,QAAQ,aAAa;CAC7C,MAAM,SAAS,QAAQ,WAAW;CAClC,MAAM,SAAS;EACb,MAAM,GAAG,cAAc,WAAW;EAClC;EACA;EACA,QAAQ,QAAQ;EAChB,UAAU;GACR,SAAS;GACT,GAAG;EACL;EACA;EACA,GAAG;CACL;CACA,MAAM,gBAAqB,EACzB,MAAM,EAAE,MAAM,EAChB;CAEA,MAAM,SAAS,MAAM,YACnB,QACA,QAAQ,aAAa,CAAC,GACtB,QACA,aACF;CAEA,IAAI,YAAY;CAEhB,MAAM,oBAAoB;EACxB,QAAQ,KAAK;EACb,IAAI,WACF,QAAQ,KAAK,CAAC;OAEd,QAAQ,KAAK,CAAC;CAElB;CAIA,IAAI,QAAQ,OAAO;EACjB,QAAQ,KAAK,UAAU,WAAW;EAClC,QAAQ,KAAK,WAAW,WAAW;EACnC,QAAQ,KAAK,QAAQ,WAAW;CAClC;CAGA,YAAa,QAAQ,YAAY,QAAQ,aAAa;CAEtD,OAAO,EACL,SAAS,CAAC,UACZ;AACF;AAEA,eAAsB,aACpB,SAC8B;CAE9B,MAAM,SAAS,MAAM,OAAO;CAC5B,MAAM,YAAiC,CAAC;CACxC,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,IAAI,CAAE,OAAe,QAAQ,WAAW,MACtC,UAAU,OAAQ,QAAgB;CAItC,OAAO;AACT;AAEA,IAAA,sBAAe,cAAc,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-fixture.js","names":[],"sources":["../../../../src/lib/snapshot-serializers/angular-fixture.ts"],"sourcesContent":["import type { ComponentFixture } from '@angular/core/testing';\nimport type { SnapshotSerializer } from 'vitest';\n\n/**\n * Check if is an Angular fixture\n *\n * @param val Angular fixture\n * @returns boolean who check if is an angular fixture\n */\nfunction isAngularFixture(val: any): boolean {\n if (typeof val !== 'object') {\n return false;\n }\n\n if (val['componentRef'] || val['componentInstance']) {\n return true;\n }\n\n if (val['componentType']) {\n return true;\n }\n\n // * Angular fixture keys in Fixture component Object\n const fixtureKeys = [\n 'componentRef',\n 'ngZone',\n 'effectRunner',\n '_autoDetect',\n '_isStable',\n '_isDestroyed',\n '_resolve',\n '_promise',\n '_onUnstableSubscription',\n '_onStableSubscription',\n '_onMicrotaskEmptySubscription',\n '_onErrorSubscription',\n 'changeDetectorRef',\n 'elementRef',\n 'debugElement',\n 'componentInstance',\n 'nativeElement',\n ];\n\n // * Angular fixture keys in Fixture componentRef Object\n const fixtureComponentRefKeys = [\n 'location',\n '_rootLView',\n '_tNode',\n 'previousInputValues',\n 'instance',\n 'changeDetectorRef',\n 'hostView',\n 'componentType',\n ];\n\n return (\n JSON.stringify(Object.keys(val)) === JSON.stringify(fixtureKeys) ||\n JSON.stringify(Object.keys(val)) === JSON.stringify(fixtureComponentRefKeys)\n );\n}\n\n/**\n * Serialize Angular fixture for Vitest\n *\n * @param fixture Angular Fixture Component\n * @returns HTML Child Node\n */\nfunction fixtureVitestSerializer(fixture: any) {\n // * Get Component meta data\n const componentType = (\n fixture && fixture.componentType\n ? fixture.componentType\n : fixture.componentRef.componentType\n ) as any;\n\n let inputsData = '';\n\n const selector =\n Reflect.getOwnPropertyDescriptor(componentType, '__annotations__')?.value[0]\n ?.selector ?? componentType.ɵcmp?.selectors[0]?.[0];\n\n if (componentType && componentType.propDecorators) {\n inputsData = Object.entries(componentType.propDecorators)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join('');\n }\n\n // * Get DOM Elements\n const divElement =\n fixture && fixture.nativeElement\n ? fixture.nativeElement\n : fixture.location.nativeElement;\n\n // * Convert string data to HTML data\n const doc = new DOMParser().parseFromString(\n `<${selector} ${inputsData}>${divElement.innerHTML}</${selector}>`,\n 'text/html',\n );\n\n return doc.body.childNodes[0];\n}\n\nfunction normalizeSnapshotOutput(value: string): string {\n return (\n value\n // Inline snapshots should not fail after formatters strip trailing spaces.\n .replace(/[ \\t]+$/gm, '')\n // Comment removal can leave repeated empty lines in pretty-printed output.\n .replace(/\\n{3,}/g, '\\n\\n')\n );\n}\n\nexport function createAngularFixtureSnapshotSerializer(): SnapshotSerializer {\n return {\n serialize(val, config, indentation, depth, refs, printer) {\n return normalizeSnapshotOutput(\n printer(fixtureVitestSerializer(val), config, indentation, depth, refs),\n );\n },\n test(val) {\n return val && isAngularFixture(val);\n },\n };\n}\n"],"mappings":";;;;;;;AASA,SAAS,iBAAiB,KAAmB;
|
|
1
|
+
{"version":3,"file":"angular-fixture.js","names":[],"sources":["../../../../src/lib/snapshot-serializers/angular-fixture.ts"],"sourcesContent":["import type { ComponentFixture } from '@angular/core/testing';\nimport type { SnapshotSerializer } from 'vitest';\n\n/**\n * Check if is an Angular fixture\n *\n * @param val Angular fixture\n * @returns boolean who check if is an angular fixture\n */\nfunction isAngularFixture(val: any): boolean {\n if (typeof val !== 'object') {\n return false;\n }\n\n if (val['componentRef'] || val['componentInstance']) {\n return true;\n }\n\n if (val['componentType']) {\n return true;\n }\n\n // * Angular fixture keys in Fixture component Object\n const fixtureKeys = [\n 'componentRef',\n 'ngZone',\n 'effectRunner',\n '_autoDetect',\n '_isStable',\n '_isDestroyed',\n '_resolve',\n '_promise',\n '_onUnstableSubscription',\n '_onStableSubscription',\n '_onMicrotaskEmptySubscription',\n '_onErrorSubscription',\n 'changeDetectorRef',\n 'elementRef',\n 'debugElement',\n 'componentInstance',\n 'nativeElement',\n ];\n\n // * Angular fixture keys in Fixture componentRef Object\n const fixtureComponentRefKeys = [\n 'location',\n '_rootLView',\n '_tNode',\n 'previousInputValues',\n 'instance',\n 'changeDetectorRef',\n 'hostView',\n 'componentType',\n ];\n\n return (\n JSON.stringify(Object.keys(val)) === JSON.stringify(fixtureKeys) ||\n JSON.stringify(Object.keys(val)) === JSON.stringify(fixtureComponentRefKeys)\n );\n}\n\n/**\n * Serialize Angular fixture for Vitest\n *\n * @param fixture Angular Fixture Component\n * @returns HTML Child Node\n */\nfunction fixtureVitestSerializer(fixture: any) {\n // * Get Component meta data\n const componentType = (\n fixture && fixture.componentType\n ? fixture.componentType\n : fixture.componentRef.componentType\n ) as any;\n\n let inputsData = '';\n\n const selector =\n Reflect.getOwnPropertyDescriptor(componentType, '__annotations__')?.value[0]\n ?.selector ?? componentType.ɵcmp?.selectors[0]?.[0];\n\n if (componentType && componentType.propDecorators) {\n inputsData = Object.entries(componentType.propDecorators)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join('');\n }\n\n // * Get DOM Elements\n const divElement =\n fixture && fixture.nativeElement\n ? fixture.nativeElement\n : fixture.location.nativeElement;\n\n // * Convert string data to HTML data\n const doc = new DOMParser().parseFromString(\n `<${selector} ${inputsData}>${divElement.innerHTML}</${selector}>`,\n 'text/html',\n );\n\n return doc.body.childNodes[0];\n}\n\nfunction normalizeSnapshotOutput(value: string): string {\n return (\n value\n // Inline snapshots should not fail after formatters strip trailing spaces.\n .replace(/[ \\t]+$/gm, '')\n // Comment removal can leave repeated empty lines in pretty-printed output.\n .replace(/\\n{3,}/g, '\\n\\n')\n );\n}\n\nexport function createAngularFixtureSnapshotSerializer(): SnapshotSerializer {\n return {\n serialize(val, config, indentation, depth, refs, printer) {\n return normalizeSnapshotOutput(\n printer(fixtureVitestSerializer(val), config, indentation, depth, refs),\n );\n },\n test(val) {\n return val && isAngularFixture(val);\n },\n };\n}\n"],"mappings":";;;;;;;AASA,SAAS,iBAAiB,KAAmB;CAC3C,IAAI,OAAO,QAAQ,UACjB,OAAO;CAGT,IAAI,IAAI,mBAAmB,IAAI,sBAC7B,OAAO;CAGT,IAAI,IAAI,kBACN,OAAO;CAoCT,OACE,KAAK,UAAU,OAAO,KAAK,GAAG,CAAC,MAAM,KAAK,UAAU;EAhCpD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAgBoD,CAAW,KAC/D,KAAK,UAAU,OAAO,KAAK,GAAG,CAAC,MAAM,KAAK,UAAU;EAZpD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAKoD,CAAuB;AAE/E;;;;;;;AAQA,SAAS,wBAAwB,SAAc;CAE7C,MAAM,gBACJ,WAAW,QAAQ,gBACf,QAAQ,gBACR,QAAQ,aAAa;CAG3B,IAAI,aAAa;CAEjB,MAAM,WACJ,QAAQ,yBAAyB,eAAe,iBAAiB,CAAC,EAAE,MAAM,EAAE,EACxE,YAAY,cAAc,MAAM,UAAU,EAAE,GAAG;CAErD,IAAI,iBAAiB,cAAc,gBACjC,aAAa,OAAO,QAAQ,cAAc,cAAc,CAAC,CACtD,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,CAC1C,KAAK,EAAE;CAIZ,MAAM,aACJ,WAAW,QAAQ,gBACf,QAAQ,gBACR,QAAQ,SAAS;CAQvB,OALY,IAAI,UAAU,CAAC,CAAC,gBAC1B,IAAI,SAAS,GAAG,WAAW,GAAG,WAAW,UAAU,IAAI,SAAS,IAChE,WAGK,CAAA,CAAI,KAAK,WAAW;AAC7B;AAEA,SAAS,wBAAwB,OAAuB;CACtD,OACE,MAEG,QAAQ,aAAa,EAAE,CAAC,CAExB,QAAQ,WAAW,MAAM;AAEhC;AAEA,SAAgB,yCAA6D;CAC3E,OAAO;EACL,UAAU,KAAK,QAAQ,aAAa,OAAO,MAAM,SAAS;GACxD,OAAO,wBACL,QAAQ,wBAAwB,GAAG,GAAG,QAAQ,aAAa,OAAO,IAAI,CACxE;EACF;EACA,KAAK,KAAK;GACR,OAAO,OAAO,iBAAiB,GAAG;EACpC;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-comment.js","names":[],"sources":["../../../../src/lib/snapshot-serializers/html-comment.ts"],"sourcesContent":["import { type SnapshotSerializer } from 'vitest';\n\nexport function createHtmlCommentSnapshotSerializer(): SnapshotSerializer {\n return {\n serialize: () => '',\n test: (val: any): boolean =>\n typeof Comment !== 'undefined' && val instanceof Comment,\n };\n}\n"],"mappings":";AAEA,SAAgB,sCAA0D;
|
|
1
|
+
{"version":3,"file":"html-comment.js","names":[],"sources":["../../../../src/lib/snapshot-serializers/html-comment.ts"],"sourcesContent":["import { type SnapshotSerializer } from 'vitest';\n\nexport function createHtmlCommentSnapshotSerializer(): SnapshotSerializer {\n return {\n serialize: () => '',\n test: (val: any): boolean =>\n typeof Comment !== 'undefined' && val instanceof Comment,\n };\n}\n"],"mappings":";AAEA,SAAgB,sCAA0D;CACxE,OAAO;EACL,iBAAiB;EACjB,OAAO,QACL,OAAO,YAAY,eAAe,eAAe;CACrD;AACF"}
|
|
@@ -58,6 +58,6 @@ function createNoNgAttributesSnapshotSerializer() {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
|
-
export { createNoNgAttributesSnapshotSerializer };
|
|
61
|
+
export { attributesToClean, attributesToRemovePatterns, createNoNgAttributesSnapshotSerializer };
|
|
62
62
|
|
|
63
63
|
//# sourceMappingURL=no-ng-attributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-ng-attributes.js","names":[],"sources":["../../../../src/lib/snapshot-serializers/no-ng-attributes.ts"],"sourcesContent":["import { type SnapshotSerializer } from 'vitest';\n\nconst CLEANED_ELEMENT_MARKER = '__analogSnapshotCleaned__';\n\nexport const attributesToRemovePatterns = [\n 'ng-reflect',\n '_nghost',\n '_ngcontent',\n 'ng-version',\n];\n\nexport const attributesToClean: Record<string, RegExp[]> = {\n class: [/^(?:mat|cdk|ng).*-\\w*\\d+-\\d+$/, /^ng-star-inserted$/],\n id: [/^(?:mat|cdk|ng).*-\\w*\\d+$/],\n for: [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-owns': [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-labelledby': [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-controls': [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-describedby': [/^(?:mat|cdk|ng).*-\\d+$/],\n};\n\nconst hasAttributesToRemove = (attribute: Attr): boolean =>\n attributesToRemovePatterns.some((removePattern) =>\n attribute.name.startsWith(removePattern),\n );\n\nconst hasAttributesToClean = (attribute: Attr): boolean =>\n Object.prototype.hasOwnProperty.call(attributesToClean, attribute.name);\n\nconst attributeNeedsCleaning = (attribute: Attr): boolean =>\n hasAttributesToClean(attribute) &&\n attribute.value\n .split(' ')\n .some((attrValue) =>\n attributesToClean[attribute.name].some((attributeCleanRegex) =>\n attributeCleanRegex.test(attrValue),\n ),\n );\n\nconst shouldSerializeElement = (node: Element): boolean => {\n if (node.parentElement?.tagName === 'BODY' && node.hasAttribute('id')) {\n return true;\n }\n\n return Array.from(node.attributes).some(\n (attribute) =>\n hasAttributesToRemove(attribute) || attributeNeedsCleaning(attribute),\n );\n};\n\nfunction cleanAngularElementAttributes(node: Element): Element {\n const nodeCopy = node.cloneNode(true) as Element;\n\n Object.defineProperty(nodeCopy, CLEANED_ELEMENT_MARKER, {\n configurable: true,\n value: true,\n });\n\n if (node.parentElement?.tagName === 'BODY') {\n nodeCopy.removeAttribute('id');\n }\n\n Array.from(nodeCopy.attributes).forEach((attribute) => {\n if (hasAttributesToRemove(attribute)) {\n nodeCopy.removeAttribute(attribute.name);\n return;\n }\n\n if (hasAttributesToClean(attribute)) {\n const cleanedValue = attribute.value\n .split(' ')\n .filter(\n (attrValue) =>\n !attributesToClean[attribute.name].some((attributeCleanRegex) =>\n attributeCleanRegex.test(attrValue),\n ),\n )\n .join(' ');\n\n if (cleanedValue === '') {\n nodeCopy.removeAttribute(attribute.name);\n return;\n }\n\n nodeCopy.setAttribute(attribute.name, cleanedValue);\n }\n });\n\n return nodeCopy;\n}\n\nexport function createNoNgAttributesSnapshotSerializer(): SnapshotSerializer {\n return {\n serialize(val, config, indentation, depth, refs, printer): string {\n const cleanedNode = cleanAngularElementAttributes(val);\n\n if (shouldSerializeElement(cleanedNode)) {\n throw new Error(\n `NoNgAttributes serializer did not stabilize for <${cleanedNode.tagName.toLowerCase()}>`,\n );\n }\n\n return printer(cleanedNode, config, indentation, depth, refs);\n },\n test(val): boolean {\n const matches =\n typeof Element !== 'undefined' &&\n val instanceof Element &&\n !(val as Element & Record<string, unknown>)[CLEANED_ELEMENT_MARKER] &&\n shouldSerializeElement(val);\n\n return matches;\n },\n };\n}\n"],"mappings":";AAEA,IAAM,yBAAyB;AAE/B,IAAa,6BAA6B;CACxC;CACA;CACA;CACA;
|
|
1
|
+
{"version":3,"file":"no-ng-attributes.js","names":[],"sources":["../../../../src/lib/snapshot-serializers/no-ng-attributes.ts"],"sourcesContent":["import { type SnapshotSerializer } from 'vitest';\n\nconst CLEANED_ELEMENT_MARKER = '__analogSnapshotCleaned__';\n\nexport const attributesToRemovePatterns = [\n 'ng-reflect',\n '_nghost',\n '_ngcontent',\n 'ng-version',\n];\n\nexport const attributesToClean: Record<string, RegExp[]> = {\n class: [/^(?:mat|cdk|ng).*-\\w*\\d+-\\d+$/, /^ng-star-inserted$/],\n id: [/^(?:mat|cdk|ng).*-\\w*\\d+$/],\n for: [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-owns': [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-labelledby': [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-controls': [/^(?:mat|cdk|ng).*-\\d+$/],\n 'aria-describedby': [/^(?:mat|cdk|ng).*-\\d+$/],\n};\n\nconst hasAttributesToRemove = (attribute: Attr): boolean =>\n attributesToRemovePatterns.some((removePattern) =>\n attribute.name.startsWith(removePattern),\n );\n\nconst hasAttributesToClean = (attribute: Attr): boolean =>\n Object.prototype.hasOwnProperty.call(attributesToClean, attribute.name);\n\nconst attributeNeedsCleaning = (attribute: Attr): boolean =>\n hasAttributesToClean(attribute) &&\n attribute.value\n .split(' ')\n .some((attrValue) =>\n attributesToClean[attribute.name].some((attributeCleanRegex) =>\n attributeCleanRegex.test(attrValue),\n ),\n );\n\nconst shouldSerializeElement = (node: Element): boolean => {\n if (node.parentElement?.tagName === 'BODY' && node.hasAttribute('id')) {\n return true;\n }\n\n return Array.from(node.attributes).some(\n (attribute) =>\n hasAttributesToRemove(attribute) || attributeNeedsCleaning(attribute),\n );\n};\n\nfunction cleanAngularElementAttributes(node: Element): Element {\n const nodeCopy = node.cloneNode(true) as Element;\n\n Object.defineProperty(nodeCopy, CLEANED_ELEMENT_MARKER, {\n configurable: true,\n value: true,\n });\n\n if (node.parentElement?.tagName === 'BODY') {\n nodeCopy.removeAttribute('id');\n }\n\n Array.from(nodeCopy.attributes).forEach((attribute) => {\n if (hasAttributesToRemove(attribute)) {\n nodeCopy.removeAttribute(attribute.name);\n return;\n }\n\n if (hasAttributesToClean(attribute)) {\n const cleanedValue = attribute.value\n .split(' ')\n .filter(\n (attrValue) =>\n !attributesToClean[attribute.name].some((attributeCleanRegex) =>\n attributeCleanRegex.test(attrValue),\n ),\n )\n .join(' ');\n\n if (cleanedValue === '') {\n nodeCopy.removeAttribute(attribute.name);\n return;\n }\n\n nodeCopy.setAttribute(attribute.name, cleanedValue);\n }\n });\n\n return nodeCopy;\n}\n\nexport function createNoNgAttributesSnapshotSerializer(): SnapshotSerializer {\n return {\n serialize(val, config, indentation, depth, refs, printer): string {\n const cleanedNode = cleanAngularElementAttributes(val);\n\n if (shouldSerializeElement(cleanedNode)) {\n throw new Error(\n `NoNgAttributes serializer did not stabilize for <${cleanedNode.tagName.toLowerCase()}>`,\n );\n }\n\n return printer(cleanedNode, config, indentation, depth, refs);\n },\n test(val): boolean {\n const matches =\n typeof Element !== 'undefined' &&\n val instanceof Element &&\n !(val as Element & Record<string, unknown>)[CLEANED_ELEMENT_MARKER] &&\n shouldSerializeElement(val);\n\n return matches;\n },\n };\n}\n"],"mappings":";AAEA,IAAM,yBAAyB;AAE/B,IAAa,6BAA6B;CACxC;CACA;CACA;CACA;AACF;AAEA,IAAa,oBAA8C;CACzD,OAAO,CAAC,iCAAiC,oBAAoB;CAC7D,IAAI,CAAC,2BAA2B;CAChC,KAAK,CAAC,wBAAwB;CAC9B,aAAa,CAAC,wBAAwB;CACtC,mBAAmB,CAAC,wBAAwB;CAC5C,iBAAiB,CAAC,wBAAwB;CAC1C,oBAAoB,CAAC,wBAAwB;AAC/C;AAEA,IAAM,yBAAyB,cAC7B,2BAA2B,MAAM,kBAC/B,UAAU,KAAK,WAAW,aAAa,CACzC;AAEF,IAAM,wBAAwB,cAC5B,OAAO,UAAU,eAAe,KAAK,mBAAmB,UAAU,IAAI;AAExE,IAAM,0BAA0B,cAC9B,qBAAqB,SAAS,KAC9B,UAAU,MACP,MAAM,GAAG,CAAC,CACV,MAAM,cACL,kBAAkB,UAAU,KAAK,CAAC,MAAM,wBACtC,oBAAoB,KAAK,SAAS,CACpC,CACF;AAEJ,IAAM,0BAA0B,SAA2B;CACzD,IAAI,KAAK,eAAe,YAAY,UAAU,KAAK,aAAa,IAAI,GAClE,OAAO;CAGT,OAAO,MAAM,KAAK,KAAK,UAAU,CAAC,CAAC,MAChC,cACC,sBAAsB,SAAS,KAAK,uBAAuB,SAAS,CACxE;AACF;AAEA,SAAS,8BAA8B,MAAwB;CAC7D,MAAM,WAAW,KAAK,UAAU,IAAI;CAEpC,OAAO,eAAe,UAAU,wBAAwB;EACtD,cAAc;EACd,OAAO;CACT,CAAC;CAED,IAAI,KAAK,eAAe,YAAY,QAClC,SAAS,gBAAgB,IAAI;CAG/B,MAAM,KAAK,SAAS,UAAU,CAAC,CAAC,SAAS,cAAc;EACrD,IAAI,sBAAsB,SAAS,GAAG;GACpC,SAAS,gBAAgB,UAAU,IAAI;GACvC;EACF;EAEA,IAAI,qBAAqB,SAAS,GAAG;GACnC,MAAM,eAAe,UAAU,MAC5B,MAAM,GAAG,CAAC,CACV,QACE,cACC,CAAC,kBAAkB,UAAU,KAAK,CAAC,MAAM,wBACvC,oBAAoB,KAAK,SAAS,CACpC,CACJ,CAAC,CACA,KAAK,GAAG;GAEX,IAAI,iBAAiB,IAAI;IACvB,SAAS,gBAAgB,UAAU,IAAI;IACvC;GACF;GAEA,SAAS,aAAa,UAAU,MAAM,YAAY;EACpD;CACF,CAAC;CAED,OAAO;AACT;AAEA,SAAgB,yCAA6D;CAC3E,OAAO;EACL,UAAU,KAAK,QAAQ,aAAa,OAAO,MAAM,SAAiB;GAChE,MAAM,cAAc,8BAA8B,GAAG;GAErD,IAAI,uBAAuB,WAAW,GACpC,MAAM,IAAI,MACR,oDAAoD,YAAY,QAAQ,YAAY,EAAE,EACxF;GAGF,OAAO,QAAQ,aAAa,QAAQ,aAAa,OAAO,IAAI;EAC9D;EACA,KAAK,KAAc;GAOjB,OALE,OAAO,YAAY,eACnB,eAAe,WACf,CAAE,IAA0C,2BAC5C,uBAAuB,GAAG;EAG9B;CACF;AACF"}
|
|
@@ -39,7 +39,8 @@ function setupSchematic(options) {
|
|
|
39
39
|
return (tree, context) => {
|
|
40
40
|
const angularVersion = require_angular.getAngularVersion(tree);
|
|
41
41
|
const majorAngularVersion = require_angular.getMajorAngularVersion(angularVersion);
|
|
42
|
-
const
|
|
42
|
+
const workspace = require_workspace.getWorkspace(tree);
|
|
43
|
+
const projectRoot = require_workspace.getProject(workspace, options.project).root || "";
|
|
43
44
|
const isNx = require_workspace.isNxWorkspace(tree);
|
|
44
45
|
const browserMode = options.browserMode ?? false;
|
|
45
46
|
require_dependencies.addDevDependencies(tree, angularVersion, { browserMode });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/setup/index.ts"],"sourcesContent":["import {\n Rule,\n Tree,\n apply,\n url,\n applyTemplates,\n move,\n chain,\n mergeWith,\n SchematicContext,\n} from '@angular-devkit/schematics';\nimport { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';\nimport { parse } from 'jsonc-parser';\nimport {\n getAngularVersion,\n getMajorAngularVersion,\n getWorkspace,\n getProject,\n addDevDependencies,\n isNxWorkspace,\n} from '../utils';\nimport { Schema } from './schema';\n\nfunction updateTsConfigSpec(tree: Tree, projectRoot: string): void {\n const tsConfigPath = projectRoot\n ? `${projectRoot}/tsconfig.spec.json`\n : 'tsconfig.spec.json';\n\n if (!tree.exists(tsConfigPath)) {\n return;\n }\n\n const tsConfigContent = tree.read(tsConfigPath);\n if (!tsConfigContent) {\n return;\n }\n\n const tsConfig = parse(tsConfigContent.toString('utf-8')) as Record<\n string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any\n >;\n\n tsConfig.compilerOptions = tsConfig.compilerOptions || {};\n\n // Remove module (let Vite handle it)\n delete tsConfig.compilerOptions.module;\n\n // Set target to es2022\n tsConfig.compilerOptions.target = 'es2022';\n\n // Update types: remove jest, add vitest/globals\n const types: string[] = tsConfig.compilerOptions.types || ['node'];\n const filteredTypes = types.filter(\n (t: string) => t !== 'jest' && t !== 'jasmine',\n );\n if (!filteredTypes.includes('vitest/globals')) {\n filteredTypes.push('vitest/globals');\n }\n tsConfig.compilerOptions.types = filteredTypes;\n\n // Set files to include test-setup.ts\n tsConfig.files = ['src/test-setup.ts'];\n\n tree.overwrite(tsConfigPath, JSON.stringify(tsConfig, null, 2) + '\\n');\n}\n\nfunction updateAngularJson(tree: Tree, projectName: string): void {\n const workspace = getWorkspace(tree);\n const project = workspace.projects[projectName];\n\n if (!project.architect) {\n project.architect = {};\n }\n\n project.architect['test'] = {\n builder: '@analogjs/vitest-angular:test',\n };\n\n tree.overwrite('angular.json', JSON.stringify(workspace, null, 2) + '\\n');\n}\n\nfunction generateFiles(\n projectRoot: string,\n majorAngularVersion: number,\n isNx: boolean,\n browserMode: boolean,\n): Rule {\n return mergeWith(\n apply(url('./files'), [\n applyTemplates({\n majorAngularVersion,\n isNx,\n browserMode,\n }),\n move(projectRoot),\n ]),\n );\n}\n\nexport function setupSchematic(options: Schema): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const angularVersion = getAngularVersion(tree);\n const majorAngularVersion = getMajorAngularVersion(angularVersion);\n\n const workspace = getWorkspace(tree);\n const project = getProject(workspace, options.project);\n const projectRoot = project.root || '';\n const isNx = isNxWorkspace(tree);\n\n const browserMode = options.browserMode ?? false;\n\n // Add devDependencies\n addDevDependencies(tree, angularVersion, { browserMode });\n\n // Update tsconfig.spec.json (if exists)\n updateTsConfigSpec(tree, projectRoot);\n\n // Update angular.json test target\n updateAngularJson(tree, options.project);\n\n // Schedule package install\n context.addTask(new NodePackageInstallTask());\n\n // Generate files\n return chain([\n generateFiles(projectRoot, majorAngularVersion, isNx, browserMode),\n ]);\n };\n}\n"],"mappings":";;;;;;;;AAuBA,SAAS,mBAAmB,MAAY,aAA2B;CACjE,MAAM,eAAe,cACjB,GAAG,YAAY,uBACf;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/setup/index.ts"],"sourcesContent":["import {\n Rule,\n Tree,\n apply,\n url,\n applyTemplates,\n move,\n chain,\n mergeWith,\n SchematicContext,\n} from '@angular-devkit/schematics';\nimport { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';\nimport { parse } from 'jsonc-parser';\nimport {\n getAngularVersion,\n getMajorAngularVersion,\n getWorkspace,\n getProject,\n addDevDependencies,\n isNxWorkspace,\n} from '../utils';\nimport { Schema } from './schema';\n\nfunction updateTsConfigSpec(tree: Tree, projectRoot: string): void {\n const tsConfigPath = projectRoot\n ? `${projectRoot}/tsconfig.spec.json`\n : 'tsconfig.spec.json';\n\n if (!tree.exists(tsConfigPath)) {\n return;\n }\n\n const tsConfigContent = tree.read(tsConfigPath);\n if (!tsConfigContent) {\n return;\n }\n\n const tsConfig = parse(tsConfigContent.toString('utf-8')) as Record<\n string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any\n >;\n\n tsConfig.compilerOptions = tsConfig.compilerOptions || {};\n\n // Remove module (let Vite handle it)\n delete tsConfig.compilerOptions.module;\n\n // Set target to es2022\n tsConfig.compilerOptions.target = 'es2022';\n\n // Update types: remove jest, add vitest/globals\n const types: string[] = tsConfig.compilerOptions.types || ['node'];\n const filteredTypes = types.filter(\n (t: string) => t !== 'jest' && t !== 'jasmine',\n );\n if (!filteredTypes.includes('vitest/globals')) {\n filteredTypes.push('vitest/globals');\n }\n tsConfig.compilerOptions.types = filteredTypes;\n\n // Set files to include test-setup.ts\n tsConfig.files = ['src/test-setup.ts'];\n\n tree.overwrite(tsConfigPath, JSON.stringify(tsConfig, null, 2) + '\\n');\n}\n\nfunction updateAngularJson(tree: Tree, projectName: string): void {\n const workspace = getWorkspace(tree);\n const project = workspace.projects[projectName];\n\n if (!project.architect) {\n project.architect = {};\n }\n\n project.architect['test'] = {\n builder: '@analogjs/vitest-angular:test',\n };\n\n tree.overwrite('angular.json', JSON.stringify(workspace, null, 2) + '\\n');\n}\n\nfunction generateFiles(\n projectRoot: string,\n majorAngularVersion: number,\n isNx: boolean,\n browserMode: boolean,\n): Rule {\n return mergeWith(\n apply(url('./files'), [\n applyTemplates({\n majorAngularVersion,\n isNx,\n browserMode,\n }),\n move(projectRoot),\n ]),\n );\n}\n\nexport function setupSchematic(options: Schema): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const angularVersion = getAngularVersion(tree);\n const majorAngularVersion = getMajorAngularVersion(angularVersion);\n\n const workspace = getWorkspace(tree);\n const project = getProject(workspace, options.project);\n const projectRoot = project.root || '';\n const isNx = isNxWorkspace(tree);\n\n const browserMode = options.browserMode ?? false;\n\n // Add devDependencies\n addDevDependencies(tree, angularVersion, { browserMode });\n\n // Update tsconfig.spec.json (if exists)\n updateTsConfigSpec(tree, projectRoot);\n\n // Update angular.json test target\n updateAngularJson(tree, options.project);\n\n // Schedule package install\n context.addTask(new NodePackageInstallTask());\n\n // Generate files\n return chain([\n generateFiles(projectRoot, majorAngularVersion, isNx, browserMode),\n ]);\n };\n}\n"],"mappings":";;;;;;;;AAuBA,SAAS,mBAAmB,MAAY,aAA2B;CACjE,MAAM,eAAe,cACjB,GAAG,YAAY,uBACf;CAEJ,IAAI,CAAC,KAAK,OAAO,YAAY,GAC3B;CAGF,MAAM,kBAAkB,KAAK,KAAK,YAAY;CAC9C,IAAI,CAAC,iBACH;CAGF,MAAM,YAAA,GAAW,aAAA,MAAA,CAAM,gBAAgB,SAAS,OAAO,CAAC;CAMxD,SAAS,kBAAkB,SAAS,mBAAmB,CAAC;CAGxD,OAAO,SAAS,gBAAgB;CAGhC,SAAS,gBAAgB,SAAS;CAIlC,MAAM,iBADkB,SAAS,gBAAgB,SAAS,CAAC,MAAM,EAAA,CACrC,QACzB,MAAc,MAAM,UAAU,MAAM,SACvC;CACA,IAAI,CAAC,cAAc,SAAS,gBAAgB,GAC1C,cAAc,KAAK,gBAAgB;CAErC,SAAS,gBAAgB,QAAQ;CAGjC,SAAS,QAAQ,CAAC,mBAAmB;CAErC,KAAK,UAAU,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC,IAAI,IAAI;AACvE;AAEA,SAAS,kBAAkB,MAAY,aAA2B;CAChE,MAAM,YAAY,kBAAA,aAAa,IAAI;CACnC,MAAM,UAAU,UAAU,SAAS;CAEnC,IAAI,CAAC,QAAQ,WACX,QAAQ,YAAY,CAAC;CAGvB,QAAQ,UAAU,UAAU,EAC1B,SAAS,gCACX;CAEA,KAAK,UAAU,gBAAgB,KAAK,UAAU,WAAW,MAAM,CAAC,IAAI,IAAI;AAC1E;AAEA,SAAS,cACP,aACA,qBACA,MACA,aACM;CACN,QAAA,GAAO,2BAAA,UAAA,EAAA,GACL,2BAAA,MAAA,EAAA,GAAM,2BAAA,IAAA,CAAI,SAAS,GAAG,EAAA,GACpB,2BAAA,eAAA,CAAe;EACb;EACA;EACA;CACF,CAAC,IAAA,GACD,2BAAA,KAAA,CAAK,WAAW,CAClB,CAAC,CACH;AACF;AAEA,SAAgB,eAAe,SAAuB;CACpD,QAAQ,MAAY,YAA8B;EAChD,MAAM,iBAAiB,gBAAA,kBAAkB,IAAI;EAC7C,MAAM,sBAAsB,gBAAA,uBAAuB,cAAc;EAEjE,MAAM,YAAY,kBAAA,aAAa,IAAI;EAEnC,MAAM,cADU,kBAAA,WAAW,WAAW,QAAQ,OAC1B,CAAA,CAAQ,QAAQ;EACpC,MAAM,OAAO,kBAAA,cAAc,IAAI;EAE/B,MAAM,cAAc,QAAQ,eAAe;EAG3C,qBAAA,mBAAmB,MAAM,gBAAgB,EAAE,YAAY,CAAC;EAGxD,mBAAmB,MAAM,WAAW;EAGpC,kBAAkB,MAAM,QAAQ,OAAO;EAGvC,QAAQ,QAAQ,IAAI,iCAAA,uBAAuB,CAAC;EAG5C,QAAA,GAAO,2BAAA,MAAA,CAAM,CACX,cAAc,aAAa,qBAAqB,MAAM,WAAW,CACnE,CAAC;CACH;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/angular.ts"],"sourcesContent":["import { Tree, SchematicsException } from '@angular-devkit/schematics';\nimport { coerce, major } from 'semver';\n\nexport function getAngularVersion(tree: Tree): string {\n const packageJson = tree.read('package.json');\n if (!packageJson) {\n throw new SchematicsException('Could not find package.json');\n }\n\n const pkg = JSON.parse(packageJson.toString('utf-8'));\n const angularVersion =\n pkg.dependencies?.['@angular/core'] ||\n pkg.devDependencies?.['@angular/core'];\n\n if (!angularVersion) {\n throw new SchematicsException(\n 'Could not find @angular/core in package.json',\n );\n }\n\n return angularVersion;\n}\n\nexport function getMajorAngularVersion(angularVersion: string): number {\n const coerced = coerce(angularVersion);\n if (!coerced) {\n throw new SchematicsException(\n `Could not parse Angular version: ${angularVersion}`,\n );\n }\n return major(coerced);\n}\n"],"mappings":";;;AAGA,SAAgB,kBAAkB,MAAoB;CACpD,MAAM,cAAc,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"angular.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/angular.ts"],"sourcesContent":["import { Tree, SchematicsException } from '@angular-devkit/schematics';\nimport { coerce, major } from 'semver';\n\nexport function getAngularVersion(tree: Tree): string {\n const packageJson = tree.read('package.json');\n if (!packageJson) {\n throw new SchematicsException('Could not find package.json');\n }\n\n const pkg = JSON.parse(packageJson.toString('utf-8'));\n const angularVersion =\n pkg.dependencies?.['@angular/core'] ||\n pkg.devDependencies?.['@angular/core'];\n\n if (!angularVersion) {\n throw new SchematicsException(\n 'Could not find @angular/core in package.json',\n );\n }\n\n return angularVersion;\n}\n\nexport function getMajorAngularVersion(angularVersion: string): number {\n const coerced = coerce(angularVersion);\n if (!coerced) {\n throw new SchematicsException(\n `Could not parse Angular version: ${angularVersion}`,\n );\n }\n return major(coerced);\n}\n"],"mappings":";;;AAGA,SAAgB,kBAAkB,MAAoB;CACpD,MAAM,cAAc,KAAK,KAAK,cAAc;CAC5C,IAAI,CAAC,aACH,MAAM,IAAI,2BAAA,oBAAoB,6BAA6B;CAG7D,MAAM,MAAM,KAAK,MAAM,YAAY,SAAS,OAAO,CAAC;CACpD,MAAM,iBACJ,IAAI,eAAe,oBACnB,IAAI,kBAAkB;CAExB,IAAI,CAAC,gBACH,MAAM,IAAI,2BAAA,oBACR,8CACF;CAGF,OAAO;AACT;AAEA,SAAgB,uBAAuB,gBAAgC;CACrE,MAAM,WAAA,GAAU,OAAA,OAAA,CAAO,cAAc;CACrC,IAAI,CAAC,SACH,MAAM,IAAI,2BAAA,oBACR,oCAAoC,gBACtC;CAEF,QAAA,GAAO,OAAA,MAAA,CAAM,OAAO;AACtB"}
|
|
@@ -3,7 +3,8 @@ let _angular_devkit_schematics = require("@angular-devkit/schematics");
|
|
|
3
3
|
let semver = require("semver");
|
|
4
4
|
//#region packages/vitest-angular-tools/src/schematics/utils/dependencies.ts
|
|
5
5
|
function getDevDependencies(angularVersion, options = {}) {
|
|
6
|
-
|
|
6
|
+
const escapedVersion = angularVersion.replace(/[~^]/, "");
|
|
7
|
+
if ((0, semver.lt)(escapedVersion, "20.0.0")) throw new _angular_devkit_schematics.SchematicsException("Angular v20.0.0 or newer is required.");
|
|
7
8
|
const deps = {
|
|
8
9
|
"@analogjs/vite-plugin-angular": require_versions.ANALOG_JS_VITE_PLUGIN_ANGULAR,
|
|
9
10
|
vite: require_versions.VITE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/dependencies.ts"],"sourcesContent":["import { Tree, SchematicsException } from '@angular-devkit/schematics';\nimport { lt } from 'semver';\nimport {\n ANALOG_JS_VITE_PLUGIN_ANGULAR,\n JSDOM,\n PLAYWRIGHT,\n VITE,\n VITE_TSCONFIG_PATHS,\n VITEST_BROWSER_PLAYWRIGHT,\n VITEST_V5,\n} from './versions';\n\nexport interface DependencyOptions {\n browserMode?: boolean;\n}\n\nexport function getDevDependencies(\n angularVersion: string,\n options: DependencyOptions = {},\n): Record<string, string> {\n const escapedVersion = angularVersion.replace(/[~^]/, '');\n\n if (lt(escapedVersion, '20.0.0')) {\n throw new SchematicsException('Angular v20.0.0 or newer is required.');\n }\n\n const deps: Record<string, string> = {\n '@analogjs/vite-plugin-angular': ANALOG_JS_VITE_PLUGIN_ANGULAR,\n vite: VITE,\n vitest: VITEST_V5,\n 'vite-tsconfig-paths': VITE_TSCONFIG_PATHS,\n };\n\n if (options.browserMode) {\n deps['@vitest/browser-playwright'] = VITEST_BROWSER_PLAYWRIGHT;\n deps['playwright'] = PLAYWRIGHT;\n } else {\n deps['jsdom'] = JSDOM;\n }\n\n return deps;\n}\n\nexport function addDevDependencies(\n tree: Tree,\n angularVersion: string,\n options: DependencyOptions = {},\n): void {\n const packageJsonPath = 'package.json';\n const packageJson = tree.read(packageJsonPath);\n if (!packageJson) {\n throw new SchematicsException('Could not find package.json');\n }\n\n const pkg = JSON.parse(packageJson.toString('utf-8'));\n const devDeps = getDevDependencies(angularVersion, options);\n\n pkg.devDependencies = pkg.devDependencies || {};\n Object.entries(devDeps).forEach(([name, version]) => {\n pkg.devDependencies[name] = version;\n });\n\n // Sort devDependencies alphabetically\n pkg.devDependencies = Object.keys(pkg.devDependencies)\n .sort()\n .reduce((acc: Record<string, string>, key) => {\n acc[key] = pkg.devDependencies[key];\n return acc;\n }, {});\n\n tree.overwrite(packageJsonPath, JSON.stringify(pkg, null, 2) + '\\n');\n}\n"],"mappings":";;;;AAgBA,SAAgB,mBACd,gBACA,UAA6B,
|
|
1
|
+
{"version":3,"file":"dependencies.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/dependencies.ts"],"sourcesContent":["import { Tree, SchematicsException } from '@angular-devkit/schematics';\nimport { lt } from 'semver';\nimport {\n ANALOG_JS_VITE_PLUGIN_ANGULAR,\n JSDOM,\n PLAYWRIGHT,\n VITE,\n VITE_TSCONFIG_PATHS,\n VITEST_BROWSER_PLAYWRIGHT,\n VITEST_V5,\n} from './versions';\n\nexport interface DependencyOptions {\n browserMode?: boolean;\n}\n\nexport function getDevDependencies(\n angularVersion: string,\n options: DependencyOptions = {},\n): Record<string, string> {\n const escapedVersion = angularVersion.replace(/[~^]/, '');\n\n if (lt(escapedVersion, '20.0.0')) {\n throw new SchematicsException('Angular v20.0.0 or newer is required.');\n }\n\n const deps: Record<string, string> = {\n '@analogjs/vite-plugin-angular': ANALOG_JS_VITE_PLUGIN_ANGULAR,\n vite: VITE,\n vitest: VITEST_V5,\n 'vite-tsconfig-paths': VITE_TSCONFIG_PATHS,\n };\n\n if (options.browserMode) {\n deps['@vitest/browser-playwright'] = VITEST_BROWSER_PLAYWRIGHT;\n deps['playwright'] = PLAYWRIGHT;\n } else {\n deps['jsdom'] = JSDOM;\n }\n\n return deps;\n}\n\nexport function addDevDependencies(\n tree: Tree,\n angularVersion: string,\n options: DependencyOptions = {},\n): void {\n const packageJsonPath = 'package.json';\n const packageJson = tree.read(packageJsonPath);\n if (!packageJson) {\n throw new SchematicsException('Could not find package.json');\n }\n\n const pkg = JSON.parse(packageJson.toString('utf-8'));\n const devDeps = getDevDependencies(angularVersion, options);\n\n pkg.devDependencies = pkg.devDependencies || {};\n Object.entries(devDeps).forEach(([name, version]) => {\n pkg.devDependencies[name] = version;\n });\n\n // Sort devDependencies alphabetically\n pkg.devDependencies = Object.keys(pkg.devDependencies)\n .sort()\n .reduce((acc: Record<string, string>, key) => {\n acc[key] = pkg.devDependencies[key];\n return acc;\n }, {});\n\n tree.overwrite(packageJsonPath, JSON.stringify(pkg, null, 2) + '\\n');\n}\n"],"mappings":";;;;AAgBA,SAAgB,mBACd,gBACA,UAA6B,CAAC,GACN;CACxB,MAAM,iBAAiB,eAAe,QAAQ,QAAQ,EAAE;CAExD,KAAA,GAAI,OAAA,GAAA,CAAG,gBAAgB,QAAQ,GAC7B,MAAM,IAAI,2BAAA,oBAAoB,uCAAuC;CAGvE,MAAM,OAA+B;EACnC,iCAAiC,iBAAA;EACjC,MAAM,iBAAA;EACN,QAAQ,iBAAA;EACR,uBAAuB,iBAAA;CACzB;CAEA,IAAI,QAAQ,aAAa;EACvB,KAAK,gCAAgC,iBAAA;EACrC,KAAK,gBAAgB,iBAAA;CACvB,OACE,KAAK,WAAW,iBAAA;CAGlB,OAAO;AACT;AAEA,SAAgB,mBACd,MACA,gBACA,UAA6B,CAAC,GACxB;CACN,MAAM,kBAAkB;CACxB,MAAM,cAAc,KAAK,KAAK,eAAe;CAC7C,IAAI,CAAC,aACH,MAAM,IAAI,2BAAA,oBAAoB,6BAA6B;CAG7D,MAAM,MAAM,KAAK,MAAM,YAAY,SAAS,OAAO,CAAC;CACpD,MAAM,UAAU,mBAAmB,gBAAgB,OAAO;CAE1D,IAAI,kBAAkB,IAAI,mBAAmB,CAAC;CAC9C,OAAO,QAAQ,OAAO,CAAC,CAAC,SAAS,CAAC,MAAM,aAAa;EACnD,IAAI,gBAAgB,QAAQ;CAC9B,CAAC;CAGD,IAAI,kBAAkB,OAAO,KAAK,IAAI,eAAe,CAAC,CACnD,KAAK,CAAC,CACN,QAAQ,KAA6B,QAAQ;EAC5C,IAAI,OAAO,IAAI,gBAAgB;EAC/B,OAAO;CACT,GAAG,CAAC,CAAC;CAEP,KAAK,UAAU,iBAAiB,KAAK,UAAU,KAAK,MAAM,CAAC,IAAI,IAAI;AACrE"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
require("./versions.js");
|
|
2
|
-
require("./angular.js");
|
|
3
|
-
require("./workspace.js");
|
|
4
|
-
require("./dependencies.js");
|
|
1
|
+
const require_versions = require("./versions.js");
|
|
2
|
+
const require_angular = require("./angular.js");
|
|
3
|
+
const require_workspace = require("./workspace.js");
|
|
4
|
+
const require_dependencies = require("./dependencies.js");
|
|
5
|
+
exports.ANALOG_JS_VITE_PLUGIN_ANGULAR = require_versions.ANALOG_JS_VITE_PLUGIN_ANGULAR;
|
|
6
|
+
exports.JSDOM = require_versions.JSDOM;
|
|
7
|
+
exports.PLAYWRIGHT = require_versions.PLAYWRIGHT;
|
|
8
|
+
exports.VITE = require_versions.VITE;
|
|
9
|
+
exports.VITEST_BROWSER_PLAYWRIGHT = require_versions.VITEST_BROWSER_PLAYWRIGHT;
|
|
10
|
+
exports.VITEST_V5 = require_versions.VITEST_V5;
|
|
11
|
+
exports.VITE_TSCONFIG_PATHS = require_versions.VITE_TSCONFIG_PATHS;
|
|
12
|
+
exports.addDevDependencies = require_dependencies.addDevDependencies;
|
|
13
|
+
exports.getAngularVersion = require_angular.getAngularVersion;
|
|
14
|
+
exports.getDevDependencies = require_dependencies.getDevDependencies;
|
|
15
|
+
exports.getMajorAngularVersion = require_angular.getMajorAngularVersion;
|
|
16
|
+
exports.getProject = require_workspace.getProject;
|
|
17
|
+
exports.getWorkspace = require_workspace.getWorkspace;
|
|
18
|
+
exports.isNxWorkspace = require_workspace.isNxWorkspace;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-
|
|
1
|
+
export declare const ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-beta.2";
|
|
2
2
|
export declare const JSDOM = "^22.0.0";
|
|
3
3
|
export declare const VITE_TSCONFIG_PATHS = "^4.2.0";
|
|
4
4
|
export declare const VITE = "^8.0.0";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region packages/vitest-angular-tools/src/schematics/utils/versions.ts
|
|
2
|
-
var ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-
|
|
2
|
+
var ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-beta.2";
|
|
3
3
|
var JSDOM = "^22.0.0";
|
|
4
4
|
var VITE_TSCONFIG_PATHS = "^4.2.0";
|
|
5
5
|
var VITE = "^8.0.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/versions.ts"],"sourcesContent":["// Version constants (Angular 20+)\nexport const ANALOG_JS_VITE_PLUGIN_ANGULAR = '^3.0.0-
|
|
1
|
+
{"version":3,"file":"versions.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/versions.ts"],"sourcesContent":["// Version constants (Angular 20+)\nexport const ANALOG_JS_VITE_PLUGIN_ANGULAR = '^3.0.0-beta.2';\nexport const JSDOM = '^22.0.0';\nexport const VITE_TSCONFIG_PATHS = '^4.2.0';\nexport const VITE = '^8.0.0';\nexport const VITEST_V5 = '^5.0.0';\n\n// Browser mode dependencies\nexport const VITEST_BROWSER_PLAYWRIGHT = '^5.0.0';\nexport const PLAYWRIGHT = '^1.54.0';\n"],"mappings":";AACA,IAAa,gCAAgC;AAC7C,IAAa,QAAQ;AACrB,IAAa,sBAAsB;AACnC,IAAa,OAAO;AACpB,IAAa,YAAY;AAGzB,IAAa,4BAA4B;AACzC,IAAa,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/workspace.ts"],"sourcesContent":["import { Tree, SchematicsException } from '@angular-devkit/schematics';\n\nexport function isNxWorkspace(tree: Tree): boolean {\n return tree.exists('/nx.json');\n}\n\nexport interface WorkspaceProject {\n root: string;\n sourceRoot?: string;\n architect?: Record<\n string,\n { builder?: string; options?: Record<string, unknown> }\n >;\n}\n\nexport interface WorkspaceSchema {\n projects: Record<string, WorkspaceProject>;\n}\n\nexport function getWorkspace(tree: Tree): WorkspaceSchema {\n const workspaceFile = tree.read('angular.json');\n if (!workspaceFile) {\n throw new SchematicsException('Could not find angular.json');\n }\n return JSON.parse(workspaceFile.toString('utf-8'));\n}\n\nexport function getProject(\n workspace: WorkspaceSchema,\n projectName: string,\n): WorkspaceProject {\n const project = workspace.projects[projectName];\n if (!project) {\n throw new SchematicsException(\n `Project \"${projectName}\" not found in angular.json`,\n );\n }\n return project;\n}\n"],"mappings":";;AAEA,SAAgB,cAAc,MAAqB;
|
|
1
|
+
{"version":3,"file":"workspace.js","names":[],"sources":["../../../../../../../vitest-angular-tools/src/schematics/utils/workspace.ts"],"sourcesContent":["import { Tree, SchematicsException } from '@angular-devkit/schematics';\n\nexport function isNxWorkspace(tree: Tree): boolean {\n return tree.exists('/nx.json');\n}\n\nexport interface WorkspaceProject {\n root: string;\n sourceRoot?: string;\n architect?: Record<\n string,\n { builder?: string; options?: Record<string, unknown> }\n >;\n}\n\nexport interface WorkspaceSchema {\n projects: Record<string, WorkspaceProject>;\n}\n\nexport function getWorkspace(tree: Tree): WorkspaceSchema {\n const workspaceFile = tree.read('angular.json');\n if (!workspaceFile) {\n throw new SchematicsException('Could not find angular.json');\n }\n return JSON.parse(workspaceFile.toString('utf-8'));\n}\n\nexport function getProject(\n workspace: WorkspaceSchema,\n projectName: string,\n): WorkspaceProject {\n const project = workspace.projects[projectName];\n if (!project) {\n throw new SchematicsException(\n `Project \"${projectName}\" not found in angular.json`,\n );\n }\n return project;\n}\n"],"mappings":";;AAEA,SAAgB,cAAc,MAAqB;CACjD,OAAO,KAAK,OAAO,UAAU;AAC/B;AAeA,SAAgB,aAAa,MAA6B;CACxD,MAAM,gBAAgB,KAAK,KAAK,cAAc;CAC9C,IAAI,CAAC,eACH,MAAM,IAAI,2BAAA,oBAAoB,6BAA6B;CAE7D,OAAO,KAAK,MAAM,cAAc,SAAS,OAAO,CAAC;AACnD;AAEA,SAAgB,WACd,WACA,aACkB;CAClB,MAAM,UAAU,UAAU,SAAS;CACnC,IAAI,CAAC,SACH,MAAM,IAAI,2BAAA,oBACR,YAAY,YAAY,4BAC1B;CAEF,OAAO;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-
|
|
1
|
+
export declare const ANALOG_JS_VITE_PLUGIN_ANGULAR = "^3.0.0-beta.2";
|
|
2
2
|
export declare const JSDOM = "^22.0.0";
|
|
3
3
|
export declare const VITE_TSCONFIG_PATHS = "^4.2.0";
|
|
4
4
|
export declare const VITE = "^8.0.0";
|