0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/known_issues/test-stdout-buffer-flush-on-exit.js
Vse Mozhet Byt 945f208081 test: make the rest of tests path-independent
Permit spaces in paths to a Node.js executable and test scripts.

PR-URL: https://github.com/nodejs/node/pull/12972
Fixes: https://github.com/nodejs/node/issues/12773
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-05-14 16:05:48 +03:00

27 lines
799 B
JavaScript

'use strict';
// Refs: https://github.com/nodejs/node/issues/2148
require('../common');
const assert = require('assert');
const execSync = require('child_process').execSync;
const lineSeed = 'foo bar baz quux quuz aaa bbb ccc';
if (process.argv[2] === 'child') {
const longLine = lineSeed.repeat(parseInt(process.argv[4], 10));
process.on('exit', () => {
console.log(longLine);
});
process.exit();
}
[22, 21, 20, 19, 18, 17, 16, 16, 17, 18, 19, 20, 21, 22].forEach((exponent) => {
const bigNum = Math.pow(2, exponent);
const longLine = lineSeed.repeat(bigNum);
const cmd =
`"${process.execPath}" "${__filename}" child ${exponent} ${bigNum}`;
const stdout = execSync(cmd).toString().trim();
assert.strictEqual(stdout, longLine, `failed with exponent ${exponent}`);
});