TypeError: _fakeTimers(…).JestFakeTimers is not a constructor
See original GitHub issue🐛 Bug Report
TypeError: _fakeTimers(…).JestFakeTimers is not a constructor
To Reproduce
Steps to reproduce the behavior:
- Write test cases in Node js project
- Set
test: 'jest'
script inpackage.json
- Set a docker container with the following Dockerfile
# Dockerfile
FROM node:12.14.1-alpine
RUN mkdir /usr/app
WORKDIR /usr/app
COPY . /usr/app
RUN apk update && apk upgrade && apk add --no-cache git
RUN npm install -g jest
RUN npm i
RUN npm test
CMD npm start
The node_modules
is always re-created from scratch while creating the Docker image.
Expected behavior
The RUN npm test
should successfully run the test cases
Link to repl or repo (highly encouraged)
NA
envinfo
System:
OS: Linux 4.19 Alpine Linux
CPU: (2) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Binaries:
Node: 12.14.1 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
npmPackages:
jest: ^26.2.2 => 26.4.2
Crosspost on Stackoverflow: https://stackoverflow.com/q/63522963/2404470
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:11
Top Results From Across the Web
TypeError: _fakeTimers(...).JestFakeTimers is not a constructor
I have a Node js server which has some tests running with jest . The result of the npm test ON LOCAL MACHINE...
Read more >Timer Mocks - Jest
In the following example we enable fake timers by calling jest. ... At this point in time, the callback should not have been...
Read more >jest.useFakeTimers JavaScript and Node.js code examples
useFakeTimers (); const spy = jest.fn(); delay(100).then(spy); expect(spy).not.toBeCalled(); // Fast-forward until all timers have been executed jest.
Read more >Problems with using useFakeTimers('modern') in a create ...
Use the new fake timers approach from Jest 26: jest. ... /jest-fix-the-not-wrapped-in-act-warning-with-jest-fake-timers. act(() => { jest.
Read more >TypeError: StoryblokClient is not a constructor : r/webdev
hey, as you can see here storyblokClient is definetly an object, however when I use it like that it throws this error (note:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What worked for me, was adding this to
package.json
:"resolutions": { "jest-environment-jsdom": "^26.0.1" }
Adding this to
package.json
, worked for me too. Thanks, @Cedricvb!