Skip to content

Commit 4e74b4b

Browse files
committed
build: set up harness integration test for vitest
Now that Vitest is the default test runner in the CLI, we need test coverage for harnesses. These changes set up an integration test that brings in the common harness tests and executes them inside a CLI app using Vitest.
1 parent 7877edc commit 4e74b4b

13 files changed

Lines changed: 6269 additions & 0 deletions

File tree

integration/vitest/BUILD.bazel

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
load("//tools:integration.bzl", "LOCAL_NPM_PACKAGES", "integration_test")
2+
3+
integration_test(
4+
name = "test",
5+
srcs = ["//src/cdk/testing/tests:sources_for_integration_tests"] + glob(["**/*"]),
6+
commands = [
7+
"pnpm install",
8+
"node ./setup-test-files.mjs",
9+
"pnpm run test --watch=false",
10+
],
11+
npm_packages = LOCAL_NPM_PACKAGES,
12+
tags = ["requires-network"],
13+
)

integration/vitest/angular.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"cli": {
5+
"packageManager": "npm"
6+
},
7+
"newProjectRoot": "projects",
8+
"projects": {
9+
"vitest": {
10+
"projectType": "application",
11+
"schematics": {},
12+
"root": "",
13+
"sourceRoot": "src",
14+
"prefix": "app",
15+
"architect": {
16+
"build": {
17+
"builder": "@angular/build:application",
18+
"options": {
19+
"browser": "src/main.ts",
20+
"tsConfig": "tsconfig.app.json",
21+
"assets": [],
22+
"polyfills": ["zone.js"],
23+
"styles": []
24+
},
25+
"configurations": {
26+
"production": {
27+
"budgets": [],
28+
"outputHashing": "all"
29+
},
30+
"development": {
31+
"optimization": false,
32+
"extractLicenses": false,
33+
"sourceMap": true
34+
}
35+
},
36+
"defaultConfiguration": "production"
37+
},
38+
"serve": {
39+
"builder": "@angular/build:dev-server",
40+
"configurations": {
41+
"production": {
42+
"buildTarget": "vitest:build:production"
43+
},
44+
"development": {
45+
"buildTarget": "vitest:build:development"
46+
}
47+
},
48+
"defaultConfiguration": "development"
49+
},
50+
"test": {
51+
"builder": "@angular/build:unit-test"
52+
}
53+
}
54+
}
55+
}
56+
}

integration/vitest/package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "vitest",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/cdk": "next",
14+
"@angular/common": "^21.0.0",
15+
"@angular/compiler": "^21.0.0",
16+
"@angular/core": "^21.0.0",
17+
"@angular/forms": "^21.0.0",
18+
"@angular/material": "next",
19+
"@angular/platform-browser": "^21.0.0",
20+
"@angular/router": "^21.0.0",
21+
"glob": "latest",
22+
"rxjs": "~7.8.0",
23+
"tslib": "^2.3.0",
24+
"zone.js": "^0.16.0"
25+
},
26+
"devDependencies": {
27+
"@angular/build": "^21.0.3",
28+
"@angular/cli": "^21.0.3",
29+
"@angular/compiler-cli": "^21.0.0",
30+
"jsdom": "^27.1.0",
31+
"typescript": "~5.9.2",
32+
"vitest": "^4.0.8"
33+
}
34+
}

0 commit comments

Comments
 (0)