question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TS] Migrate tests to .tsx

See original GitHub issue

Overview and Motivation

This is a ticket to aid the migration of *.js tests to *.tsx. The general motivation here is to improve TypeScript support in Grommet so that when type checks fail, so do unit tests. For more details about why and how we are doing this, please refer to the related Issues and PRs below.

Related Issues and PRs

Addition of TS unit testing support:

Contributing

Since we have close to 75 components now and the tests for each range from simple to quite complex, It makes sense to migrate a single component at a time to *.tsx files, taking a test-driven development (TDD) approach.

  • Pick a single component at a time to work on test migrations for.
  • Create a draft PR while you work on the components tests. Mention this issue in the PR to make sure multiple people don’t double up on a single component.
  • Rename the tests for that component from *-test.js to *-test.tsx
  • Rename the *-test.js.snap files for that component to *-test.tsx.snap
  • Run the test suite for that component with yarn test. No test snapshots should fail, but some tests might fail due to type check failures.
  • If migrating tests causes only a few Typescript errors (e.g. missing field on prop types), feel free to fix those issues in the same PR as the test migration including the test failure and an explanation about how the changes fix the test failure. If there are a lot of new errors, create separate issues for each error and fix them in a separate PR. Update the test migration branch with these changes until the tests pass.

Roadmap

Test migration completed for:

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexmirringtoncommented, Oct 23, 2021

@haysclark I updated it on Wednesday but everyone’s been getting their PRs in for Hacktoberfest since then by the looks of it! Can’t believe we’re over halfway done already! Cheers @jcfilben for updating the ticket 😃

1reaction
jcfilbencommented, Sep 21, 2021

I am leaning towards just keeping tests under the parent component

Read more comments on GitHub >

github_iconTop Results From Across the Web

ts-migrate: A Tool for Migrating to TypeScript at Scale - Medium
To be able to iterate quickly and prevent regressions, we added a series of unit tests for each plugin and ts-migrate.
Read more >
Introduce TypeScript to react(js) project with ts-migrate - DEV ...
Introduce TypeScript to react(js) project with ts-migrate · Create a new branch · Install ts-migrate · Run ts-migrate · Install typescript and @ ......
Read more >
Documentation - Migrating from JavaScript - TypeScript
During our JS to TS migration, we'll need to separate our input files to prevent TypeScript from overwriting them. If your output files...
Read more >
"Automatically Migrating to TypeScript with ts ... - YouTube
(Evan Shaw) Learn about ts - migrate, an open source tool to automate the process of converting a JavaScript code base to TypeScript....
Read more >
10 Strategies for migrating to TypeScript - Exploring JS
For large projects, there may be too many TypeScript errors during migration. Then snapshot tests can help us find fixed errors and new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found