Skip to content

Commit

Permalink
Fix flaky babel-cli test (#14535)
Browse files Browse the repository at this point in the history
* test: sort babel-cli log

* second

* 3

* 4

* 5

* 6

* use readline to punctuate input

Credits to @liuxingbaoyu

* revert

* Update packages/babel-cli/test/fixtures/babel/dir --out-dir --watch --verbose with external dependencies/executor.js
  • Loading branch information
JLHwung committed May 9, 2022
1 parent c6e68c7 commit 1d2e7e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs");
const assert = require("assert");
const readline = require("readline");

// For Node.js <= 10
if (!assert.match) assert.match = (val, re) => assert(re.test(val));
Expand Down Expand Up @@ -29,9 +30,9 @@ run.next();

const batchedStrings = [];
let batchId = 0;
const rl = readline.createInterface(process.stdin);

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

if (str.startsWith("src")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs");
const assert = require("assert");
const readline = require("readline");

// For Node.js <= 10
if (!assert.match) assert.match = (val, re) => assert(re.test(val));
Expand All @@ -20,8 +21,9 @@ const run = (async function* () {

run.next();

process.stdin.on("data", async function listener(chunk) {
const str = String(chunk).trim();
const rl = readline.createInterface(process.stdin);

rl.on("line", async function listener(str) {
if (!str) return;

console.log(str);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs");
const assert = require("assert");
const readline = require("readline");

// For Node.js <= 10
if (!assert.match) assert.match = (val, re) => assert(re.test(val));
Expand All @@ -21,8 +22,9 @@ const run = (async function* () {

run.next();

process.stdin.on("data", async function listener(chunk) {
const str = String(chunk).trim();
const rl = readline.createInterface(process.stdin);

rl.on("line", async function listener(str) {
if (!str) return;

console.log(str);
Expand Down

0 comments on commit 1d2e7e9

Please sign in to comment.