mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 18:01:40 -06:00
Toolkit: Fix Cannot use "import statement outside" error in tests (#57071)
This commit is contained in:
parent
ba6c715708
commit
fd0fcffc24
@ -30,6 +30,7 @@ const copyFiles = () => {
|
||||
'src/config/tsconfig.plugin.local.json',
|
||||
'src/config/eslint.plugin.js',
|
||||
'src/config/styles.mock.js',
|
||||
'src/config/jest.babel.config.js',
|
||||
'src/config/jest.plugin.config.local.js',
|
||||
'src/config/matchMedia.js',
|
||||
'src/config/react-inlinesvg.tsx',
|
||||
|
2
packages/grafana-toolkit/src/config/jest.babel.config.js
Normal file
2
packages/grafana-toolkit/src/config/jest.babel.config.js
Normal file
@ -0,0 +1,2 @@
|
||||
// Transform es modules to prevent `SyntaxError: Cannot use import statement outside a module`
|
||||
module.exports = { presets: [['@babel/preset-env', { targets: { esmodules: false, node: 'current' } }]] };
|
@ -83,7 +83,10 @@ export const jestConfig = (baseDir: string = process.cwd()) => {
|
||||
'<rootDir>/spec/**/*.{spec,test,jest}.{js,jsx,ts,tsx}',
|
||||
],
|
||||
transform: {
|
||||
'^.+\\.jsx?$': require.resolve('babel-jest'),
|
||||
'^.+\\.(js|jsx|mjs)$': [
|
||||
require.resolve('babel-jest'),
|
||||
{ configFile: path.resolve(__dirname, './jest.babel.config.js') },
|
||||
],
|
||||
'^.+\\.tsx?$': require.resolve('ts-jest'),
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
|
Loading…
Reference in New Issue
Block a user