Skip to content

Commit fd1742b

Browse files
committed
add regression test
1 parent 40cc7af commit fd1742b

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

test/esm.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,33 @@ describe('ESM', function() {
6060
}
6161
});
6262

63+
it('prints the task list (top-level await)', function(done) {
64+
if (shouldSkip()) {
65+
this.skip();
66+
}
67+
68+
var options = '--tasks --sort-tasks --gulpfile ./test/fixtures/gulpfiles/gulpfile-tla.mjs';
69+
var trailingLines = 1;
70+
if (!semver.satisfies(process.version, '^12.17.0 || >=13.2.0')) {
71+
options += ' --experimental-modules';
72+
trailingLines += 2;
73+
}
74+
75+
var opts = { cwd: baseDir };
76+
exec(gulp(options), opts, cb);
77+
78+
function cb(err, stdout, stderr) {
79+
expect(err).toBeNull();
80+
if (!semver.satisfies(process.version, '^12.20.0 || >=13.14.0')) {
81+
expect(stderr).toMatch('ExperimentalWarning: The ESM module loader is experimental.\n');
82+
} else {
83+
expect(stderr).toEqual('');
84+
}
85+
var filepath = path.join(expectedDir, 'esm.txt');
86+
var expected = fs.readFileSync(filepath, 'utf-8');
87+
expect(sliceLines(stdout, trailingLines)).toEqual(expected);
88+
done(err);
89+
}
90+
});
91+
6392
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const dynamicNoop = await Promise.resolve(function noop(cb) {
2+
cb();
3+
});
4+
5+
export const registered = dynamicNoop;
6+
export function exported(){};
7+
export const string = 'no function';

0 commit comments

Comments
 (0)