-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add jest dom dependency #220
Conversation
|
||
// type-only import, because in runtime it tries to access Jest globals, which do not exist | ||
/// <reference types="@testing-library/jest-dom" /> | ||
import matchers from "@testing-library/jest-dom/matchers"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followed example setup from this thread: testing-library/jest-dom#439
@@ -11,5 +11,5 @@ | |||
"experimentalDecorators": true, | |||
"tsBuildInfoFile": "../../.cache/test-utils.tsbuildinfo" | |||
}, | |||
"include": ["./", "../../types"] | |||
"include": ["./", "./types"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created separate *.selectors.js
type declarations for test-utils folder, because there is a difference between "module": "CommonJS"
(used for compilation) and "module": "ESNext",
(used in tests)
import { ScreenshotPageObject } from "@cloudscape-design/browser-test-tools/page-objects"; | ||
import { expect, test } from "vitest"; | ||
import { routes } from "../../pages/pages"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed import across sub-projects to prevent e2e tests importing pages code in tests scope
@@ -5,7 +5,7 @@ | |||
"target": "ES2019", | |||
"jsx": "react-jsx", | |||
"types": [], | |||
"lib": ["es2019", "dom"], | |||
"lib": ["es2019", "dom", "dom.iterable"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To support [...document.querySelector()]
pattern, which we use a lot in the tests. This works in all our supported browsers
}, | ||
"include": ["types", "**/*.test.tsx"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Because *.ts
was missing here, all such tests were not checked. It is recommended to put just folder paths (supported extensions will be added automatically)
616b5ae
to
b37eeb5
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #220 +/- ##
=======================================
Coverage 93.96% 93.97%
=======================================
Files 15 16 +1
Lines 729 730 +1
Branches 178 178
=======================================
+ Hits 685 686 +1
Misses 38 38
Partials 6 6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
b37eeb5
to
033d573
Compare
|
||
export const pages = Object.keys(pagesRaw).map(getPage); | ||
export const routes = pages.map(getRoute); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is e2e-only export, extracted separately now
033d573
to
043c3b5
Compare
043c3b5
to
74a8a99
Compare
74a8a99
to
0406fbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is missing the copyright banner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is missing the copyright banner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are JSON files, so adding comments is not possible there.
This is a known exception, same treatment can be found in the main repo: https://github.com/cloudscape-design/components/blob/main/tsconfig.json
Description
I am planning some refactoring in #219 and this needs better assertions in tests.
Also I found that our previous tsconfig ignored
*.test.ts
files, so fixed this and all new discovered type errorsRelated links, issue #, if available: n/a
How has this been tested?
PR build
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.