Skip to content
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

Merged
merged 3 commits into from Jun 23, 2020
Merged

chore: migrate tests to TypeScript. #6075

merged 3 commits into from Jun 23, 2020

Conversation

jackfranklin
Copy link
Collaborator

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 TODOs 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.

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",
Copy link
Member

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?

tsconfig.json Outdated Show resolved Hide resolved
@@ -8,8 +8,8 @@
<script src='mouse-helper.js'></script>
<script>
window.result = '';
let textarea = document.querySelector('textarea');
window.textarea = document.querySelector('textarea');
Copy link
Member

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

@@ -8,8 +8,8 @@
<script src='mouse-helper.js'></script>
<script>
window.result = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
window.result = '';
globalThis.result = '';

@mathiasbynens mathiasbynens merged commit 28797de into main Jun 23, 2020
@mathiasbynens mathiasbynens deleted the ts-tests branch June 23, 2020 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants