Skip to content

Commit 693f581

Browse files
committed
feat(): add tests
1 parent c09b5b0 commit 693f581

23 files changed

Lines changed: 284 additions & 326 deletions

apps/forms/61-simplest-signal-form/project.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@
6262
"lint": {
6363
"executor": "@nx/eslint:lint"
6464
},
65-
"test": {
66-
"executor": "@angular/build:unit-test",
67-
"options": {
68-
"runnerConfig": "apps/forms/61-simplest-signal-form/vitest-base.config.ts"
69-
}
70-
},
7165
"serve-static": {
7266
"continuous": true,
7367
"executor": "@nx/web:file-server",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { setupTestBed } from '@analogjs/vitest-angular/setup-testbed';
2+
import '@angular/compiler';
3+
4+
setupTestBed({
5+
browserMode: true, // Enables visual test preview
6+
});

apps/forms/61-simplest-signal-form/src/test-setup/no-teardown.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "../../../dist/out-tsc",
5-
"types": ["vitest/globals"]
4+
"outDir": "./out-tsc/spec",
5+
"target": "es2022",
6+
"types": ["vitest/globals", "node"]
67
},
7-
"include": ["src/**/*.ts", "src/**/*.d.ts"]
8+
"files": ["src/test-setup.ts"],
9+
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
810
}

apps/forms/61-simplest-signal-form/vitest-base.config.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { defineConfig } from 'vite';
2+
3+
import angular from '@analogjs/vite-plugin-angular';
4+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
5+
import { playwright } from '@vitest/browser-playwright';
6+
7+
export default defineConfig(({ mode }) => ({
8+
plugins: [angular(), nxViteTsPaths()],
9+
test: {
10+
globals: true,
11+
setupFiles: ['src/test-setup.ts'],
12+
// environment: 'jsdom',
13+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
14+
reporters: ['default'],
15+
// Vitest browser config
16+
browser: {
17+
enabled: true,
18+
headless: false, // set to true in CI
19+
provider: playwright(),
20+
instances: [{ browser: 'chromium' }],
21+
},
22+
},
23+
}));

apps/forms/62-crossfield-validation-signal-form/project.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@
6464
"lint": {
6565
"executor": "@nx/eslint:lint"
6666
},
67-
"ng-test": {
68-
"executor": "@angular/build:unit-test",
69-
"options": {
70-
"runnerConfig": "apps/forms/62-crossfield-validation-signal-form/vitest-base.config.ts"
71-
}
72-
},
73-
"test": {
74-
"executor": "@analogjs/vitest-angular:test"
75-
},
7667
"serve-static": {
7768
"continuous": true,
7869
"executor": "@nx/web:file-server",

apps/forms/62-crossfield-validation-signal-form/src/app/app.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('AppComponent', () => {
88
});
99

1010
describe('When component is rendered', () => {
11-
it.only('Then should display the form title', async () => {
11+
it('Then should display the form title', async () => {
1212
const heading = page.getByRole('heading', {
1313
name: /registration form/i,
1414
});

apps/forms/62-crossfield-validation-signal-form/src/test-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import '@analogjs/vitest-angular/setup-snapshots';
21
import { setupTestBed } from '@analogjs/vitest-angular/setup-testbed';
32
import '@angular/compiler';
43

apps/forms/63-custom-foms/project.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@
6262
"lint": {
6363
"executor": "@nx/eslint:lint"
6464
},
65-
"test": {
66-
"executor": "@angular/build:unit-test",
67-
"options": {
68-
"runnerConfig": "apps/forms/63-custom-form/vitest-base.config.ts"
69-
}
70-
},
7165
"serve-static": {
7266
"continuous": true,
7367
"executor": "@nx/web:file-server",

0 commit comments

Comments
 (0)