-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use @ava/typescript for testing #113
Conversation
The examples grow stale, and don't provide any real value for testing. Most of what is covered in the examples would better be covered in the documentation.
Typescript support for absolute imports by using paths and baseUrl is quite lacking, especially when it comes to support in tooling.
Cleans up the tsconfig files, and makes tsconfig.json be the main configuration, used for everything besides publish builds.
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.
Looks good, assuming that the imports are all correct.
"@types/sinon": "7.5.2", | ||
"ava": "3.5.0", | ||
"conditional-type-checks": "1.0.5", | ||
"coveralls": "3.0.9", |
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.
You're still referring to it in the circle config. Don't know if that's an oversight or...
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.
Done on purpose. We don't need coveralls
in our local repos. npx coveralls
will install it as needed in CI.
@@ -0,0 +1,4 @@ | |||
{ | |||
"extends": "./tsconfig.json", | |||
"exclude": ["src/**/*.tspec.ts", "src/**/*.spec.ts"] |
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.
Good idea 👍
@@ -1,6 +1,6 @@ | |||
{ | |||
"compilerOptions": { | |||
"target": "esnext", | |||
"target": "es2019", |
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.
Check that the coverage line numbers are correct with this setting (otherwise lowering the target might work). I seem to remember stumbling upon problems people have had in this regard.
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.
Did a quick test, and they seem to work as expected.
Sorry for the fixup party. Just trying to make the CI build as smooth as possible. Latest few fixups was to include coveralls in the cache. EDIT: turns out it might not be possible to cache packages run through |
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
- run: yarn install --frozen-lockfile |
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.
It might do the trick to avoid this change to do a yarn install --force
locally and commit the new lockfile. Also might be worth it to remove all the hats ^
from the package file to avoid "wrong" dependencies.
Sorry for being 🐌 to apply the orb.
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.
The reason I added --frozen-lockfile
is that it will fail the build if yarn.lock
and package.json
do not correspond.
We should remove the hats from all our normal and dev dependencies, but they should stay in the peer dependencies.
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.
See avajs/typescript#3 and avajs/typescript#12 for progress on ava also running the compilation. I'll go ahead and merge this since there have been no objections :) |
97f534a
to
ba06246
Compare
This build failure is a perfect example of why |
This commit also removes all version ranges from normal and dev dependencies and runs yarn install with --frozen-lockfile in CI and removes coveralls from the dev dependencies in favour of invoking it through npx.
ba06246
to
6e2d5f4
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 PR moves us away from
ts-node
andtsconfig-paths
in favour of using @ava/typescript for running our.spec.ts
tests. This should be a simpler and more robust setup.Some big changes had to be made along the way
examples
directory. It provides too little value to be worth maintaining. It's function should be fulfilled by our documentation (which is in need of updating)With this change, you need to run both
yarn watch
andyarn test:watch
in order to have live test running.It's probably best to review commit by commit.