Add failing test.

This commit is contained in:
Jan Amann 2020-10-30 14:59:05 +01:00
parent 3df96f4a78
commit 21012d4327
3 changed files with 23 additions and 0 deletions

View File

@ -190,6 +190,25 @@ describe("Compiler", () => {
});
});
it("compiles top-level await to es5", done => {
compile(
"./topLevelAwait1",
{
target: ["web", "es5"],
experiments: {
topLevelAwait: true
}
},
(stats, files) => {
expect(Object.keys(files)).toEqual(["/main.js"]);
const bundle = files["/main.js"];
expect(bundle).not.toContain("await");
expect(bundle).not.toContain("async");
done();
}
);
});
describe("methods", () => {
let compiler;
beforeEach(() => {

3
test/fixtures/topLevelAwait1.js vendored Normal file
View File

@ -0,0 +1,3 @@
import value from './topLevelAwait2';
console.log(value);

1
test/fixtures/topLevelAwait2.js vendored Normal file
View File

@ -0,0 +1 @@
export default await Promise.resolve(1);