1
- const path = require ( 'path' ) ;
2
- const resolve = require ( './resolve' ) ;
1
+ import path from 'node:path' ;
2
+ import { fileURLToPath } from 'node:url' ;
3
+ import resolve from './resolve.json' with { type : 'json' } ;
3
4
4
5
// For a detailed explanation regarding each configuration property, visit:
5
6
// https://jestjs.io/docs/en/configuration.html
6
7
8
+ const dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
7
9
const assetFilesModuleNameMapper = {
8
10
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$' :
9
- path . resolve ( __dirname , 'jest.fileMock.js' ) ,
10
- '.*\\.(css|less|scss|sass)$' : path . resolve ( __dirname , 'jest.fileMock.js' ) ,
11
+ path . resolve ( dirname , 'jest.fileMock.js' ) ,
12
+ '.*\\.(css|less|scss|sass)$' : path . resolve ( dirname , 'jest.fileMock.js' ) ,
11
13
} ;
12
14
const coveragePathIgnorePatterns = [
13
15
'/node_modules/' ,
14
16
'<rootDir>/([^/]*)\\.config\\.(js|mjs|cjs|ts)' ,
15
17
] ;
16
18
17
19
/** @type {import('jest').Config } */
18
- module . exports = {
20
+ export default {
19
21
coverageDirectory : './.coverage/unit' ,
20
22
projects : [
21
23
{
@@ -30,7 +32,7 @@ module.exports = {
30
32
...resolve . paths . jest . moduleNameMapper ,
31
33
} ,
32
34
testPathIgnorePatterns : [ '/node_modules/' ] ,
33
- setupFilesAfterEnv : [ path . resolve ( __dirname , './jest.setup.node.js' ) ] ,
35
+ setupFilesAfterEnv : [ path . resolve ( dirname , './jest.setup.node.js' ) ] ,
34
36
coveragePathIgnorePatterns,
35
37
} ,
36
38
{
@@ -45,7 +47,7 @@ module.exports = {
45
47
...resolve . paths . jest . moduleNameMapper ,
46
48
} ,
47
49
testPathIgnorePatterns : [ '/node_modules/' ] ,
48
- setupFilesAfterEnv : [ path . resolve ( __dirname , './jest.setup.jsdom.js' ) ] ,
50
+ setupFilesAfterEnv : [ path . resolve ( dirname , './jest.setup.jsdom.js' ) ] ,
49
51
coveragePathIgnorePatterns,
50
52
} ,
51
53
] ,
0 commit comments