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
chore: migrate tests to TypeScript. #6075
Conversation
This CL migrates all the tests to TypeScript. The main benefits of this is that we start consuming our TypeScript definitions and therefore find errors in them. The act of migrating found some bugs in our definitions and now we can be sure to avoid them going forwards. You'll notice the addition of some `TODO`s in the code; I didn't want this CL to get any bigger than it already is but I intend to follow those up once this lands. It's mostly figuring out how to extend the `expect` types with our `toBeGolden` helpers and some other slight confusions with types that the tests exposed.
tsconfig.json
Outdated
}, | ||
"include": [ | ||
"src" | ||
"src", |
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 invalid JSON, but I guess tsc doesn't care?
test/assets/input/textarea.html
Outdated
@@ -8,8 +8,8 @@ | |||
<script src='mouse-helper.js'></script> | |||
<script> | |||
window.result = ''; | |||
let textarea = document.querySelector('textarea'); | |||
window.textarea = document.querySelector('textarea'); |
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.
Might as well use globalThis
here too, for consistency
test/assets/input/textarea.html
Outdated
@@ -8,8 +8,8 @@ | |||
<script src='mouse-helper.js'></script> | |||
<script> | |||
window.result = ''; |
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.
window.result = ''; | |
globalThis.result = ''; |
This CL migrates all the tests to TypeScript. The main benefits of this
is that we start consuming our TypeScript definitions and therefore find
errors in them. The act of migrating found some bugs in our definitions
and now we can be sure to avoid them going forwards.
You'll notice the addition of some
TODO
s in the code; I didn't wantthis CL to get any bigger than it already is but I intend to follow
those up once this lands. It's mostly figuring out how to extend the
expect
types with ourtoBeGolden
helpers and some other slightconfusions with types that the tests exposed.