Closed petermetz closed 3 years ago
@petermetz could you elaborate on your proposed solution, with perhaps a sample directory layout, your desired rewrite paths configuration, and where you'd place this configuration?
@novemberborn Updated the description with the examples.
and where you'd place this configuration?
Same as before, this would be an extension to how the rewrite paths configuration parameter is working as of right now. I'm not proposing to add new configuration files nor would it need to change the schema of the existing configuration file.
OK so you have ava.config.js
next to packages/
? And you run AVA from that root directory, which then picks up the test files for each of the packages?
Currently the path rewriting is based on prefixes:
https://github.com/avajs/typescript/blob/27650db45b4807f14056bc142d6e46a8558fd372/index.js#L127
We'd have to figure out how to express and then rewrite glob-based prefixes. I'm not sure whether a solution for that is already available.
An alternate approach may be to use an ava.config.js
file that lists the directories inside packages/
and dynamically generates the rewrite configuration.
@novemberborn
OK so you have
ava.config.js
next topackages/
? And you run AVA from that root directory, which then picks up the test files for each of the packages?
Correct.
We'd have to figure out how to express and then rewrite glob-based prefixes. I'm not sure whether a solution for that is already available.
An alternate approach may be to use an ava.config.js file that lists the directories inside packages/ and dynamically generates the rewrite configuration.
Makes sense and thank you for the tip. For my case the dynamic config file approach is an easy enough solution that I can go with it so if no one else is interested in some out of the box convenience feature that does it fully automatically then I'd say maybe we can close this down. Thank you again for your help!
Please provide details about:
What you're trying to do Use ava/typescript in a monorepo
Why you can't use AVA's TypeScript support for this Need the compilation process when running/debugging tests to be identical to the build of the source code in general (no babel).
And maybe how you think AVA could handle this Add flexibility in the ava typescript rewrite path configurations to support relative paths (relative to the test case .ts files) so that each package's own build directory in the monorepo can be referenced without having to reference all of them one by one.
Directory structure:
Rewrite rule to capture all packages: