qunitx-cli 0.21.1 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +38 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2588,7 +2588,7 @@ var init_tests_in_browser = __esm({
|
|
|
2588
2588
|
|
|
2589
2589
|
// lib/setup/file-watcher.ts
|
|
2590
2590
|
import fs10 from "node:fs";
|
|
2591
|
-
import { stat, lstat } from "node:fs/promises";
|
|
2591
|
+
import { readdir, stat, lstat } from "node:fs/promises";
|
|
2592
2592
|
import path8 from "node:path";
|
|
2593
2593
|
function setupFileWatchers(testFileLookupPaths, config, onEventFunc, onFinishFunc) {
|
|
2594
2594
|
const extensions = config.extensions || ["js", "ts"];
|
|
@@ -2623,7 +2623,20 @@ function setupFileWatchers(testFileLookupPaths, config, onEventFunc, onFinishFun
|
|
|
2623
2623
|
const lastEventMs = {};
|
|
2624
2624
|
const seenMtimeMs = {};
|
|
2625
2625
|
const childWatcher = fs10.watch(watchPath, { recursive: true }, async (eventType, filename) => {
|
|
2626
|
-
if (!ready
|
|
2626
|
+
if (!ready) return;
|
|
2627
|
+
if (!filename) {
|
|
2628
|
+
if (process.platform === "darwin") {
|
|
2629
|
+
await rescanDirectoryForDelta(
|
|
2630
|
+
watchPath,
|
|
2631
|
+
config,
|
|
2632
|
+
extensions,
|
|
2633
|
+
onEventFunc,
|
|
2634
|
+
onFinishFunc,
|
|
2635
|
+
trackSymlink
|
|
2636
|
+
);
|
|
2637
|
+
}
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2627
2640
|
const fullPath = filename === path8.basename(watchPath) ? watchPath : path8.join(watchPath, filename);
|
|
2628
2641
|
if (eventType === "change") {
|
|
2629
2642
|
const now = Date.now();
|
|
@@ -2759,6 +2772,28 @@ function handleWatchEvent(config, extensions, event, filePath, onEventFunc, onFi
|
|
|
2759
2772
|
}
|
|
2760
2773
|
});
|
|
2761
2774
|
}
|
|
2775
|
+
async function rescanDirectoryForDelta(watchPath, config, extensions, onEventFunc, onFinishFunc, trackSymlinkFn) {
|
|
2776
|
+
try {
|
|
2777
|
+
const entries = await readdir(watchPath, { withFileTypes: true, recursive: true });
|
|
2778
|
+
const presentPaths = /* @__PURE__ */ new Set();
|
|
2779
|
+
for (const entry of entries) {
|
|
2780
|
+
if (!entry.isFile() && !entry.isSymbolicLink()) continue;
|
|
2781
|
+
const entryPath = path8.join(entry.parentPath, entry.name);
|
|
2782
|
+
if (!extensions.some((ext) => entryPath.endsWith(`.${ext}`))) continue;
|
|
2783
|
+
presentPaths.add(entryPath);
|
|
2784
|
+
if (!(entryPath in config.fsTree)) {
|
|
2785
|
+
if (entry.isSymbolicLink()) trackSymlinkFn?.(entryPath);
|
|
2786
|
+
handleWatchEvent(config, extensions, "add", entryPath, onEventFunc, onFinishFunc);
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
const watchPrefix = watchPath + path8.sep;
|
|
2790
|
+
for (const trackedPath of Object.keys(config.fsTree)) {
|
|
2791
|
+
if (trackedPath.startsWith(watchPrefix) && !presentPaths.has(trackedPath))
|
|
2792
|
+
handleWatchEvent(config, extensions, "unlink", trackedPath, onEventFunc, onFinishFunc);
|
|
2793
|
+
}
|
|
2794
|
+
} catch {
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2762
2797
|
function mutateFSTree(fsTree, event, filePath) {
|
|
2763
2798
|
if (event === "add") {
|
|
2764
2799
|
fsTree[filePath] = null;
|
|
@@ -3303,7 +3338,7 @@ init_color();
|
|
|
3303
3338
|
var package_default = {
|
|
3304
3339
|
name: "qunitx-cli",
|
|
3305
3340
|
type: "module",
|
|
3306
|
-
version: "0.21.
|
|
3341
|
+
version: "0.21.2",
|
|
3307
3342
|
description: "Browser runner for QUnitx: run your qunitx tests in google-chrome",
|
|
3308
3343
|
author: "Izel Nakri",
|
|
3309
3344
|
license: "MIT",
|