Angular-builders: "polyfills.ts not found" in angular 8 project

Created on 12 Jun 2019  路  2Comments  路  Source: just-jeb/angular-builders

Describe the bug
When running ng test every test suite will fail with this message:

Test suite failed to run

TypeScript diagnostics (customize using [jest-config].globals.ts-jest.diagnostics option):
error TS6053: File 'myprojectroot/polyfills.ts' not found.

To Reproduce
Steps to reproduce the behavior:

  1. Run ng new foo
  2. Add @angular-builders/jest
  3. Write a test
  4. Run ng test
  5. See error

Expected behavior
Tests should run

Builder:

  • @angular-builders/jest
  • 8.0.2

Libraries

  • angular-devkit/build-angular: 0.800.2

Additional context
I think the problem is that it's assumed that polyfill.ts was moved to the root dir. It was not.
A newly created angular project have the following config

"polyfills": "src/polyfills.ts",

Most helpful comment

Oops, the problem was a configuration.

Had this in my tsconfig.spec.json file

"files": ["polyfills.ts"],

Should be

"files": ["src/polyfills.ts"],

All 2 comments

Are you sure this problem reproduces when you follow the documentation? Because here are two example apps (one for single project, second for multi-project) and they both work fine...

Oops, the problem was a configuration.

Had this in my tsconfig.spec.json file

"files": ["polyfills.ts"],

Should be

"files": ["src/polyfills.ts"],

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renatoaraujoc picture renatoaraujoc  路  6Comments

enten picture enten  路  10Comments

just-jeb picture just-jeb  路  3Comments

julmot picture julmot  路  8Comments

RyanHow picture RyanHow  路  7Comments