Skip to content

Commit ee69ba0

Browse files
authored
refactor(router-store): migrate unit tests to Vitest (#5035)
Closes #5020
1 parent d4e6052 commit ee69ba0

File tree

16 files changed

+1011
-930
lines changed

16 files changed

+1011
-930
lines changed

modules/router-store/jest.config.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

modules/router-store/migrations/14_0_0/index.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { waitForAsync } from '@angular/core/testing';
99

1010
describe('Router Store Migration 14_0_0', () => {
1111
let appTree: UnitTestTree;
12-
const collectionPath = path.join(__dirname, '../migration.json');
12+
const collectionPath = path.join(
13+
process.cwd(),
14+
'dist/modules/router-store/migrations/migration.json'
15+
);
1316
const pkgName = 'router-store';
1417

1518
beforeEach(() => {

modules/router-store/migrations/15_2_0/index.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { waitForAsync } from '@angular/core/testing';
99

1010
describe('Router Store Migration 15_2_0', () => {
1111
let appTree: UnitTestTree;
12-
const collectionPath = path.join(__dirname, '../migration.json');
12+
const collectionPath = path.join(
13+
process.cwd(),
14+
'dist/modules/router-store/migrations/migration.json'
15+
);
1316
const pkgName = 'router-store';
1417

1518
beforeEach(() => {

modules/router-store/migrations/6_0_0/index.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {
1313
versionPrefixes,
1414
} from '@ngrx/schematics-core/testing/update';
1515

16-
const collectionPath = path.join(__dirname, '../migration.json');
16+
const collectionPath = path.join(
17+
process.cwd(),
18+
'dist/modules/router-store/migrations/migration.json'
19+
);
1720

1821
describe('Router Store Migration 6_0_0', () => {
1922
let appTree;

modules/router-store/migrations/8_0_0/index.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import { createPackageJson } from '@ngrx/schematics-core/testing/create-package'
88

99
describe('Router Store Migration 8_0_0', () => {
1010
let appTree: UnitTestTree;
11-
const collectionPath = path.join(__dirname, '../migration.json');
11+
const collectionPath = path.join(
12+
process.cwd(),
13+
'dist/modules/router-store/migrations/migration.json'
14+
);
1215
const pkgName = 'router-store';
1316

1417
beforeEach(() => {

modules/router-store/migrations/9_0_0/index.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import { createPackageJson } from '@ngrx/schematics-core/testing/create-package'
88

99
describe('Router Store Migration 9_0_0', () => {
1010
let appTree: UnitTestTree;
11-
const collectionPath = path.join(__dirname, '../migration.json');
11+
const collectionPath = path.join(
12+
process.cwd(),
13+
'dist/modules/router-store/migrations/migration.json'
14+
);
1215
const pkgName = 'router-store';
1316

1417
beforeEach(() => {

modules/router-store/project.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525
{
2626
"command": "pnpm exec tsc -p modules/router-store/tsconfig.schematics.json"
2727
},
28+
{
29+
"command": "pnpm exec rimraf node_modules/@ngrx/router-store"
30+
},
31+
{
32+
"command": "pnpm exec mkdirp node_modules/@ngrx/router-store"
33+
},
34+
{
35+
"command": "ncp dist/modules/router-store node_modules/@ngrx/router-store"
36+
},
2837
{
2938
"command": "cpy LICENSE dist/modules/router-store"
3039
}
@@ -43,12 +52,8 @@
4352
"outputs": ["{options.outputFile}"]
4453
},
4554
"test": {
46-
"executor": "@nx/jest:jest",
47-
"options": {
48-
"jestConfig": "modules/router-store/jest.config.ts",
49-
"runInBand": true,
50-
"passWithNoTests": false
51-
},
55+
"executor": "@analogjs/vitest-angular:test",
56+
"dependsOn": ["build"],
5257
"outputs": ["{workspaceRoot}/coverage/modules/router-store"]
5358
}
5459
}

modules/router-store/schematics/ng-add/__snapshots__/index.spec.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`Router Store ng-add Schematic Router Store ng-add Schematic for standalone application provides initial setup 1`] = `
3+
exports[`Router Store ng-add Schematic > Router Store ng-add Schematic for standalone application > provides initial setup 1`] = `
44
"import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
55
import { provideRouterStore } from '@ngrx/router-store';
66

modules/router-store/schematics/ng-add/index.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
describe('Router Store ng-add Schematic', () => {
1313
const schematicRunner = new SchematicTestRunner(
1414
'@ngrx/router-store',
15-
path.join(__dirname, '../collection.json')
15+
path.join(
16+
process.cwd(),
17+
'dist/modules/router-store/schematics/collection.json'
18+
)
1619
);
1720
const defaultOptions: RouterStoreOptions = {
1821
skipPackageJson: false,

0 commit comments

Comments
 (0)