Skip to content

Commit

Permalink
Merge pull request #398 from CBIIT/dx-fix-silent-warnings
Browse files Browse the repository at this point in the history
Fix silent warnings allowing Jest to succeed
  • Loading branch information
Alejandro-Vega authored Jun 7, 2024
2 parents 5944336 + 68c14e9 commit 870a77b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"graphql": "^16.7.1",
"graphql-tag": "^2.12.6",
"jest-axe": "^8.0.0",
"jest-fail-on-console": "^3.3.0",
"lodash": "^4.17.21",
"notistack": "^3.0.1",
"papaparse": "^5.4.1",
Expand Down
10 changes: 10 additions & 0 deletions src/setupTests.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// eslint-disable-next-line max-classes-per-file
import "@testing-library/jest-dom";
import "jest-axe/extend-expect";
import failOnConsole from "jest-fail-on-console";

/**
* Mocks the enqueueSnackbar function from notistack for testing
Expand Down Expand Up @@ -58,3 +59,12 @@ jest.mock("recharts", () => ({
...jest.requireActual("recharts"),
ResponsiveContainer: MockResponsiveContainer,
}));

/**
* Prevents the console.error and console.warn from silently failing
* in tests by throwing an error when called
*/
failOnConsole({
shouldFailOnWarn: true,
shouldFailOnError: true,
});

0 comments on commit 870a77b

Please sign in to comment.