diff --git a/src/__tests__/filterHelper.test.js b/src/__tests__/filterHelper.test.js index 419e218..a1f0e68 100644 --- a/src/__tests__/filterHelper.test.js +++ b/src/__tests__/filterHelper.test.js @@ -29,8 +29,7 @@ describe.each([ }); test('Test non implemented filter is skipped with warning', () => { - const warn = vi.fn(); - global.console.warn = warn; + const warn = vi.spyOn(console, 'warn'); expect(applyFilters([ { 'field': 'banana', @@ -559,8 +558,7 @@ describe.each([ }); test('test date filter DateRange skipped when value not implemented', () => { - const error = vi.fn(); - global.console.error = error; + const error = vi.spyOn(console, 'error'); expect( applyFilters([ { @@ -640,8 +638,7 @@ describe.each([ }); test('test childAttr filter is skipped when no data is set', () => { - const warn = vi.fn(); - global.console.warn = warn; + const warn = vi.spyOn(console, 'warn'); expect( applyFilters([ { @@ -690,8 +687,7 @@ describe.each([ }); test('test childArrayAttr filter is skipped when no data set', () => { - const warn = vi.fn(); - global.console.warn = warn; + const warn = vi.spyOn(console, 'warn'); expect( applyFilters([ { diff --git a/vitest.config.ts b/vitest.config.ts index ebd4142..b38a50e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -11,5 +11,6 @@ export default defineConfig({ reportsDirectory: './reports', }, outputFile: 'reports/unit.test.xml', + restoreMocks: true, }, });