Skip to content

Commit

Permalink
added jest.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlabaj committed Nov 22, 2024
1 parent 640909a commit e2e553f
Show file tree
Hide file tree
Showing 4 changed files with 260 additions and 9 deletions.
13 changes: 7 additions & 6 deletions jest.config.ts → jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type {Config} from 'jest';

const config: Config = {
const config = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
".ts": ["ts-jest", { tsconfig: "./tsconfig.jest.json" }]
},
roots: ['<rootDir>/src'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.jest.json' }],
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/node_modules/@patternfly/react-styles/__mocks__/styleMock.js'
},
};

export default config;
248 changes: 248 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"preview": "astro preview",
"astro": "astro",
"lint": "eslint . --cache --cache-strategy content",
"test": "echo \"Error: no test specified\"",
"test.jest": "jest",
"test": "jest",
"test:watch": "jest --watch"
},
"dependencies": {
Expand All @@ -31,6 +30,7 @@
"@types/node": "^22.9.1",
"globals": "^15.12.0",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript-eslint": "^8.15.0"
}
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react",
"target": "ES5",
"target": "ES6",
"module": "ESNext",
"moduleResolution": "node",
"importHelpers": true,
}
}

0 comments on commit e2e553f

Please sign in to comment.