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

Function doTest

test/parallel/test-fs-promises.js:120–516  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118
119{
120 async function doTest() {
121 tmpdir.refresh();
122
123 const dest = path.resolve(tmpDir, 'baz.js');
124
125 // handle is object
126 {
127 await executeOnHandle(dest, common.mustCall(async (handle) => {
128 assert.strictEqual(typeof handle, 'object');
129 }));
130 }
131
132 // file stats
133 {
134 await executeOnHandle(dest, common.mustCall(async (handle) => {
135 let stats = await handle.stat();
136 verifyStatObject(stats);
137 assert.strictEqual(stats.size, 35);
138
139 await handle.truncate(1);
140
141 stats = await handle.stat();
142 verifyStatObject(stats);
143 assert.strictEqual(stats.size, 1);
144
145 stats = await stat(dest);
146 verifyStatObject(stats);
147
148 stats = await handle.stat();
149 verifyStatObject(stats);
150
151 await handle.datasync();
152 await handle.sync();
153 }));
154 }
155
156 // File stats throwIfNoEntry: false
157 {
158 const stats = await stat('meow.js', { throwIfNoEntry: false });
159 assert.strictEqual(stats, undefined);
160 }
161
162 // File system stats
163 {
164 const statFs = await statfs(dest);
165 verifyStatFsObject(statFs);
166 }
167
168 // File system stats bigint
169 {
170 const statFs = await statfs(dest, { bigint: true });
171 verifyStatFsObject(statFs, true);
172 }
173
174 // Test fs.read promises when length to read is zero bytes
175 {
176 const dest = path.resolve(tmpDir, 'test1.js');
177 await executeOnHandle(dest, common.mustCall(async (handle) => {

Callers 1

Calls 15

executeOnHandleFunction · 0.85
verifyStatObjectFunction · 0.85
allocMethod · 0.80
allMethod · 0.80
statFunction · 0.70
verifyStatFsObjectFunction · 0.70
unlinkFunction · 0.70
readFileFunction · 0.70
chmodFunction · 0.70
chownFunction · 0.70
renameFunction · 0.70
symlinkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…