Skip to content

Commit

Permalink
test: build signals library and use output for schematics/migrations …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
brandonroberts committed Dec 15, 2024
1 parent 51c3247 commit 534514f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 45 deletions.
22 changes: 0 additions & 22 deletions modules/signals/jest.config.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { createWorkspace } from '@ngrx/schematics-core/testing';
import { tags } from '@angular-devkit/core';

describe('migrate protectedState', () => {
const collectionPath = path.join(__dirname, '../migration.json');
const collectionPath = path.join(
process.cwd(),
'dist/modules/signals/migrations/migration.json'
);
const schematicRunner = new SchematicTestRunner('schematics', collectionPath);

let appTree: UnitTestTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import * as path from 'path';
import { LogEntry } from '@angular-devkit/core/src/logger';

describe('18_0_0-rc_3-writablestatesource', () => {
const collectionPath = path.join(__dirname, '../migration.json');
const collectionPath = path.join(
process.cwd(),
'dist/modules/signals/migrations/migration.json'
);
const schematicRunner = new SchematicTestRunner('schematics', collectionPath);

let appTree: UnitTestTree;
Expand Down
5 changes: 4 additions & 1 deletion modules/signals/migrations/19_0_0-rc_0-props/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { createWorkspace } from '@ngrx/schematics-core/testing';
import { tags } from '@angular-devkit/core';

describe('migrate to props', () => {
const collectionPath = path.join(__dirname, '../migration.json');
const collectionPath = path.join(
process.cwd(),
'dist/modules/signals/migrations/migration.json'
);
const schematicRunner = new SchematicTestRunner('schematics', collectionPath);

let appTree: UnitTestTree;
Expand Down
19 changes: 2 additions & 17 deletions modules/signals/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,8 @@
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "nx:run-commands",
"options": {
"commands": ["nx test-source signals", "nx test-schematics signals"]
}
},
"test-source": {
"executor": "@analogjs/vitest-angular:test"
},
"test-schematics": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "modules/signals/jest.config.ts",
"runInBand": true,
"passWithNoTests": false,
"testPathPattern": ["schematics", "migrations"]
},
"outputs": ["{workspaceRoot}/coverage/modules/signals"]
"executor": "@analogjs/vitest-angular:test",
"dependsOn": ["build"]
}
}
}
2 changes: 1 addition & 1 deletion modules/signals/schematics/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createWorkspace } from '@ngrx/schematics-core/testing';
describe('Signals ng-add Schematic', () => {
const schematicRunner = new SchematicTestRunner(
'@ngrx/signals',
path.join(__dirname, '../collection.json')
path.join(process.cwd(), 'dist/modules/signals/schematics/collection.json')
);
const defaultOptions: SchemaOptions = {
skipPackageJson: false,
Expand Down
2 changes: 1 addition & 1 deletion modules/signals/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"target": "es2016"
},
"files": ["test-setup.ts"],
"include": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
}
1 change: 0 additions & 1 deletion modules/signals/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default defineConfig(({ mode }) => {
environment: 'jsdom',
setupFiles: ['test-setup.ts'],
include: ['**/*.spec.ts'],
exclude: ['migrations/**', 'schematics/**'],
reporters: ['default']
},
define: {
Expand Down

0 comments on commit 534514f

Please sign in to comment.