bt-runner 3.1.0 → 3.3.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/dist/index.js +0 -0
- package/dist/index_debug.js +0 -0
- package/dist/util/Server.js +10 -1
- package/dist/util/runTests.js +7 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
File without changes
|
package/dist/index_debug.js
CHANGED
File without changes
|
package/dist/util/Server.js
CHANGED
@@ -50,13 +50,22 @@ class Server {
|
|
50
50
|
app.use("/test", express_1.default.static(this.testFolder));
|
51
51
|
if (this.config.proxies) {
|
52
52
|
const httpproxy = require("express-http-proxy");
|
53
|
-
|
53
|
+
const proxies = this.config.proxies.map((proxy) => this.transformProxy(proxy));
|
54
|
+
for (const proxy of proxies) {
|
54
55
|
app.use(proxy.local, httpproxy(proxy.remote));
|
55
56
|
}
|
56
57
|
}
|
57
58
|
this.server = app.listen(this.port, () => { });
|
58
59
|
return this;
|
59
60
|
}
|
61
|
+
transformProxy(proxy) {
|
62
|
+
if ("remote" in proxy)
|
63
|
+
return proxy;
|
64
|
+
const remoteFromEnv = process.env[proxy.env];
|
65
|
+
if (!remoteFromEnv)
|
66
|
+
throw new Error(`No environment variable found for proxy: ${proxy.env}`);
|
67
|
+
return { local: proxy.local, remote: remoteFromEnv };
|
68
|
+
}
|
60
69
|
stop() {
|
61
70
|
this.server?.close();
|
62
71
|
}
|
package/dist/util/runTests.js
CHANGED
@@ -19,6 +19,13 @@ async function runTests(serverPort, testRunners) {
|
|
19
19
|
const runnerNumber = i + 1;
|
20
20
|
console.log(`Running test runner ${runnerNumber}`);
|
21
21
|
await page.goto(`http://localhost:${serverPort}/test-browser/index${runnerNumber}.html`);
|
22
|
+
// patch all process.env variables into the browsers "process.env"
|
23
|
+
await page.evaluate((params) => {
|
24
|
+
// @ts-expect-error
|
25
|
+
globalThis.process = globalThis.process ?? {};
|
26
|
+
globalThis.process.env = globalThis.process.env ?? {};
|
27
|
+
globalThis.process.env = { ...globalThis.process.env, ...params };
|
28
|
+
}, process.env);
|
22
29
|
const globals = runner.globals ?? [];
|
23
30
|
globals.push("mocha");
|
24
31
|
const result = await page.evaluate(async (globals) => {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bt-runner",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.3.0",
|
4
4
|
"description": "",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -20,16 +20,16 @@
|
|
20
20
|
"prepublishOnly": "tsc"
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
|
-
"express": "^4.18.
|
23
|
+
"express": "^4.18.2",
|
24
24
|
"express-http-proxy": "^1.6.3",
|
25
25
|
"puppeteer": "^16.2.0",
|
26
|
-
"yargs": "^17.
|
26
|
+
"yargs": "^17.7.1"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
|
-
"@types/express": "^4.17.
|
29
|
+
"@types/express": "^4.17.17",
|
30
30
|
"@types/express-http-proxy": "^1.6.3",
|
31
|
-
"@types/node": "^18.
|
32
|
-
"@types/yargs": "^17.0.
|
31
|
+
"@types/node": "^18.14.6",
|
32
|
+
"@types/yargs": "^17.0.22"
|
33
33
|
},
|
34
34
|
"publishConfig": {
|
35
35
|
"access": "public"
|