Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Issue with Angular 8: src/tsconfig.spec.json => tsconfig.spec.json #12

@yjaaidi

Description

@yjaaidi

Describe the bug
Using the schematic with Angular 8 then running the tests will produce the following error:

 File not found: <rootDir>/src/tsconfig.spec.json (resolved as: /.../src/tsconfig.spec.json)

This is due to the fact that Angular 8 moves tsconfig.spec.json out of src while jest-angular-preset is expecting tsconfig.spec.json to be in src.

Maybe jest-angular-preset should automatically detect tsconfig.spec.json location but it might be easier to handle this in this schematic as a temporary fix.

Meanwhile, there are two workarounds (and maybe more):

  1. 😔Move tsconfig.spec.json back to src.
  2. ✅Update jest.config.js:
const tsJestPreset = require('jest-preset-angular/jest-preset').globals['ts-jest'];

module.exports = {
  ...
  globals: {
    'ts-jest': {
      ...tsJestPreset,
      tsConfig: 'tsconfig.spec.json'
    }
  }
};

To Reproduce
Steps to reproduce the behavior:

  1. npm install -g @angular/[email protected]
  2. ng add @briebug/jest-schematic
  3. npm test
  4. See error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions