Permalink
Browse files

support @std/esm (#1618)

* support @std/esm

* fix path test for windows

* fix linter error

* Stricter regex. Use shorthand .esmrc file in fixture.

* update package-lock.json
  • Loading branch information...
jamestalmage committed Jan 8, 2018
1 parent 29e5dfd commit 72c53bee0766a7e45595919f97f114073c93bff7
Showing with 35 additions and 1 deletion.
  1. +7 −1 lib/test-worker.js
  2. +6 −0 package-lock.json
  3. +1 −0 package.json
  4. +3 −0 test/fixture/std-esm/.esmrc
  5. +1 −0 test/fixture/std-esm/index.js
  6. +6 −0 test/fixture/std-esm/test.js
  7. +11 −0 test/fork.js
View
@@ -27,7 +27,13 @@ globals.options = opts;
const serializeError = require('./serialize-error');
(opts.require || []).forEach(x => require(x));
(opts.require || []).forEach(x => {
if (/[/\\]@std[/\\]esm[/\\]index\.js$/.test(x)) {
require = require(x)(module); // eslint-disable-line no-global-assign
} else {
require(x);
}
});
adapter.installSourceMapSupport();
adapter.installPrecompilerHook();
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -146,6 +146,7 @@
"update-notifier": "^2.3.0"
},
"devDependencies": {
"@std/esm": "^0.19.1",
"cli-table2": "^0.2.0",
"codecov": "^3.0.0",
"del": "^3.0.0",
@@ -0,0 +1,3 @@
{
"esm": "cjs"
}
@@ -0,0 +1 @@
export default 'foo';
@@ -0,0 +1,6 @@
import test from '../../../';
import m from '.';
test('works', t => {
t.is(m, 'foo');
});
View
@@ -135,6 +135,17 @@ test('babelrc is ignored', t => {
});
});
test('@std/esm support', t => {
return fork(fixture('std-esm/test.js'), {
require: [require.resolve('@std/esm')]
})
.run({})
.then(info => {
t.is(info.stats.passCount, 1);
t.end();
});
});
// TODO: Skipped until we can do this properly in #1455
test('color support is initialized correctly', t => {
t.plan(1);

2 comments on commit 72c53be

@BenSower

This comment has been minimized.

Show comment
Hide comment
@BenSower

BenSower Jan 30, 2018

This looks nice, is there any documentation on this, yet? From what I see, this just allows ava to use std-esm out of the box instead of having to add it to the dependencies manually, right?

BenSower replied Jan 30, 2018

This looks nice, is there any documentation on this, yet? From what I see, this just allows ava to use std-esm out of the box instead of having to add it to the dependencies manually, right?

@novemberborn

This comment has been minimized.

Show comment
Hide comment
@novemberborn

novemberborn Jan 30, 2018

Member

@BenSower you still need to add it to your package's dependencies.

Regarding documentation, there's a stalled PR (#1593, see #1590 for the issue). Perhaps you'd want to pick that up?

Member

novemberborn replied Jan 30, 2018

@BenSower you still need to add it to your package's dependencies.

Regarding documentation, there's a stalled PR (#1593, see #1590 for the issue). Perhaps you'd want to pick that up?

Please sign in to comment.