Skip to content

Commit 6a5a375

Browse files
committed
Use tsconfigPaths in vitest.config.mts
1 parent e9f3e7a commit 6a5a375

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

packages/toolkit/vitest.config.mts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
1-
import { defineConfig } from 'vitest/config'
2-
31
import path from 'node:path'
42
import { fileURLToPath } from 'node:url'
3+
import tsconfigPaths from 'vite-tsconfig-paths'
4+
import { defineConfig } from 'vitest/config'
55

66
// No __dirname under Node ESM
77
const __filename = fileURLToPath(import.meta.url)
88
const __dirname = path.dirname(__filename)
99

1010
export default defineConfig({
11+
plugins: [tsconfigPaths({ root: import.meta.dirname })],
1112
test: {
1213
globals: true,
1314
environment: 'jsdom',
1415
setupFiles: ['./vitest.setup.ts'],
1516
include: ['./src/**/*.(spec|test).[jt]s?(x)'],
16-
alias: {
17-
// prettier-ignore
18-
'@reduxjs/toolkit/query/react': path.join(__dirname,'./src/query/react/index.ts'), // @remap-prod-remove-line
19-
'@reduxjs/toolkit/query': path.join(__dirname, './src/query/index.ts'), // @remap-prod-remove-line
20-
'@reduxjs/toolkit/react': path.join(__dirname, './src/index.ts'), // @remap-prod-remove-line
21-
'@reduxjs/toolkit': path.join(__dirname, './src/index.ts'), // @remap-prod-remove-line
22-
23-
// this mapping is disabled as we want `dist` imports in the tests only to be used for "type-only" imports which don't play a role for jest
24-
//'^@reduxjs/toolkit/dist/(.*)$': '<rootDir>/src/*',
25-
'@internal': path.join(__dirname, './src'),
26-
},
2717
server: { deps: { inline: ['redux', '@reduxjs/toolkit'] } },
2818
},
2919
})

0 commit comments

Comments
 (0)