Closed dsernst closed 4 years ago
Sorry you got bit by this. The third paragraph of the readme explains build/
, but maybe that's too far away from the sample configuration?
In other words, say you have a test file at src/test.ts. You've configured TypeScript to output to build/. Using @ava/typescript you can run the build/test.js file using npx ava src/test.ts. AVA won't pick up any of the JavaScript files present in the build/ directory, unless they have a TypeScript counterpart in src/.
(Emphasis mine)
https://github.com/avajs/typescript/issues/2 is open so that hopefully maybe we can determine this automatically.
My source files are organized like this:
My
tsconfig.json
looks like this:Which results in output like this
I installed
@ava/typescript
and addedrewritePaths
topackage.json
as instructed in this library's readme, like this:But then running
ava
ornpx ava src/tests/test-example.ts
or other variations kept resulting in fatal errors like:It took me a while to figure out what was going on.
Note that it's missing the
/src/
directory between/build/
and/tests/
.So after much tweaking, I was finally able to get it working with:
Maybe this is obvious, and I was just being stupid, but I'm putting this up here in part to help anyone else that comes across a similar issue.
version info:
@ava/typescript: 1.1.1 ava: 3.9.0 typescript: 3.9.5
node v12.16.3