1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Test requestedModules property
function testRequestedModules(source, expected) {
var module = parseModule(source);
var actual = module.requestedModules;
assertEq(actual.length, expected.length);
for (var i = 0; i < actual.length; i++) {
assertEq(actual[i].moduleSpecifier, expected[i]);
}
}
testRequestedModules("", []);
testRequestedModules("import a from 'foo'",
['foo']);
testRequestedModules("import a from 'foo'; import b from 'bar'",
['foo', 'bar']);
testRequestedModules("import a from 'foo'; import b from 'bar'; import c from 'foo'",
['foo', 'bar']);
testRequestedModules("export {} from 'foo'",
['foo']);
testRequestedModules("export * from 'bar'",
['bar']);
testRequestedModules("import a from 'foo'; export {} from 'bar'; export * from 'baz'",
['foo', 'bar', 'baz']);
|