Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Nov 19, 2022
1 parent 711ae18 commit 391c1a9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { v } from "./library/a.js";

import * as y from "./library/a.js";

output = [v, sideEffectNoop(y).v];
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./b.js";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {v} from "./c.js";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const v = 123;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"sideEffects": false
}
11 changes: 11 additions & 0 deletions packages/core/integration-tests/test/scope-hoisting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2224,6 +2224,17 @@ describe('scope hoisting', function () {
]);
});

it('should correctly retarget dependencies when both namespace and indvidual export are used', async function () {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/retarget-namespace-single/index.js',
),
);
let output = await run(b);
assert.deepEqual(output, [123, 123]);
});

it('should correctly handle circular dependencies', async function () {
let b = await bundle(
path.join(__dirname, '/integration/scope-hoisting/es6/circular/a.mjs'),
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test-utils/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export async function runBundles(

// A utility to prevent optimizers from removing side-effect-free code needed for testing
// $FlowFixMe[prop-missing]
ctx.sideEffectNoop = () => {};
ctx.sideEffectNoop = v => v;

vm.createContext(ctx);
let esmOutput;
Expand Down

0 comments on commit 391c1a9

Please sign in to comment.