generated from Dhaiwat10/react-library-starter
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test setup for monorepo and example test (#25)
* Add example test and setupTests.ts * Update package.json * Update package.json * Update Address.test.tsx
- Loading branch information
Erik Ritter
authored
Nov 29, 2021
1 parent
e08bfe4
commit e3f921e
Showing
10 changed files
with
161 additions
and
39 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
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,29 @@ | ||
module.exports = { | ||
preset: "ts-jest/presets/js-with-ts", | ||
testMatch: [ | ||
"<rootDir>/packages/*/src/**/__tests__/**/*.{js,jsx,ts,tsx}", | ||
"<rootDir>/packages/*/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}", | ||
], | ||
coveragePathIgnorePatterns: [ | ||
"/node_modules/", | ||
"dist/", | ||
"<rootDir>/packages/components/src/index.ts", | ||
"<rootDir>/packages/componentssrc/components/index.ts", | ||
], | ||
collectCoverageFrom: [ | ||
"<rootDir>/packages/*/src/**/*.{js,ts,tsx,jsx}", | ||
"!<rootDir>/packages/*/src/**/*.stories.*", | ||
], | ||
moduleNameMapper: { | ||
"\\.s?css$": "identity-obj-proxy", | ||
}, | ||
coverageThreshold: { | ||
global: { | ||
branches: 90, | ||
functions: 90, | ||
lines: 90, | ||
statements: 90, | ||
}, | ||
}, | ||
setupFilesAfterEnv: ["<rootDir>/utils/setupTests.ts"], | ||
}; |
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 was deleted.
Oops, something went wrong.
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
11 changes: 11 additions & 0 deletions
11
packages/components/src/components/Address/Address.test.tsx
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,11 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { Address } from './Address'; | ||
|
||
describe('Address', () => { | ||
it('renders without throwing', () => { | ||
const { container } = render(<Address value="taylorswift.eth" />); | ||
expect(container).toBeInTheDocument(); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -19,5 +19,5 @@ | |
"target": "es5" | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["./src"] | ||
"include": ["./packages/*/src"] | ||
} |
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