Closed undsoft closed 4 years ago
Additional piece of info. Doing:
const t: JestMatchers<any> = expect(2);
errors with
Error:(5, 11) TS2322: Type 'Matchers
' is not assignable to type 'JestMatchersShape<Matchers<void, any>, Matchers<Promise , any>>'. Type 'Matchers ' is missing the following properties from type '{ resolves: AndNot<Matchers<Promise , any>>; rejects: AndNot<Matchers<Promise , any>>; }': resolves, rejects
but only if spectator is installed.
I've traced the problem to @types/jasmine actually being installed by one of the packages. In my case it was ng-cli-pug-loader. I was able to remove this package.
Not sure why the problem didn't manifest before installing spectator.
It seems like you solved the issue. I'm closing it.
import {describe, expect, it} from '@jest/globals'
solves the problem
@NetanelBasal that is not always possible to get rid of jasmine
typings. Protractor
requires it, and it worked well with jest
specs before installing spectator
. The only way to handle this issue is to import @jest/globals
in every spec which uses jest specific matchers as tom10271 suggested, but that is not very convenient.
I'm submitting a...
Current behavior
I've recently installed spectator and I've noticed that some methods in expect() stopped working. For example, toMatchObject and toMatchSnapshot are no longer working. I get errors like this:
They do work once I remove spectator.
I don't have anything jasmine related in my package.json. Here are the relevant parts:
So far I've tried downgrading jest and @types/jest versions and removing other packages. I'm running out of ideas on how to debug it.