-
Notifications
You must be signed in to change notification settings - Fork 147
AVA requiring @std/esm does not work #197
Comments
Thanks @billyjanitsch! Our scenario test missed the const precompiled = opts.precompiled[filename];
if (precompiled) {
sourceMapCache.set(filename, path.join(cacheDir, `${precompiled}.js.map`));
return fs.readFileSync(path.join(cacheDir, `${precompiled}.js`), 'utf8');
} If It doesn't look like there is a way to disable this precompilation of ava at the moment. |
That's too bad. Thanks for looking into it, @jdalton. |
Ah, it's not that bad. I mean, packages using |
See avajs/ava#1618 |
Thank you @jamestalmage! |
Here is a minimal test repo using AVA and
@std/esm
. To reproduce the issue, runnpm install
thennpm test
.lib/
contains an ESM build.index.js
activates@std/esm
and re-exports the default export oflib/
. In package.json,module
points tolib/
, andmain
points toindex.js
with"@std/esm": "cjs"
for CJS compat. As I understand it, this is a standard setup.AVA is configured to require
@std/esm
, and to inherit the Babel config in.babelrc
to transpile its test files (which would be necessary, for instance, if the test files used JSX). This config does not transpile ESM -> CJS. However,npm test
fails:This suggests that
@std/esm
is not working correctly on the test file.If you remove the line which tells AVA to use
.babelrc
,npm test
passes because AVA falls back to its default Babel config which transpiles ESM -> CJS.The text was updated successfully, but these errors were encountered: