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

Function runTests

test/parallel/test-fastutf8stream-flush-sync.js:31–47  ·  view source on GitHub ↗
(sync)

Source from the content-addressed store, hash-verified

29runTests(true);
30
31function runTests(sync) {
32 const dest = getTempFile();
33 const fd = openSync(dest, 'w');
34 const stream = new Utf8Stream({ fd, minLength: 4096, sync });
35
36 assert.ok(stream.write('hello world\n'));
37 assert.ok(stream.write('something else\n'));
38
39 stream.flushSync();
40
41 setImmediate(common.mustCall(() => {
42 stream.end();
43 const data = readFileSync(dest, 'utf8');
44 assert.strictEqual(data, 'hello world\nsomething else\n');
45 stream.on('close', common.mustCall());
46 }));
47}
48
49{
50 const dest = getTempFile();

Calls 9

writeMethod · 0.95
flushSyncMethod · 0.95
endMethod · 0.95
getTempFileFunction · 0.70
openSyncFunction · 0.70
setImmediateFunction · 0.50
readFileSyncFunction · 0.50
okMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…