Skip to content

Commit

Permalink
fix: restore all mocks between tests
Browse files Browse the repository at this point in the history
Restore all mocks between tests in `buildJsonResults.test.js` to ensure
that it works with Jest 24.
  • Loading branch information
JohanBrorson committed Apr 5, 2022
1 parent 0041247 commit a15a3fb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions __tests__/buildJsonResults.test.js
Expand Up @@ -9,7 +9,13 @@ let jsonResults;
let ignoreJunitErrors = false;

describe('buildJsonResults', () => {
beforeEach(() => {
jest.spyOn(fs, 'existsSync');
})

afterEach(() => {
jest.restoreAllMocks();

if (ignoreJunitErrors !== true) {
// Verify each tests JSON output results in a
// compliant junit.xml file based on __tests__/lib/junit.xsd (jenkins xsd)
Expand Down Expand Up @@ -410,7 +416,6 @@ describe('buildJsonResults', () => {
{ virtual: true },
);

jest.spyOn(fs, 'existsSync');
fs.existsSync.mockReturnValue(true);

const options = {
Expand Down Expand Up @@ -439,5 +444,4 @@ describe('buildJsonResults', () => {
]),
);
});

});

0 comments on commit a15a3fb

Please sign in to comment.