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

Frontend/chore/typecheck unit tests #1062

Closed

Conversation

thdk
Copy link
Member

@thdk thdk commented Apr 11, 2021

Fixed the typescript errors in tests and changed the test-ciscript so that CI pipeling fails if tests have typescript errors.

This PR has no affect when running yarn test locally.

Adding tsc to the test script as suggested in facebook/create-react-app#5626 will not fully work with react-scripts test and might cause frustration if you have to wait for the entire source code to be typechecked by tsc when you just want to run a single test. Also it would only run tsc a single time. If no typescript errors have been detected, jest will start in watch mode. Meaning that typescript errors added while test script is already running (and watching for file changes) will still go unnoticed.

I've added tsc as stand alone script so developers can run it locally with yarn tsc as a temporary help to check all files for typescript errors.

#851

Note that I didn't want to add it to "test" script (like I've done with the "test-ci" script) since it would only run tsc the first. When no typescript errors are found, jest will start in watch mode. This means that ff you would cause new typescript errors after the initial "yarn test" they would go unnoticed.

I'm not sure if there is a nice way at the moment to use 'react-scripts test' and have tests fail if they contain typescript errors. 'ts-jest' is an alternative which does do typechecking for tests. However I'm uncertain if that's what we want to use.
This allows to run tsc locally using typescript version from node_modules folder.
@thdk thdk marked this pull request as ready for review April 11, 2021 18:05
@aapeliv aapeliv added the web label Apr 11, 2021
@thdk thdk closed this Apr 16, 2021
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

2 participants