()
| 50 | |
| 51 | let interval; |
| 52 | async function test() { |
| 53 | if (common.isMacOS) { |
| 54 | // On macOS delay watcher start to avoid leaking previous events. |
| 55 | // Refs: https://github.com/libuv/libuv/pull/4503 |
| 56 | await setTimeout(common.platformTimeout(100)); |
| 57 | } |
| 58 | |
| 59 | const watcher = watch(testCase[testCase.field]); |
| 60 | for await (const { eventType, filename } of watcher) { |
| 61 | clearInterval(interval); |
| 62 | assert.strictEqual(['rename', 'change'].includes(eventType), true); |
| 63 | assert.strictEqual(filename, testCase.fileName); |
| 64 | break; |
| 65 | } |
| 66 | |
| 67 | // Waiting on it again is a non-op |
| 68 | // eslint-disable-next-line no-unused-vars |
| 69 | for await (const p of watcher) { |
| 70 | assert.fail('should not run'); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // Long content so it's actually flushed. toUpperCase so there's real change. |
| 75 | const content2 = Date.now() + testCase.fileName.toUpperCase().repeat(1e4); |
no test coverage detected
searching dependent graphs…