Tests don't run in Angular 16 using Jasmine/Karma

Open
#25,936 15 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
angular, typescript

Research direction

Reproduce the failure with ng test using the Angular CLI, Node, and TypeScript versions listed in the issue. Start by examining @ngtools/webpack/src/ivy/index.js and the project's tsconfig configuration; done means Angular 16 tests run without the reported unknown-token or missing-compilation error.

Written by the indexing model from the issue text.

Description

area: @ngtools/webpack freq1: low severity5: regression type: bug/fix
Command

test

Is this a regression?
  • Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was

15

Description

The project compiles well, and the tests worked in version 15 of Angular. After running ng test I am receiving the following error:

ng-virtual-main.js!=!data:text/javascript;base64 ...Unknown string like token - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): ...Unknown string like token s missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

Minimal Reproduction

After running ng test I am receiving the following error:

ng-virtual-main.js!=!data:text/javascript;base64 ...Unknown string like token - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): ...Unknown string like token s missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

Exception or Error
`ng-virtual-main.js!=!data:text/javascript;base64 ...Unkown string like token - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):  ...Unkown string like token s missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.`
Your Environment
npm ls @ngtools/webpack

`└─┬ @angular-devkit/build-angular@16.2.4
  └── @ngtools/webpack@16.2.4`

ng version 

`Angular CLI: 16.2.4
Node: 18.15.0
Package Manager: npm 9.5.0
OS: linux x64

Angular: 16.2.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                              Version
--------------------------------------------------------------
@angular-devkit/architect            0.1602.4
@angular-devkit/build-angular        16.2.4
@angular-devkit/core                 16.2.4
@angular-devkit/schematics           16.2.4
@angular/cdk                         16.2.6
@angular/cli                         16.2.4
@angular/material                    16.2.6
@angular/material-date-fns-adapter   16.2.6
@schematics/angular                  16.2.4
rxjs                                 7.5.7
typescript                           4.9.3
zone.js                              0.13.3
`
Anything else relevant?

No response

Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
16h 35m
Merged PRs (30d)
176

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/angular-cli

All issues in angular/angular-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.