Skip to content

Commit e63bd14

Browse files
committed
PD-6016 fix karma spec discovery, restoring 686 tests from 1
src/test.ts was configured as the karma main but contained only the zone.js import and initTestEnvironment, without the require.context that pulls in spec files. With a main set, the builder loads only that entry, so ng test ran 1 test while 334 spec files sat unexecuted. The suite has effectively been a no-op, which is how a regression can land in a file that ships with tests. Declare zone.js/testing alongside the existing polyfills and drop main, which lets the builder discover specs from tsconfig.spec.json. Delete test.ts, now unreachable, and drop it from the spec tsconfig files list.
1 parent 66f22f2 commit e63bd14

3 files changed

Lines changed: 2 additions & 20 deletions

File tree

angular.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@
419419
"test": {
420420
"builder": "@angular-devkit/build-angular:karma",
421421
"options": {
422-
"main": "src/test.ts",
423-
"polyfills": "src/polyfills.ts",
422+
"polyfills": ["src/polyfills.ts", "zone.js/testing"],
424423
"tsConfig": "src/tsconfig.spec.json",
425424
"karmaConfig": "src/karma.conf.js",
426425
"styles": [

src/test.ts

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

src/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"outDir": "../out-tsc/spec",
55
"types": ["jasmine", "node"]
66
},
7-
"files": ["test.ts", "polyfills.ts"],
7+
"files": ["polyfills.ts"],
88
"include": ["**/*.spec.ts", "**/*.d.ts"]
99
}

0 commit comments

Comments
 (0)