@@ -1,6 +1,5 @@
import {
vi,
- beforeEach,
describe, test, expect,
} from 'vitest';
@@ -30,12 +29,6 @@ describe('safeRedirect', () => {
} as any as ResWithSafeRedirect;
const next = vi.fn();
- beforeEach(() => {
- getFunc.mockClear();
- redirect.mockClear();
- next.mockClear();
- });
-
test('redirects to \'/\' because specified url causes open redirect vulnerability', () => {
registerSafeRedirect(req, res, next);
@@ -8,5 +8,6 @@ export default defineProject({
test: {
environment: 'node',
exclude: ['**/test/**'],
+ clearMocks: true,
},
});
@@ -0,0 +1,12 @@
+import tsconfigPaths from 'vite-tsconfig-paths';
+import { defineProject } from 'vitest/config';
+
+export default defineProject({
+ plugins: [
+ tsconfigPaths(),
+ ],
+ test: {
+ environment: 'node',
+ },
+});