Skip to content

Commit

Permalink
chore: fix babel/jest configs
Browse files Browse the repository at this point in the history
Signed-off-by: Machiko Yasuda <[email protected]>
  • Loading branch information
Machiko Yasuda committed Jul 26, 2019
1 parent 472a5b1 commit 2a46669
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module.exports = function (api) {
ignore = [
"**/*.test.js",
"__snapshots__",
"**/setupTests.js",
"**/tests",
"**/scripts"
];
Expand Down
1 change: 1 addition & 0 deletions config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = {
appSrc: resolveApp('src'),
tests: resolveApp('src/tests/index.js'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveApp('src/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json')),
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
"<rootDir>/config/polyfills.js"
],
"setupFilesAfterEnv": [
"react-testing-library/cleanup-after-each",
"jest-dom/extend-expect"
"<rootDir>/package/src/setupTests.js"
],
"testPathIgnorePatterns": [
"<rootDir>/config/",
Expand Down
1 change: 1 addition & 0 deletions package/src/components/Button/Button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ test("error button snapshot", () => {

test("isWaiting button snapshot", () => {
const { asFragment } = render(<Button className="myBtn" isWaiting>Upload</Button>);
expect(asFragment()).toBeDisabled();
expect(asFragment()).toMatchSnapshot();
});
1 change: 1 addition & 0 deletions package/src/components/ConfirmDialog/ConfirmDialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test("basic snapshot - with opening the dialog", () => {
)}
</ConfirmDialog>);
fireEvent.click(getByText("Open Confirm Dialog"));
expect(getByRole("dialog")).toBeInTheDocument();
expect(getByRole("dialog")).toHaveTextContent("Are you sure you want to do that?");
expect(getByRole("dialog")).toHaveTextContent("Are you sure?");
expect(getByRole("dialog")).toHaveTextContent("OK");
Expand Down
5 changes: 5 additions & 0 deletions package/src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// add some helpful assertions
import "@testing-library/jest-dom/extend-expect";

// this is basically: afterEach(cleanup)
import "@testing-library/react/cleanup-after-each";

0 comments on commit 2a46669

Please sign in to comment.