-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jest.clearAllMocks is not clearing my test spy's #1992
Comments
The issue is not Wallaby specific. The same issue can be reproduced if you run Jest CLI with Note that this issue, and #1991 are specific to My understanding is that mocking Another example of things being wrong is visible on your screenshot - Jest CLI finds an obsolete snapshot, even though it doesn't exist. If you run Another example of broken things is the other issue that you have created - #1991. I would recommend against mocking module.exports = function () {
return {
files: [
'tsconfig.json',
'package.json',
'**/__mocks__/**',
'!/__tests__/**/*.ts',
],
tests: [
'/__tests__/**/*.ts',
],
filesWithNoCoverageCalculated: [
'**/__mocks__/**'
],
env: {
type: 'node',
runner: 'node'
},
testFramework: 'jest',
debug: true,
+ workers: {recycle: true},
preprocessors: {
'**/*.js?(x)': file => require('babel-core').transform(
file.content,
{sourceMap: true, filename: file.path, presets: ['babel-preset-jest']})
},
setup(wallaby) {
const config = require("./package.json").jest;
wallaby.testFramework.configure(config);
}
};
}; The same solution applies to another issue #1991. The solution does come with performance cost (as Jest needs to be restarted). |
Issue description or question
As I continue writing my tests, the mock counts increase to a very high number. When I run the test using the jest cli, the spy seems to reset because the tests pass.
Here is a sample repository
https://github.com/NikkiJ19/wallaby-jest
branch - issue/mock-clearAll
Okay initially.
Once I begin typing, the counts start racking up.
Jest cli does not show an error.
Wallaby.js configuration file
Code editor or IDE name and version
WebStorm 2018.3.4
Build #WS-183.5429.34, built on January 30, 2019
Subscription is active until April 27, 2019
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
OS name and version
OS Name Microsoft Windows 10 Pro
Version 10.0.17134 Build 17134
The text was updated successfully, but these errors were encountered: