MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

test/parallel/test-stdout-to-file.js:15–38  ·  view source on GitHub ↗
(size, useBuffer, cb)

Source from the content-addressed store, hash-verified

13tmpdir.refresh();
14
15function test(size, useBuffer, cb) {
16 try {
17 fs.unlinkSync(tmpFile);
18 } catch {
19 // Continue regardless of error.
20 }
21
22 console.log(`${size} chars to ${tmpFile}...`);
23
24 childProcess.exec(...common.escapePOSIXShell`"${
25 process.execPath}" "${useBuffer ? scriptBuffer : scriptString}" ${size} > "${tmpFile
26 }"`, common.mustSucceed(() => {
27 console.log('done!');
28
29 const stat = fs.statSync(tmpFile);
30
31 console.log(`${tmpFile} has ${stat.size} bytes`);
32
33 assert.strictEqual(size, stat.size);
34 fs.unlinkSync(tmpFile);
35
36 cb();
37 }));
38}
39
40test(1024 * 1024, false, common.mustCall(function() {
41 console.log('Done printing with string');

Callers 1

Calls 5

cbFunction · 0.70
unlinkSyncMethod · 0.45
logMethod · 0.45
execMethod · 0.45
statSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…