browser-ava 2.1.12 → 2.2.1
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/README.md +36 -6
- package/package.json +3 -3
- package/src/browser-ava-cli.mjs +17 -14
package/README.md
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
[](http://commitizen.github.io/cz-cli/)
|
|
9
9
|
[](https://snyk.io/test/github/arlac77/browser-ava)
|
|
10
10
|
[](https://coveralls.io/github/arlac77/browser-ava)
|
|
11
|
+
|
|
11
12
|
# browser-ava
|
|
12
|
-
Run ava tests in the browser
|
|
13
13
|
|
|
14
|
+
Run ava tests in the browser
|
|
14
15
|
|
|
15
16
|
## What it does
|
|
16
17
|
|
|
@@ -26,11 +27,40 @@ browser-ava --webkit --chromium --firefox tests/*.mjs
|
|
|
26
27
|
|
|
27
28
|
## limitations
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
* only supports ESM
|
|
30
31
|
|
|
32
|
+
# API
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
### Table of Contents
|
|
37
|
+
|
|
38
|
+
* [testModules](#testmodules)
|
|
39
|
+
* [test](#test)
|
|
40
|
+
* [Parameters](#parameters)
|
|
41
|
+
* [pluralize](#pluralize)
|
|
42
|
+
* [Parameters](#parameters-1)
|
|
43
|
+
|
|
44
|
+
## testModules
|
|
45
|
+
|
|
46
|
+
Holds all tests
|
|
47
|
+
|
|
48
|
+
## test
|
|
49
|
+
|
|
50
|
+
Collect all tests into testModules
|
|
51
|
+
|
|
52
|
+
### Parameters
|
|
53
|
+
|
|
54
|
+
* `body`  
|
|
55
|
+
* `args` **...any** 
|
|
56
|
+
|
|
57
|
+
## pluralize
|
|
58
|
+
|
|
59
|
+
Pluralize subjects
|
|
60
|
+
|
|
61
|
+
### Parameters
|
|
62
|
+
|
|
63
|
+
* `word` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** subject to be pluralized
|
|
64
|
+
* `number` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** if > 1 pluralize otherwize keep subject alone
|
|
65
|
+
|
|
66
|
+
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** pluralized subject if number > 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-ava",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"chalk": "^5.3.0",
|
|
40
40
|
"commander": "^12.0.0",
|
|
41
41
|
"es-module-lexer": "^1.4.1",
|
|
42
|
-
"globby": "^14.0.
|
|
42
|
+
"globby": "^14.0.1",
|
|
43
43
|
"koa": "^2.15.0",
|
|
44
44
|
"koa-static": "^5.0.0",
|
|
45
45
|
"playwright": "^1.41.2",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"semantic-release": "^23.0.2"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
|
-
"node": ">=20.11.
|
|
56
|
+
"node": ">=20.11.1",
|
|
57
57
|
"bun": ">=1.0"
|
|
58
58
|
},
|
|
59
59
|
"repository": {
|
package/src/browser-ava-cli.mjs
CHANGED
|
@@ -47,7 +47,7 @@ program
|
|
|
47
47
|
.env("PORT")
|
|
48
48
|
)
|
|
49
49
|
.addOption(
|
|
50
|
-
new Option("-b, --browser <name>", "browser to use").env("BROWSER")
|
|
50
|
+
new Option("-b, --browser <name>[,secondName]", "browser to use").env("BROWSER")
|
|
51
51
|
)
|
|
52
52
|
.option("--headless", "hide browser window", false)
|
|
53
53
|
.option(
|
|
@@ -58,26 +58,29 @@ program
|
|
|
58
58
|
.argument("<tests...>")
|
|
59
59
|
.action(async (tests, options) => {
|
|
60
60
|
if (options.browser) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (parts
|
|
64
|
-
|
|
61
|
+
for (let b of options.browser.split(/,/)) {
|
|
62
|
+
const parts = b.split(/:/);
|
|
63
|
+
if (parts.length > 1) {
|
|
64
|
+
if (parts[1] === "headless") {
|
|
65
|
+
options.headless = true;
|
|
66
|
+
}
|
|
67
|
+
b = parts[0];
|
|
65
68
|
}
|
|
66
|
-
options.browser = parts[0];
|
|
67
|
-
}
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
const browser = knownBrowsers[b];
|
|
71
|
+
if (browser) {
|
|
72
|
+
browsers.push(browser);
|
|
73
|
+
} else {
|
|
74
|
+
console.error(`Unknwon browser ${b}`);
|
|
75
|
+
}
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
if (browsers.length === 0) {
|
|
79
80
|
console.error(
|
|
80
|
-
`No browsers selected use ${Object.keys(knownBrowsers).map(
|
|
81
|
+
`No browsers selected use ${Object.keys(knownBrowsers).map(
|
|
82
|
+
b => ` --${b}`
|
|
83
|
+
)}`
|
|
81
84
|
);
|
|
82
85
|
process.exit(2);
|
|
83
86
|
}
|