Jest GitHub Action annotation (#194)

Jest now supports a reporter which emits GitHub Actions annotations. So if a test fails, it should annotate your PR when you view it on GitHub. See their example at https://jestjs.io/docs/configuration#github-actions-reporter

Also, use typescript for the config file.
This commit is contained in:
Adam Chalmers
2023-07-26 14:44:54 -05:00
committed by GitHub
parent 0d010b60e5
commit 956e4c46c1
3 changed files with 19 additions and 16 deletions

View File

@ -13,4 +13,4 @@ jobs:
with:
node-version: '16.x'
- run: yarn install
- run: yarn prettier --check src
- run: yarn prettier --check src jest.config.ts

View File

@ -1,15 +0,0 @@
module.exports = {
testEnvironment: 'jsdom',
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
"^.+\\.(js|jsx)$": "babel-jest",
},
transformIgnorePatterns: [
"//node_modules/(?!(allotment|@tauri-apps/api)/)",
],
moduleNameMapper: {
'^allotment$': 'allotment/dist/legacy',
},
setupFilesAfterEnv: ['./src/setupTests.ts'],
}

18
jest.config.ts Normal file
View File

@ -0,0 +1,18 @@
import type { Config } from 'jest'
const config: Config = {
testEnvironment: 'jsdom',
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
'^.+\\.(js|jsx)$': 'babel-jest',
},
transformIgnorePatterns: ['//node_modules/(?!(allotment|@tauri-apps/api)/)'],
moduleNameMapper: {
'^allotment$': 'allotment/dist/legacy',
},
setupFilesAfterEnv: ['./src/setupTests.ts'],
reporters: [['github-actions', { silent: false }], 'summary'],
}
export default config