Skip to content

Commit

Permalink
Update dynamic import test with literal parse tree instead of dependi…
Browse files Browse the repository at this point in the history
…ng on espree having dynamic import support
  • Loading branch information
Munter committed Apr 7, 2019
1 parent 24d206d commit 83c058f
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions test/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,34 +320,37 @@ describe('import', function() {
});
});

describe.skip('dynamic import', function() {
it('expression pattern #1', function() {
const tree = espree(`import('rabbit-house')`, {
ecmaFeatures: {
modules: true
}
});
describe('dynamic import', function() {
it('expression pattern #1', function() {
// TODO: espree currently doesn't support dynamic imports. Update when it does
// const tree = espree(`import('rabbit-house')`, {
// ecmaFeatures: {
// modules: true
// }
// });

checkDump(Dumper.dump(tree), `
enter - Program
enter - ImportExpression
leave - Program
`);
});

it('expression pattern #1', function() {
const tree = espree(`import(\`module-\${foo}\`)`, {
ecmaFeatures: {
modules: true
}
});
const tree = {
type: 'CallExpression',
callee: {
type: 'Import'
},
arguments: [
{
type: 'Literal',
value: 'rabbit-house'
}
]
};

checkDump(Dumper.dump(tree), `
enter - Program
enter - ImportExpression
leave - Program
enter - CallExpression
enter - Import
leave - Import
enter - Literal
leave - Literal
leave - CallExpression
`);
});
});
});

describe('pattern', function() {
Expand Down

0 comments on commit 83c058f

Please sign in to comment.