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

Make dependency tracking work with ESM imports #2388

Closed
novemberborn opened this issue Feb 2, 2020 · 4 comments
Closed

Make dependency tracking work with ESM imports #2388

novemberborn opened this issue Feb 2, 2020 · 4 comments
Assignees
Projects

Comments

@novemberborn
Copy link
Member

AVA's watch mode tracks which source files are loaded by which test files. This way it knows which test files to re-run. This is based on instrumenting the require code in Node.js. We won't be able to track ESM dependencies using this method.

We'll have to find a different way of resolving dependencies. Perhaps by analyzing the imports of test files. We'll have to allow our Babel and TypeScript providers to participate in this.

I think maybe Jest's haste map does something similar, but it's not documented.

@iambumblehead
Copy link

feel free to ignore me, --I'd like to mention this package I released and use https://www.npmjs.com/package/resolvewithplus

perhaps you could use this package or something like it. It was originally written for CJS modules but successfully resolves MJS modules as well.

// returns the full path to the 'main' koa file following CJS rules
resolvewithplus('koa', '/Users/bumble/resolvewith/test/', { esm : true });

the single-file used by the package https://github.com/iambumblehead/resolvewithplus/blob/master/src/resolvewithplus.js

@razor-x

This comment was marked as off-topic.

@novemberborn novemberborn self-assigned this Oct 23, 2022
@novemberborn novemberborn linked a pull request Oct 23, 2022 that will close this issue
5 tasks
@novemberborn
Copy link
Member Author

Looking to tackle with #3123.

ESM support automation moved this from To do to Done Jul 3, 2023
@novemberborn
Copy link
Member Author

Done in #3218.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
ESM support
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants
@novemberborn @razor-x @iambumblehead and others