|
1 | 1 | import { defineConfig } from 'vitest/config'
|
2 | 2 |
|
| 3 | +import path from 'path' |
| 4 | +import { fileURLToPath } from 'url' |
| 5 | + |
| 6 | +// No __dirname under Node ESM |
| 7 | +const __filename = fileURLToPath(import.meta.url) |
| 8 | +const __dirname = path.dirname(__filename) |
| 9 | + |
3 | 10 | export default defineConfig({
|
4 | 11 | test: {
|
5 | 12 | globals: true,
|
6 | 13 | environment: 'jsdom',
|
7 | 14 | setupFiles: ['./vitest.setup.js'],
|
8 | 15 | include: ['./src/**/*.(spec|test).[jt]s?(x)'],
|
9 | 16 | alias: {
|
10 |
| - '@reduxjs/toolkit/query/react': './src/query/react/index.ts', // @remap-prod-remove-line |
11 |
| - '@reduxjs/toolkit/query': './src/query/index.ts', // @remap-prod-remove-line |
12 |
| - '@reduxjs/toolkit/react': './src/index.ts', // @remap-prod-remove-line |
13 |
| - '@reduxjs/toolkit': './src/index.ts', // @remap-prod-remove-line |
| 17 | + '@reduxjs/toolkit/query/react': path.join( |
| 18 | + __dirname, |
| 19 | + './src/query/react/index.ts' |
| 20 | + ), // @remap-prod-remove-line |
| 21 | + '@reduxjs/toolkit/query': path.join(__dirname, './src/query/index.ts'), // @remap-prod-remove-line |
| 22 | + '@reduxjs/toolkit/react': path.join(__dirname, './src/index.ts'), // @remap-prod-remove-line |
| 23 | + '@reduxjs/toolkit': path.join(__dirname, './src/index.ts'), // @remap-prod-remove-line |
14 | 24 |
|
15 | 25 | // 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
|
16 | 26 | //'^@reduxjs/toolkit/dist/(.*)$': '<rootDir>/src/*',
|
17 |
| - '@internal/': './src/', |
| 27 | + '@internal/': path.join(__dirname, './src/'), |
18 | 28 | },
|
19 | 29 | deps: {
|
20 | 30 | interopDefault: true,
|
|
0 commit comments