-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: setup jest and react-testing-library (#196)
* feat: setup jest and react-testing-library * chore: import
- Loading branch information
1 parent
87e0506
commit 846b60f
Showing
6 changed files
with
2,454 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export default { | ||
preset: 'ts-jest', | ||
testEnvironment: 'jsdom', | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], | ||
moduleNameMapper: { | ||
// Handle CSS imports | ||
'\\.(css|less|scss|sass)$': 'identity-obj-proxy', | ||
// Handle path aliases | ||
'^~/(.*)$': '<rootDir>/v1/$1' | ||
}, | ||
testPathIgnorePatterns: ['/node_modules/', '/dist/'], | ||
collectCoverageFrom: [ | ||
'v1/**/*.{ts,tsx}', | ||
'!v1/**/*.d.ts', | ||
'!v1/**/index.{ts,tsx}' | ||
], | ||
coverageThreshold: { | ||
global: { | ||
branches: 80, | ||
functions: 80, | ||
lines: 80, | ||
statements: 80 | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@testing-library/jest-dom'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ReactElement } from 'react'; | ||
import { render as rtlRender, RenderOptions, RenderResult } from '@testing-library/react'; | ||
|
||
function render(ui: ReactElement, options: RenderOptions = {}): RenderResult { | ||
return rtlRender(ui, { | ||
wrapper: ({ children }) => children, | ||
...options, | ||
}); | ||
} | ||
|
||
export * from '@testing-library/react'; | ||
export { render }; |
Oops, something went wrong.