Skip to content

Commit db63efe

Browse files
committed
Fix path aliasing issues in vitest.config.mts
1 parent 85a38cf commit db63efe

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

vitest.config.mts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
import { defineConfig } from 'vitest/config'
22

3+
import path from 'node:path'
4+
import { fileURLToPath } from 'node:url'
5+
6+
// No __dirname under Node ESM
7+
const __filename = fileURLToPath(import.meta.url)
8+
const __dirname = path.dirname(__filename)
9+
310
export default defineConfig({
411
test: {
512
globals: true,
613
include: ['./test/**/*.(spec|test).[jt]s?(x)'],
714
alias: {
8-
redux: './src/index.ts', // @remap-prod-remove-line
15+
redux: path.join(__dirname, './src/index.ts'), // @remap-prod-remove-line
916

1017
// 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
11-
'@internal/': './src/'
18+
'@internal': path.join(__dirname, 'src')
1219
}
1320
}
1421
})

0 commit comments

Comments
 (0)