qunitx-cli 0.23.5 → 0.23.6

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.
Files changed (2) hide show
  1. package/dist/cli.js +22 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -374,7 +374,7 @@ var init_package = __esm({
374
374
  package_default = {
375
375
  name: "qunitx-cli",
376
376
  type: "module",
377
- version: "0.23.5",
377
+ version: "0.23.6",
378
378
  description: "Browser runner for QUnitx: run your qunitx tests in google-chrome",
379
379
  author: "Izel Nakri",
380
380
  license: "MIT",
@@ -3329,15 +3329,16 @@ async function runTestInsideHTMLFile(filePath, { page, server, browser }, config
3329
3329
  let targetError;
3330
3330
  let timeoutHandle;
3331
3331
  let wsConnected = false;
3332
+ let resolveTestRace;
3333
+ const testRaceResult = new Promise((resolve) => {
3334
+ resolveTestRace = resolve;
3335
+ });
3336
+ page.on("close", resolveTestRace);
3332
3337
  try {
3333
3338
  console.log("#", blue(`QUnitX running: http://localhost:${config.port}${filePath}`));
3334
3339
  const navMs = Math.max(config.timeout + NAV_GRACE_MS, MIN_NAV_MS);
3335
3340
  const startupMs = Math.max(config.timeout * STARTUP_TIMEOUT_FACTOR, navMs);
3336
3341
  const testsJsMs = Math.max(config.timeout * TESTS_JS_TIMEOUT_FACTOR, navMs);
3337
- let resolveTestRace;
3338
- const testRaceResult = new Promise((resolve) => {
3339
- resolveTestRace = resolve;
3340
- });
3341
3342
  config._testRunDone = resolveTestRace;
3342
3343
  config._onWsOpen = () => {
3343
3344
  wsConnected = true;
@@ -3370,6 +3371,7 @@ async function runTestInsideHTMLFile(filePath, { page, server, browser }, config
3370
3371
  console.error(error);
3371
3372
  } finally {
3372
3373
  clearTimeout(timeoutHandle);
3374
+ page.off("close", resolveTestRace);
3373
3375
  config._onWsOpen = null;
3374
3376
  config._onTestsJsServed = null;
3375
3377
  config._resetTestTimeout = null;
@@ -3532,6 +3534,7 @@ function setupFileWatchers(testFileLookupPaths, config, onEventFunc, onFinishFun
3532
3534
  const rescanTimers = [];
3533
3535
  const fileWatchers = {};
3534
3536
  const symlinkPollers = /* @__PURE__ */ new Map();
3537
+ const pendingChangeTimers = /* @__PURE__ */ new Map();
3535
3538
  function trackSymlink(filePath) {
3536
3539
  if (symlinkPollers.has(filePath)) return;
3537
3540
  const handler = (curr, prev) => {
@@ -3591,7 +3594,16 @@ function setupFileWatchers(testFileLookupPaths, config, onEventFunc, onFinishFun
3591
3594
  return;
3592
3595
  } catch {
3593
3596
  }
3594
- return handleWatchEvent(config, extensions, "change", fullPath, onEventFunc, onFinishFunc);
3597
+ const existing = pendingChangeTimers.get(fullPath);
3598
+ if (existing) clearTimeout(existing);
3599
+ pendingChangeTimers.set(
3600
+ fullPath,
3601
+ setTimeout(() => {
3602
+ pendingChangeTimers.delete(fullPath);
3603
+ handleWatchEvent(config, extensions, "change", fullPath, onEventFunc, onFinishFunc);
3604
+ }, CHANGE_COALESCE_MS)
3605
+ );
3606
+ return;
3595
3607
  }
3596
3608
  const event = await classifyRenameEvent(fullPath, config.fsTree);
3597
3609
  if (!event) return;
@@ -3681,6 +3693,8 @@ function setupFileWatchers(testFileLookupPaths, config, onEventFunc, onFinishFun
3681
3693
  rescanTimers.forEach((t) => clearInterval(t));
3682
3694
  symlinkPollers.forEach((cancel) => cancel());
3683
3695
  symlinkPollers.clear();
3696
+ pendingChangeTimers.forEach((t) => clearTimeout(t));
3697
+ pendingChangeTimers.clear();
3684
3698
  return fileWatchers;
3685
3699
  }
3686
3700
  };
@@ -3815,7 +3829,7 @@ function colorEvent(event) {
3815
3829
  if (event === "add" || event === "addDir") return green("ADDED:");
3816
3830
  return red("REMOVED:");
3817
3831
  }
3818
- var CHANGE_DEDUPE_MS, SYMLINK_POLL_INTERVAL_MS, OVERLAYFS_RENAME_RETRY_MS, RESCAN_INTERVAL_MS, ADD_SUPPRESS_WINDOW_MS, justAddedAt;
3832
+ var CHANGE_DEDUPE_MS, SYMLINK_POLL_INTERVAL_MS, OVERLAYFS_RENAME_RETRY_MS, RESCAN_INTERVAL_MS, CHANGE_COALESCE_MS, ADD_SUPPRESS_WINDOW_MS, justAddedAt;
3819
3833
  var init_file_watcher = __esm({
3820
3834
  "lib/setup/file-watcher.ts"() {
3821
3835
  init_color();
@@ -3824,6 +3838,7 @@ var init_file_watcher = __esm({
3824
3838
  SYMLINK_POLL_INTERVAL_MS = 500;
3825
3839
  OVERLAYFS_RENAME_RETRY_MS = 50;
3826
3840
  RESCAN_INTERVAL_MS = 1e3;
3841
+ CHANGE_COALESCE_MS = 50;
3827
3842
  ADD_SUPPRESS_WINDOW_MS = 1e3;
3828
3843
  justAddedAt = /* @__PURE__ */ new WeakMap();
3829
3844
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qunitx-cli",
3
3
  "type": "module",
4
- "version": "0.23.5",
4
+ "version": "0.23.6",
5
5
  "description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
6
6
  "author": "Izel Nakri",
7
7
  "license": "MIT",