Skip to content

Commit

Permalink
fix: wait 200ms for watcher setup
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Feb 18, 2022
1 parent 85fd940 commit f162e71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -4,9 +4,11 @@ const assert = require("assert");
// For Node.js <= 10
if (!assert.match) assert.match = (val, re) => assert(re.test(val));

const run = (function* () {
const run = (async function* () {
assert.match(yield, /Successfully compiled 4 files with Babel \(\d+ms\)\./);

// wait 200ms for watcher setup
await new Promise(resolve => setTimeout(resolve, 200));
// update ./module1/src/index.js
fs.writeFileSync(
"./module1/src/index.js",
Expand All @@ -18,13 +20,13 @@ const run = (function* () {

run.next();

process.stdin.on("data", function listener(chunk) {
process.stdin.on("data", async function listener(chunk) {
const str = String(chunk).trim();
if (!str) return;

console.log(str);

if (run.next(str).done) {
if ((await run.next(str)).done) {
process.exit(0);
}
});
Expand Down
Expand Up @@ -2,5 +2,5 @@
"args": ["*/src", "--out-dir", "../lib", "--relative", "--watch"],
"noBabelrc": true,
"noDefaultPlugins": true,
"minNodeVersion": 8
"minNodeVersion": 10
}

0 comments on commit f162e71

Please sign in to comment.