Skip to content

Commit

Permalink
Setting up jest configs
Browse files Browse the repository at this point in the history
  • Loading branch information
zourdyzou committed Jul 1, 2022
1 parent 27bf122 commit 84c44c6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
13 changes: 13 additions & 0 deletions test/helpers/userEventSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import realUserEvent from "@testing-library/user-event";

/**
* Setup user-event instance with custom defaults
*/
export function userEventSetup(
options: Parameters<typeof realUserEvent["setup"]>[0] = {}
): ReturnType<typeof realUserEvent["setup"]> {
return realUserEvent.setup({
advanceTimers: jest.advanceTimersByTime,
...options,
});
}
8 changes: 8 additions & 0 deletions test/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "@testing-library/jest-dom";
import "whatwg-fetch";

import { configure } from "@testing-library/react";

configure({
throwSuggestions: true,
});
12 changes: 12 additions & 0 deletions test/teardown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import path from "path";

export default function teardown(): void {
console.log(`
================================================================================
View Coverage Report (Open in Browser): ${path.relative(
process.cwd(),
path.join(__dirname, "../coverage/lcov-report/index.html")
)}
================================================================================
`);
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"importsNotUsedAsValues": "preserve",
"incremental": true
},
"include": ["src", "webpack"],
"include": ["src", "webpack", "test"],
"exclude": ["**/node_modules", "**/.*/"]
}

0 comments on commit 84c44c6

Please sign in to comment.