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

module-loader es is not treating my test files as es modules #118

Closed
mellson opened this issue Oct 20, 2021 · 3 comments
Closed

module-loader es is not treating my test files as es modules #118

mellson opened this issue Oct 20, 2021 · 3 comments
Labels
pta anything related to the "pta" package

Comments

@mellson
Copy link

mellson commented Oct 20, 2021

Is it correct that if I run pta with --module-loader es, it should treat the test files as es modules no matter the file name? My files have the .bs.js suffix because I need compatibility with other dependencies that only work with that suffix. If I manually rename the files to .mjs, it works. But it would be great if I could force pta to treat my files as es modules.

@lorenzofox3
Copy link
Owner

Is it correct that if I run pta with --module-loader es, it should treat the test files as es modules no matter the file name?

Not really, it just tells pta which zora singleton it should use (cjs, esm). Your package.json should still reflect the repository set up. If your files are effectively written in ESM, you'll have then to add type=module in your package.json.

You can refer to the test/samples for more details.

@mellson
Copy link
Author

mellson commented Oct 21, 2021

Thanks for the info. My problem is that I'm using some dependencies which does not play nice with .mjs or type=module. So I "only" need a way to force the test runner to accept that my files are indeed es modules. Currently I got it working by using onchange to rename the files from .bs.js to .mjs but it feels a bit hacky.

@lorenzofox3 lorenzofox3 added the pta anything related to the "pta" package label Jun 23, 2022
@lorenzofox3
Copy link
Owner

in favor of #155

@3cp 3cp mentioned this issue Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pta anything related to the "pta" package
Projects
None yet
Development

No branches or pull requests

2 participants