bt-runner 4.0.1 → 4.0.3
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/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/index.js +4 -1
- package/dist/util/Server.js +1 -1
- package/dist/util/generateHtml.js +3 -4
- package/dist/util/getPort.js +1 -2
- package/dist/util/runTests.js +6 -7
- package/package.json +26 -16
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 j&s-soft GmbH
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# bt-runner
|
2
|
+
|
3
|
+
[](https://github.com/js-soft/bt-runner/actions?query=workflow%3APublish)
|
4
|
+
[](https://www.npmjs.com/package/bt-runner)
|
5
|
+
|
6
|
+
A browser-based test runner for NodeJS.
|
7
|
+
|
8
|
+
## License
|
9
|
+
|
10
|
+
[MIT](LICENSE)
|
package/dist/index.js
CHANGED
package/dist/util/Server.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.generateHtml =
|
3
|
+
exports.generateHtml = generateHtml;
|
4
4
|
function generateHtml(dependencies, additionalScripts) {
|
5
5
|
return `<!DOCTYPE html>
|
6
6
|
<html>
|
@@ -11,8 +11,8 @@ function generateHtml(dependencies, additionalScripts) {
|
|
11
11
|
<body>
|
12
12
|
<div id="mocha"></div>
|
13
13
|
|
14
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.
|
15
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.2.0/mocha.min.js"></script>
|
15
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.7/chai.min.js"></script>
|
16
16
|
<script>
|
17
17
|
mocha.setup("bdd")
|
18
18
|
mocha.reporter("spec")
|
@@ -25,4 +25,3 @@ function generateHtml(dependencies, additionalScripts) {
|
|
25
25
|
</body>
|
26
26
|
</html>`;
|
27
27
|
}
|
28
|
-
exports.generateHtml = generateHtml;
|
package/dist/util/getPort.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getPort =
|
6
|
+
exports.getPort = getPort;
|
7
7
|
const net_1 = __importDefault(require("net"));
|
8
8
|
async function getPort(options) {
|
9
9
|
return await new Promise((resolve, reject) => {
|
@@ -18,4 +18,3 @@ async function getPort(options) {
|
|
18
18
|
});
|
19
19
|
});
|
20
20
|
}
|
21
|
-
exports.getPort = getPort;
|
package/dist/util/runTests.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.runTests =
|
6
|
+
exports.runTests = runTests;
|
7
7
|
const puppeteer_1 = __importDefault(require("puppeteer"));
|
8
8
|
async function runTests(serverPort, testRunners, debug) {
|
9
9
|
const browser = await puppeteer_1.default.launch({
|
@@ -21,9 +21,8 @@ async function runTests(serverPort, testRunners, debug) {
|
|
21
21
|
await page.goto(`http://localhost:${serverPort}/test-browser/index${runnerNumber}.html`);
|
22
22
|
// patch all process.env variables into the browsers "process.env"
|
23
23
|
await page.evaluate((params) => {
|
24
|
-
// @
|
25
|
-
globalThis.process = globalThis.process ?? {};
|
26
|
-
globalThis.process.env = globalThis.process.env ?? {};
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
25
|
+
globalThis.process = globalThis.process ?? { env: {} };
|
27
26
|
globalThis.process.env = { ...globalThis.process.env, ...params };
|
28
27
|
}, process.env);
|
29
28
|
for (const dependency of runner.dependencies) {
|
@@ -38,15 +37,16 @@ async function runTests(serverPort, testRunners, debug) {
|
|
38
37
|
return { failures: 1 };
|
39
38
|
}
|
40
39
|
}
|
41
|
-
return new Promise((resolve) => window.mocha.run(function (failures) {
|
40
|
+
return await new Promise((resolve) => window.mocha.run(function (failures) {
|
42
41
|
resolve({ failures: failures });
|
43
42
|
}));
|
44
43
|
}, runner.globals ?? []);
|
45
44
|
if (debug) {
|
46
45
|
console.log("Press any key to continue...");
|
46
|
+
// eslint-disable-next-line no-loop-func
|
47
47
|
await new Promise((resolve) => process.stdin.once("data", resolve));
|
48
48
|
}
|
49
|
-
if (result.failures
|
49
|
+
if (result.failures !== 0) {
|
50
50
|
await browser.close();
|
51
51
|
return false;
|
52
52
|
}
|
@@ -56,4 +56,3 @@ async function runTests(serverPort, testRunners, debug) {
|
|
56
56
|
await browser.close();
|
57
57
|
return true;
|
58
58
|
}
|
59
|
-
exports.runTests = runTests;
|
package/package.json
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "bt-runner",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.3",
|
4
4
|
"description": "",
|
5
|
-
"repository":
|
6
|
-
|
7
|
-
|
8
|
-
},
|
9
|
-
"license": "ISC",
|
10
|
-
"author": "js-soft <julian.koenig@js-soft.com> (https://www.js-soft.com/)",
|
5
|
+
"repository": "github:js-soft/bt-runner",
|
6
|
+
"license": "MIT",
|
7
|
+
"author": "js-soft GmbH (https://www.js-soft.com/)",
|
11
8
|
"main": "index.js",
|
12
9
|
"bin": {
|
13
10
|
"browsertest-runner": "dist/index.js"
|
@@ -15,20 +12,33 @@
|
|
15
12
|
"files": [
|
16
13
|
"dist"
|
17
14
|
],
|
15
|
+
"workspaces": [
|
16
|
+
".",
|
17
|
+
"example"
|
18
|
+
],
|
18
19
|
"scripts": {
|
19
|
-
"
|
20
|
+
"build": "tsc",
|
21
|
+
"lint": "npm run lint:prettier && npm run lint:eslint && npm run lint:tsc",
|
22
|
+
"lint:eslint": "eslint --ext ts ./src",
|
23
|
+
"lint:prettier": "prettier --check .",
|
24
|
+
"lint:tsc": "tsc --noEmit",
|
25
|
+
"test": "npm run test --workspace example"
|
20
26
|
},
|
21
27
|
"dependencies": {
|
22
|
-
"express": "^4.
|
23
|
-
"express-http-proxy": "^
|
24
|
-
"puppeteer": "^
|
25
|
-
"yargs": "^17.7.
|
28
|
+
"express": "^4.19.2",
|
29
|
+
"express-http-proxy": "^2.0.0",
|
30
|
+
"puppeteer": "^22.12.0",
|
31
|
+
"yargs": "^17.7.2"
|
26
32
|
},
|
27
33
|
"devDependencies": {
|
28
|
-
"@
|
29
|
-
"@
|
30
|
-
"@types/
|
31
|
-
"@types/
|
34
|
+
"@js-soft/eslint-config-ts": "^1.6.8",
|
35
|
+
"@js-soft/license-check": "^1.0.9",
|
36
|
+
"@types/express": "^4.17.21",
|
37
|
+
"@types/express-http-proxy": "^1.6.6",
|
38
|
+
"@types/node": "^20.14.8",
|
39
|
+
"@types/yargs": "^17.0.32",
|
40
|
+
"eslint": "^8.36.0",
|
41
|
+
"prettier": "^3.3.2"
|
32
42
|
},
|
33
43
|
"publishConfig": {
|
34
44
|
"access": "public"
|