updated the test
This commit is contained in:
40
jest.config.cjs
Normal file
40
jest.config.cjs
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Jest for the Doormile console.
|
||||
*
|
||||
* Babel is configured INLINE rather than through a babel.config file at the
|
||||
* repo root on purpose: @vitejs/plugin-react picks up root Babel config, so a
|
||||
* babel.config.cjs added for tests would silently change how production
|
||||
* bundles are compiled. Test tooling must not be able to move the build.
|
||||
*/
|
||||
const babelOptions = {
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
presets: [
|
||||
['@babel/preset-env', { targets: { node: 'current' } }],
|
||||
['@babel/preset-react', { runtime: 'automatic' }],
|
||||
],
|
||||
plugins: [require.resolve('./tests/setup/babel-plugin-import-meta.cjs')],
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
testEnvironment: 'jsdom',
|
||||
roots: ['<rootDir>/tests'],
|
||||
testMatch: ['**/*.test.js', '**/*.test.jsx'],
|
||||
setupFilesAfterEnv: ['<rootDir>/tests/setup/jest.setup.cjs'],
|
||||
clearMocks: true,
|
||||
restoreMocks: true,
|
||||
transform: {
|
||||
'^.+\.[jt]sx?$': ['babel-jest', babelOptions],
|
||||
},
|
||||
moduleNameMapper: {
|
||||
'\.(css|less|scss|sass)$': '<rootDir>/tests/setup/styleMock.cjs',
|
||||
'\.(png|jpe?g|gif|svg|webp|woff2?|ttf|eot)$': '<rootDir>/tests/setup/fileMock.cjs',
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
},
|
||||
collectCoverageFrom: [
|
||||
'src/api/doormile/**/*.js',
|
||||
'src/lib/**/*.js',
|
||||
'src/utils/**/*.js',
|
||||
'!src/**/*.md',
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user