Version
27.1.2
Steps to reproduce
- Clone this repo
cd examples/ts-only
npm i
- Add
jest.mock('example'); to src/welcome-message.spec.ts
- Run
npm run test-esm
Expected behavior
Jest to run without an error and for the jest mocking to work correctly.
Actual behavior
I get the following error: ReferenceError: jest is not defined
Debug log
I can't post a debug log because GitHub Issues throws an error with There was an error creating your Issue: body is too long (maximum is 65536 characters).
Additional context
I've tried importing jest from @jest/globals which resolved the error but then the mocking does not work.
It would be useful if you could provide a working mocking example.
Environment
System:
OS: macOS 11.6
CPU: (8) arm64 Apple M1
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
npm: 8.3.0 - ~/.nvm/versions/node/v16.13.1/bin/npm
npmPackages:
jest: ^27.3.1 => 27.4.3
Version
27.1.2
Steps to reproduce
cd examples/ts-onlynpm ijest.mock('example');tosrc/welcome-message.spec.tsnpm run test-esmExpected behavior
Jest to run without an error and for the jest mocking to work correctly.
Actual behavior
I get the following error:
ReferenceError: jest is not definedDebug log
I can't post a debug log because GitHub Issues throws an error with
There was an error creating your Issue: body is too long (maximum is 65536 characters).Additional context
I've tried importing jest from
@jest/globalswhich resolved the error but then the mocking does not work.It would be useful if you could provide a working mocking example.
Environment
System: OS: macOS 11.6 CPU: (8) arm64 Apple M1 Binaries: Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node npm: 8.3.0 - ~/.nvm/versions/node/v16.13.1/bin/npm npmPackages: jest: ^27.3.1 => 27.4.3