Skip to content

Commit

Permalink
chore: use swc jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Apr 9, 2024
1 parent 873025b commit dfcf880
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 35 deletions.
20 changes: 1 addition & 19 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
// module.exports = {

// preset: "ts-jest",
// collectCoverage: false,
// collectCoverageFrom: [
// "packages/layout/src/**/*.{ts,js}",
// "!**/node_modules/**",
// "!**/vendor/**",
// ],

/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
testEnvironment: 'jsdom',
testRegex: '__tests__/.*test\\.ts?$',
Expand All @@ -19,13 +8,6 @@ module.exports = {
'@antv/layout/(.*)': '<rootDir>/src/$1',
},
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
diagnostics: false,
},
],
'^.+\\.tsx?$': ['@swc/jest'],
},
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@changesets/cli": "^2.27.1",
"@swc/core": "^1.4.12",
"@swc/jest": "^0.2.36",
"@types/jest": "latest",
"babel-jest": "29.7.0",
"babel-loader": "^8.3.0",
Expand All @@ -74,7 +76,6 @@
"prettier-plugin-organize-imports": "^3.2.4",
"rimraf": "^3.0.2",
"seedrandom": "^3.0.5",
"ts-jest": "^29.1.2",
"ts-loader": "^8.4.0",
"typescript": "^4.9.5",
"vite": "^4.5.2"
Expand Down
17 changes: 2 additions & 15 deletions packages/layout/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
module.exports = {
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.[tj]s$': [
'ts-jest',
{
diagnostics: {
exclude: ['**'],
},
tsconfig: {
allowJs: true,
target: 'esnext',
esModuleInterop: true,
},
},
],
'^.+\\.[tj]s$': ['@swc/jest'],
},
collectCoverageFrom: ['src/**/*.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
collectCoverage: false,
testRegex: '(/__tests__/.*\\.(test|spec))\\.(ts|tsx|js)$',
transformIgnorePatterns: ['/node_modules/(?!(d3.*)/)'],
transformIgnorePatterns: ['node_modules/(?!(?:.pnpm/)?(d3.*))'],
testPathIgnorePatterns: ['/(lib|esm)/__tests__/'],
};

0 comments on commit dfcf880

Please sign in to comment.