Skip to content

Commit 0963d7f

Browse files
committed
chore: fix test run
1 parent bc65cad commit 0963d7f

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

opensearch/jest.config.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,21 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
import { readFileSync } from 'fs';
15-
import { resolve, dirname } from 'path';
16-
import { fileURLToPath } from 'url';
1714
import type { Config } from '@jest/types';
18-
19-
const here = dirname(fileURLToPath(import.meta.url));
20-
const swcrc = JSON.parse(readFileSync(resolve(here, '../.cjs.swcrc'), 'utf-8'));
15+
import shared from '../jest.shared';
2116

2217
const jestConfig: Config.InitialOptions = {
23-
testEnvironment: 'jsdom',
24-
roots: ['<rootDir>/src'],
18+
...shared,
19+
2520
moduleNameMapper: {
26-
'^echarts/(.*)$': 'echarts',
27-
'^use-resize-observer$': 'use-resize-observer/polyfilled',
28-
'\\.(css|less)$': '<rootDir>/../stylesMock.js',
21+
...(shared.moduleNameMapper ?? {}),
2922
'^react$': '<rootDir>/../node_modules/react',
3023
'^react-dom$': '<rootDir>/../node_modules/react-dom',
3124
'^react/jsx-runtime$': '<rootDir>/../node_modules/react/jsx-runtime',
3225
'^react-dom/(.*)$': '<rootDir>/../node_modules/react-dom/$1',
3326
},
34-
transformIgnorePatterns: ['node_modules/(?!(lodash-es|yaml))'],
35-
transform: {
36-
'^.+\\.(ts|tsx|js|jsx)$': ['@swc/jest', { ...swcrc, exclude: [], swcrc: false }],
37-
},
38-
setupFilesAfterEnv: ['<rootDir>/src/setup-tests.ts'],
27+
28+
setupFilesAfterEnv: [...(shared.setupFilesAfterEnv ?? []), '<rootDir>/src/setup-tests.ts'],
3929
};
4030

4131
export default jestConfig;

0 commit comments

Comments
 (0)