qunitx-cli 0.23.4 → 0.23.5

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 -3
  2. package/package.json +2 -2
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.4",
377
+ version: "0.23.5",
378
378
  description: "Browser runner for QUnitx: run your qunitx tests in google-chrome",
379
379
  author: "Izel Nakri",
380
380
  license: "MIT",
@@ -397,7 +397,7 @@ var init_package = __esm({
397
397
  prepublishOnly: "npm run build",
398
398
  format: 'prettier --check "lib/**/*.ts" "test/**/*.ts" "scripts/**/*.js" "bin/**/*.js" "*.ts" "package.json" ".github/**/*.yml"',
399
399
  "format:fix": 'prettier --write "lib/**/*.ts" "test/**/*.ts" "scripts/**/*.js" "bin/**/*.js" "*.ts" "package.json" ".github/**/*.yml"',
400
- lint: "deno lint lib/ bin/ cli.ts",
400
+ lint: "deno lint lib/ bin/ test/ scripts/ cli.ts",
401
401
  "lint:docs": "node scripts/lint-docs.js",
402
402
  docs: `deno doc --html --name="qunitx-cli" --output=docs/lib 'lib/**/*.ts' README.md`,
403
403
  "changelog:unreleased": "git-cliff --unreleased --strip all",
@@ -519,6 +519,7 @@ ${color("--browser")} : browser engine to run tests in: chromium, firefox, webki
519
519
  ${color("--before")} : run a script before the tests(i.e start a new web server before tests)
520
520
  ${color("--after")} : run a script after the tests(i.e save test results to a file)
521
521
  ${color("--no-daemon")} : don't use the daemon for this run \u2014 skips a running daemon and prevents ${color("QUNITX_DAEMON")} auto-spawn
522
+ ${color("--trace-perf")} : write timestamped startup-perf trace lines to stderr (Chrome pre-launch, module load, browser bind)
522
523
 
523
524
  ${highlight("Example:")} $ ${color("qunitx test/foo.ts app/e2e --debug --watch --before=scripts/start-new-webserver.js --after=scripts/write-test-results.js")}
524
525
 
@@ -530,6 +531,8 @@ ${color("$ qunitx daemon <start|stop|status>")} # Optional persistent daemo
530
531
  ${highlight("Environment:")}
531
532
  ${color("QUNITX_DAEMON=1")} : auto-spawn the daemon on the first qunitx run; reuse it on every run after (overrides the CI=1 bypass)
532
533
  ${color("QUNITX_NO_DAEMON=1")} : never use the daemon for this run
534
+ ${color("QUNITX_BROWSER=...")} : default browser engine when ${color("--browser")} is not passed (chromium, firefox, webkit)
535
+ ${color("QUNITX_DEBUG=1")} : enables ${color("--debug")} for every run; per-invocation ${color("--debug=false")} still wins
533
536
  `);
534
537
  }
535
538
  var highlight, color;
@@ -1150,6 +1153,9 @@ function parseCliFlags(projectRoot) {
1150
1153
  }
1151
1154
  providedFlags.browser = envBrowser;
1152
1155
  }
1156
+ if (providedFlags.debug === void 0 && process.env.QUNITX_DEBUG) {
1157
+ providedFlags.debug = true;
1158
+ }
1153
1159
  return { ...providedFlags, inputs: Array.from(providedFlags.inputs) };
1154
1160
  }
1155
1161
  function parseBoolean(result2, defaultValue = true) {
@@ -3513,6 +3519,11 @@ var init_open_output_in_browser = __esm({
3513
3519
  import fs11 from "node:fs";
3514
3520
  import { readdir, stat, lstat } from "node:fs/promises";
3515
3521
  import path9 from "node:path";
3522
+ function recordJustAdded(config, filePath) {
3523
+ let map = justAddedAt.get(config);
3524
+ if (!map) justAddedAt.set(config, map = /* @__PURE__ */ new Map());
3525
+ map.set(filePath, Date.now());
3526
+ }
3516
3527
  function setupFileWatchers(testFileLookupPaths, config, onEventFunc, onFinishFunc) {
3517
3528
  const extensions = config.extensions || defaultProjectConfigValues.extensions;
3518
3529
  config._lastBuildEndMs ??= Date.now();
@@ -3679,6 +3690,11 @@ function handleWatchEvent(config, extensions, event, filePath, onEventFunc, onFi
3679
3690
  return Promise.resolve();
3680
3691
  if (event === "change" && config._building && config._justAddedFiles?.has(filePath))
3681
3692
  return Promise.resolve();
3693
+ if (event === "change") {
3694
+ const addedAt = justAddedAt.get(config)?.get(filePath);
3695
+ if (addedAt !== void 0 && Date.now() - addedAt < ADD_SUPPRESS_WINDOW_MS)
3696
+ return Promise.resolve();
3697
+ }
3682
3698
  mutateFSTree(config.fsTree, event, filePath);
3683
3699
  console.log(
3684
3700
  "#",
@@ -3690,6 +3706,7 @@ function handleWatchEvent(config, extensions, event, filePath, onEventFunc, onFi
3690
3706
  "#",
3691
3707
  magenta().bold("==================================================================")
3692
3708
  );
3709
+ if (event === "add") recordJustAdded(config, filePath);
3693
3710
  if (config._building) {
3694
3711
  if (event === "add") config._justAddedFiles?.add(filePath);
3695
3712
  config._pendingBuildTrigger = () => handleWatchEvent(config, extensions, event, filePath, onEventFunc, onFinishFunc);
@@ -3798,7 +3815,7 @@ function colorEvent(event) {
3798
3815
  if (event === "add" || event === "addDir") return green("ADDED:");
3799
3816
  return red("REMOVED:");
3800
3817
  }
3801
- var CHANGE_DEDUPE_MS, SYMLINK_POLL_INTERVAL_MS, OVERLAYFS_RENAME_RETRY_MS, RESCAN_INTERVAL_MS;
3818
+ var CHANGE_DEDUPE_MS, SYMLINK_POLL_INTERVAL_MS, OVERLAYFS_RENAME_RETRY_MS, RESCAN_INTERVAL_MS, ADD_SUPPRESS_WINDOW_MS, justAddedAt;
3802
3819
  var init_file_watcher = __esm({
3803
3820
  "lib/setup/file-watcher.ts"() {
3804
3821
  init_color();
@@ -3807,6 +3824,8 @@ var init_file_watcher = __esm({
3807
3824
  SYMLINK_POLL_INTERVAL_MS = 500;
3808
3825
  OVERLAYFS_RENAME_RETRY_MS = 50;
3809
3826
  RESCAN_INTERVAL_MS = 1e3;
3827
+ ADD_SUPPRESS_WINDOW_MS = 1e3;
3828
+ justAddedAt = /* @__PURE__ */ new WeakMap();
3810
3829
  }
3811
3830
  });
3812
3831
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qunitx-cli",
3
3
  "type": "module",
4
- "version": "0.23.4",
4
+ "version": "0.23.5",
5
5
  "description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
6
6
  "author": "Izel Nakri",
7
7
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "prepublishOnly": "npm run build",
25
25
  "format": "prettier --check \"lib/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.js\" \"bin/**/*.js\" \"*.ts\" \"package.json\" \".github/**/*.yml\"",
26
26
  "format:fix": "prettier --write \"lib/**/*.ts\" \"test/**/*.ts\" \"scripts/**/*.js\" \"bin/**/*.js\" \"*.ts\" \"package.json\" \".github/**/*.yml\"",
27
- "lint": "deno lint lib/ bin/ cli.ts",
27
+ "lint": "deno lint lib/ bin/ test/ scripts/ cli.ts",
28
28
  "lint:docs": "node scripts/lint-docs.js",
29
29
  "docs": "deno doc --html --name=\"qunitx-cli\" --output=docs/lib 'lib/**/*.ts' README.md",
30
30
  "changelog:unreleased": "git-cliff --unreleased --strip all",