@browsermation/test 0.0.2 → 0.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/dist/bin/cli.js +1 -1
- package/dist/index.js +38 -2
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -42869,7 +42869,7 @@ var {
|
|
|
42869
42869
|
// package.json
|
|
42870
42870
|
var package_default = {
|
|
42871
42871
|
name: "@browsermation/test",
|
|
42872
|
-
version: "0.0.
|
|
42872
|
+
version: "0.0.3",
|
|
42873
42873
|
description: "The testing platform for Playwright by Browsermation.",
|
|
42874
42874
|
main: "dist/index.js",
|
|
42875
42875
|
exports: {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -25,9 +35,35 @@ __export(index_exports, {
|
|
|
25
35
|
module.exports = __toCommonJS(index_exports);
|
|
26
36
|
|
|
27
37
|
// src/defineConfig.ts
|
|
28
|
-
|
|
38
|
+
var import_node_https = __toESM(require("node:https"));
|
|
39
|
+
async function fetchEndpoint() {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
import_node_https.default.get(process.env.SERVER_URL || "", (res) => {
|
|
42
|
+
res.on("data", async (chunk) => {
|
|
43
|
+
try {
|
|
44
|
+
const parsedData = JSON.parse(chunk.toString());
|
|
45
|
+
if (parsedData.type === "ws-endpoint") {
|
|
46
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
47
|
+
resolve(parsedData.wsEndpoint);
|
|
48
|
+
res.destroy();
|
|
49
|
+
}
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.log(chunk.toString());
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async function defineConfig(config) {
|
|
58
|
+
const endpointUrl = await fetchEndpoint();
|
|
29
59
|
return {
|
|
30
|
-
|
|
60
|
+
...config,
|
|
61
|
+
use: {
|
|
62
|
+
...config.use,
|
|
63
|
+
connectOptions: {
|
|
64
|
+
wsEndpoint: endpointUrl
|
|
65
|
+
}
|
|
66
|
+
}
|
|
31
67
|
};
|
|
32
68
|
}
|
|
33
69
|
// Annotate the CommonJS export names for ESM import in node:
|