browser-ava 2.2.5 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-ava",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -38,7 +38,7 @@
38
38
  "@koa/cors": "^5.0.0",
39
39
  "chalk": "^5.3.0",
40
40
  "commander": "^12.0.0",
41
- "es-module-lexer": "^1.4.1",
41
+ "es-module-lexer": "^1.5.0",
42
42
  "globby": "^14.0.1",
43
43
  "koa": "^2.15.2",
44
44
  "koa-static": "^5.0.0",
@@ -54,7 +54,7 @@
54
54
  "semantic-release": "^23.0.6"
55
55
  },
56
56
  "engines": {
57
- "node": ">=20.11.1",
57
+ "node": ">=20.12.0",
58
58
  "bun": ">=1.0"
59
59
  },
60
60
  "repository": {
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env node
2
- import { readFileSync } from "node:fs";
1
+ #!/usr/bin/env -S node --no-warnings --title browser-ava
3
2
  import { readFile } from "node:fs/promises";
4
3
  import { resolve } from "node:path";
5
4
  import { init, parse } from "es-module-lexer";
@@ -13,13 +12,7 @@ import { calculateSummary, summaryMessages } from "./browser/util.mjs";
13
12
  import { resolveImport, utf8EncodingOptions } from "./resolver.mjs";
14
13
  import { globby } from "globby";
15
14
  import chalk from "chalk";
16
-
17
- const { version, description } = JSON.parse(
18
- readFileSync(
19
- new URL("../package.json", import.meta.url).pathname,
20
- utf8EncodingOptions
21
- )
22
- );
15
+ import pkg from "../package.json" assert { type: "json" };
23
16
 
24
17
  const knownBrowsers = {
25
18
  chrome: chromium,
@@ -39,20 +32,28 @@ Object.entries(knownBrowsers).forEach(([name, browser]) => {
39
32
  });
40
33
 
41
34
  program
42
- .description(description)
43
- .version(version)
35
+ .description(pkg.description)
36
+ .version(pkg.version)
44
37
  .addOption(
45
38
  new Option("-p, --port <number>", "server port to use")
46
39
  .default(8080)
47
40
  .env("PORT")
48
41
  )
49
42
  .addOption(
50
- new Option("-b, --browser <name>[,secondBrowserName]", "browsers to use").env("BROWSER")
43
+ new Option(
44
+ "-b, --browser <name>[,secondBrowserName]",
45
+ "browsers to use"
46
+ ).env("BROWSER")
51
47
  )
52
48
  .option("--headless", "hide browser window", false)
49
+ .option(
50
+ "--keep-open",
51
+ "keep browser-ava and the browser open after execution",
52
+ true
53
+ )
53
54
  .option(
54
55
  "--no-keep-open",
55
- "keep browser-ava and the page open after execution",
56
+ "close browser-ava and the browsers after execution",
56
57
  true
57
58
  )
58
59
  .argument("<tests...>")
@@ -207,7 +208,7 @@ async function loadAndRewriteImports(file) {
207
208
 
208
209
  d += m.length - i.n.length;
209
210
  } else {
210
- console.warn(`Unable to resolve "${i.n}" may lead to import errors`);
211
+ console.warn(`${file}: Unable to resolve "${i.n}" may lead to import errors`);
211
212
  }
212
213
  }
213
214
  return body;