Skip to content

Commit

Permalink
Add test for renaming swc inserted vars
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed May 10, 2022
1 parent b24752f commit c5cfd7e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
@@ -0,0 +1,4 @@
import {B} from './b.js';
import {C} from './c.js';

output = [new B()[Symbol.toStringTag], new C()[Symbol.toStringTag]];
@@ -0,0 +1,5 @@
export class B {
get [Symbol.toStringTag]() {
return '1';
}
}
@@ -0,0 +1,5 @@
export class C {
get [Symbol.toStringTag]() {
return '2';
}
}
@@ -0,0 +1,3 @@
{
"browserslist": "Chrome 50"
}
17 changes: 17 additions & 0 deletions packages/core/integration-tests/test/scope-hoisting.js
Expand Up @@ -169,6 +169,23 @@ describe('scope hoisting', function () {
assert.equal(output, 2);
});

it('supports renaming helpers inserted during transpiling', async function () {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/rename-helpers/a.js',
),
);
let contents = await outputFS.readFile(
b.getBundles()[0].filePath,
'utf8',
);
assert(/let \S* = Symbol.toStringTag;/.test(contents));

let output = await run(b);
assert.deepEqual(output, ['1', '2']);
});

it('supports renaming imports', async function () {
let b = await bundle(
path.join(
Expand Down

0 comments on commit c5cfd7e

Please sign in to comment.