mirror of
https://github.com/flarum/core.git
synced 2025-08-04 23:47:32 +02:00
feat(jest): create jest config package for unit testing (#3678)
* feat(jest): create jest config package for unit testing * chore: housekeeping * fix: now we need to explicitly allow importing without extension * fix: recover EditorDriverInterface import * Apply suggestions from code review * chore: yarn Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
22
js-packages/jest-config/index.cjs
Normal file
22
js-packages/jest-config/index.cjs
Normal file
@@ -0,0 +1,22 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = (options = {}) => ({
|
||||
testEnvironment: 'jsdom',
|
||||
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
||||
transform: {
|
||||
'^.+\\.[tj]sx?$': [
|
||||
'babel-jest',
|
||||
require('flarum-webpack-config/babel.config.js'),
|
||||
],
|
||||
'^.+\\.tsx?$': [
|
||||
'ts-jest',
|
||||
{
|
||||
useESM: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
preset: 'ts-jest',
|
||||
setupFilesAfterEnv: [path.resolve(__dirname, 'setup-env.js')],
|
||||
moduleDirectories: ['node_modules', 'src'],
|
||||
...options,
|
||||
});
|
Reference in New Issue
Block a user