browser-ava 2.1.11 → 2.2.0
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 +3 -0
- package/package.json +7 -3
- package/src/browser-ava-cli.mjs +17 -14
- package/src/resolver.mjs +4 -1
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
[](https://npmjs.org/package/browser-ava)
|
|
5
5
|
[](https://github.com/arlac77/browser-ava/issues)
|
|
6
6
|
[](https://actions-badge.atrox.dev/arlac77/browser-ava/goto)
|
|
7
|
+
[](https://github.com/prettier/prettier)
|
|
8
|
+
[](http://commitizen.github.io/cz-cli/)
|
|
9
|
+
[](https://snyk.io/test/github/arlac77/browser-ava)
|
|
7
10
|
[](https://coveralls.io/github/arlac77/browser-ava)
|
|
8
11
|
# browser-ava
|
|
9
12
|
Run ava tests in the browser
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-ava",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
"prepare": "npx playwright install",
|
|
30
30
|
"test": "npm run test:ava",
|
|
31
31
|
"test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
32
|
-
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp"
|
|
32
|
+
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
|
|
33
|
+
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
34
|
+
"lint": "npm run lint:docs",
|
|
35
|
+
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"@koa/cors": "^5.0.0",
|
|
@@ -45,8 +48,9 @@
|
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"ava": "^6.1.1",
|
|
47
50
|
"c8": "^9.1.0",
|
|
51
|
+
"documentation": "^14.0.3",
|
|
48
52
|
"execa": "^8.0.1",
|
|
49
|
-
"semantic-release": "^23.0.
|
|
53
|
+
"semantic-release": "^23.0.2"
|
|
50
54
|
},
|
|
51
55
|
"engines": {
|
|
52
56
|
"node": ">=20.11.0",
|
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
|
}
|
package/src/resolver.mjs
CHANGED
|
@@ -22,7 +22,7 @@ const exportsConditionOrder = ["browser", "module", "import", ".", "default"];
|
|
|
22
22
|
/**
|
|
23
23
|
* Find module inside a package.
|
|
24
24
|
* @param {string[]} parts
|
|
25
|
-
* @param {Object} pkg package.json content
|
|
25
|
+
* @param {Object} pkg decoded package.json content
|
|
26
26
|
* @returns {string|undefined} module file name relative to package
|
|
27
27
|
*/
|
|
28
28
|
export function resolveExports(parts, pkg) {
|
|
@@ -31,6 +31,9 @@ export function resolveExports(parts, pkg) {
|
|
|
31
31
|
case "string":
|
|
32
32
|
return value;
|
|
33
33
|
case "object":
|
|
34
|
+
if(value['.']) {
|
|
35
|
+
return matchingCondition(value['.']);
|
|
36
|
+
}
|
|
34
37
|
for (const condition of exportsConditionOrder) {
|
|
35
38
|
if (value[condition]) {
|
|
36
39
|
return value[condition];
|