Skip to content

Commit

Permalink
Add tests for chained reexports from a hybrid module (#7980)
Browse files Browse the repository at this point in the history
* Add test for chained reexports from a hybrid module

This captures a case where a CJS export is missing.

* Add test for reexports as default from a hybrid module

This captures a case where packaging fails
with `Asset was skipped or not found`.

* Use strict equality checks

* nit: match similar test terminology

Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
  • Loading branch information
lettertwo and mischnic committed May 10, 2022
1 parent e51955f commit e68beeb
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 0 deletions.
@@ -0,0 +1,3 @@
import b from './b';

output = b.foo + b.bar;
@@ -0,0 +1,2 @@
import * as c from './c';
export default c;
@@ -0,0 +1,2 @@
export foo from './d';
export const bar = require('./d');
@@ -0,0 +1 @@
module.exports = 1;
@@ -0,0 +1,3 @@
import {foo, bar} from './b';

output = foo + bar;
@@ -0,0 +1 @@
export * from './c';
@@ -0,0 +1,2 @@
export foo from './d';
export const bar = require('./d');
@@ -0,0 +1 @@
module.exports = 1;
22 changes: 22 additions & 0 deletions packages/core/integration-tests/test/scope-hoisting.js
Expand Up @@ -1997,6 +1997,28 @@ describe('scope hoisting', function () {
assert(new output[3]() instanceof output[2]);
});

it('should support chained reexports from hybrid modules', async function () {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/re-export-hybrid/a.js',
),
);
let output = await run(b);
assert.strictEqual(output, 2);
});

it('should support chained reexports as default from hybrid modules', async function () {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/re-export-default-hybrid/a.js',
),
);
let output = await run(b);
assert.strictEqual(output, 2);
});

it('support chained namespace reexports of CommonJS', async function () {
let b = await bundle(
path.join(
Expand Down

0 comments on commit e68beeb

Please sign in to comment.