hirezio / given

A monorepo for jasmine / jest addons that help you clean up your microtests by breaking them into a Given / When / Then structure.
MIT License
21 stars 4 forks source link

Angular 16: cannot find types (Cannot find name 'Then'.) #20

Open jimschmit opened 1 year ago

jimschmit commented 1 year ago

Describe the bug After upgrading to Angular v16, the tests no longer run. An example of a thrown error in the terminal is the following one: error TS2304: Cannot find name 'Given'.

To Reproduce

  1. Update Angular to v16
  2. run the angular unit tests (npm run test)

Expected behavior Tests should still recognise jasmine given types

Desktop (please complete the following information):

Additional context

* tsconfig.spec.ts

/ To learn more about this file see: https://angular.io/config/tsconfig. / { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", "types": ["jasmine", "@hirez_io/jasmine-given"] }, "files": ["src/test.ts", "src/polyfills.ts"], "include": ["src/*/.spec.ts", "src/*/.d.ts"] }

* test.ts

// This file is required by karma.conf.js and loads recursively all the .spec and framework files import 'zone.js'; import 'zone.js/testing';

import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; import { autoUnsubscribe } from '@hirez_io/observer-spy';

// First, initialize the Angular testing environment. getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());

autoUnsubscribe();

dmitrii-konoplyannikov-napier commented 11 months ago

I have the same issue after upgrading angular to v16

dmitrii-konoplyannikov-napier commented 11 months ago

@shairez I suppose the problem appears after upgrading typescript to version 5.x.x . @jimschmit try to downgrade typescript to "typescript": "~4.9.3"