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

Function testDelete

test/common/watch.js:168–200  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166 };
167
168 const testDelete = async () => {
169 await ran1.promise;
170 runs.push(currentRun);
171 currentRun = '';
172 const fileToDeletePath = tmpdir.resolve(fileToUpdate);
173
174 if (useRunApi) {
175 const { existsSync } = require('node:fs');
176 const interval = setInterval(() => {
177 if (existsSync(fileToDeletePath)) {
178 unlinkSync(fileToDeletePath);
179 } else {
180 ran2.resolve();
181 clearInterval(interval);
182 }
183 }, common.platformTimeout(1000));
184 await ran2.promise;
185 } else {
186 unlinkSync(fileToDeletePath);
187 await setTimeout(common.platformTimeout(2000));
188 ran2.resolve();
189 }
190
191 runs.push(currentRun);
192 child.kill();
193 await once(child, 'exit');
194
195 assert.strictEqual(runs.length, 2);
196
197 for (const run of runs) {
198 assert.doesNotMatch(run, /MODULE_NOT_FOUND/);
199 }
200 };
201
202 const testCreate = async () => {
203 await ran1.promise;

Callers 1

testRunnerWatchFunction · 0.85

Calls 10

unlinkSyncFunction · 0.85
clearIntervalFunction · 0.85
killMethod · 0.80
requireFunction · 0.50
setIntervalFunction · 0.50
existsSyncFunction · 0.50
setTimeoutFunction · 0.50
onceFunction · 0.50
pushMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…