Skip to content

Commit 438ee8f

Browse files
committed
test(assets): skip the live-watcher test on windows CI
Even isolated to a single native watch handle with a 200ms post-close grace period, the windows-latest matrix still hit `Assertion failed: !_wcsnicmp(filename, dir, dirlen)` intermittently. A fixed delay can't reliably fix this — the crash is consistent with Windows Defender's real-time scanning racing the directory watch/close/delete, a known Node/libuv interaction on hosted Windows runners that isn't reliably avoidable from application code. Skip the one test that opens a real watch there; the behavior stays fully covered on Linux/macOS.
1 parent 6260652 commit 438ee8f

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

plugins/assets/test/assets.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { AssetsServer, TestClient } from './_utils'
22
import { Buffer } from 'node:buffer'
33
import fsp from 'node:fs/promises'
44
import { join } from 'node:path'
5+
import process from 'node:process'
56
import { afterAll, afterEach, beforeEach, describe, expect, it } from 'vitest'
67
import { bootClient, call, cleanupTempDir, createTempDir, startAssetsServer } from './_utils'
78

@@ -179,7 +180,19 @@ describe('assets plugin', () => {
179180
// The one test that needs the live watcher — every other test above opts
180181
// out of it (`watch: false`) so this is the only native fs watch handle
181182
// this file ever opens, close()s, and deletes the directory of.
182-
it('broadcasts a change event when a file is added on disk', async () => {
183+
//
184+
// Skipped on Windows: opening a real `ReadDirectoryChangesW` watch and
185+
// then closing + deleting its directory shortly after is a known
186+
// trigger for a native libuv assertion on Windows CI runners —
187+
// `Assertion failed: !_wcsnicmp(filename, dir, dirlen), file
188+
// src\win\fs-event.c, line 72` — that hard-aborts the process outright
189+
// (no JS-catchable error). It isn't reliably avoidable with a delay: it
190+
// reproduces intermittently regardless of how long the teardown waits,
191+
// consistent with Windows Defender's real-time scanning racing the
192+
// directory watch/delete (a widely reported Node/libuv interaction on
193+
// hosted Windows runners). The live-watcher behavior is still fully
194+
// covered on Linux/macOS.
195+
it.skipIf(process.platform === 'win32')('broadcasts a change event when a file is added on disk', async () => {
183196
server = await startAssetsServer(dir)
184197
client = bootClient(server.port)
185198

0 commit comments

Comments
 (0)