GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix test-sync-io-option · nodejs/node@8676319

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-sync-io-option.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-sync-io-option.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-sync-io-option.js
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,26 @@ if (process.argv[2] === 'child') {
1515
var execArgv = [flags.pop()];
1616
var args = [__filename, 'child'];
1717
var child = spawn(process.execPath, execArgv.concat(args));
18-
var cntr = 0;
18+
var stderr = '';
1919

2020
child.stdout.on('data', function(chunk) {
2121
throw new Error('UNREACHABLE');
2222
});
2323

2424
child.stderr.on('data', function(chunk) {
25-
// Prints twice for --trace-sync-io. First for the require() and second
26-
// for the fs operation.
27-
if (/^WARNING[\s\S]*fs\.readFileSync/.test(chunk.toString()))
28-
cntr++;
25+
stderr += chunk.toString();
2926
});
3027

31-
child.on('exit', function() {
32-
if (execArgv[0] === '--trace-sync-io')
33-
assert.equal(cntr, 2);
34-
else if (execArgv[0] === ' ')
35-
assert.equal(cntr, 0);
28+
child.on('close', function() {
29+
var cntr1 = (stderr.match(/WARNING/g) || []).length;
30+
var cntr2 = (stderr.match(/fs\.readFileSync/g) || []).length;
31+
assert.equal(cntr1, cntr2);
32+
if (execArgv[0] === '--trace-sync-io') {
33+
// Prints 4 WARNINGS for --trace-sync-io. 1 for each sync call
34+
// inside readFileSync
35+
assert.equal(cntr1, 4);
36+
} else if (execArgv[0] === ' ')
37+
assert.equal(cntr1, 0);
3638
else
3739
throw new Error('UNREACHABLE');
3840

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.