@browsermation/test 0.0.24 → 0.0.26

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/core.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Readable } from 'node:stream';
2
- import 'dotenv/config';
3
2
  /**
4
3
  * The main function that orchestrates zipping and uploading.
5
4
  * @param folderPath The path to the folder to process.
@@ -1,2 +1,2 @@
1
1
  import { PlaywrightTestConfig } from 'playwright/test';
2
- export declare function defineConfig(config: PlaywrightTestConfig): Promise<PlaywrightTestConfig>;
2
+ export declare function defineConfig<T extends PlaywrightTestConfig>(config: T): Promise<T & PlaywrightTestConfig>;
package/dist/index.js CHANGED
@@ -37,21 +37,7 @@ module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/defineConfig.ts
39
39
  var import_node_https = __toESM(require("node:https"));
40
-
41
- // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
42
- var isProduction = process.env.NODE_ENV === "production";
43
- var prefix = "Invariant failed";
44
- function invariant(condition, message) {
45
- if (condition) {
46
- return;
47
- }
48
- if (isProduction) {
49
- throw new Error(prefix);
50
- }
51
- var provided = typeof message === "function" ? message() : message;
52
- var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
53
- throw new Error(value);
54
- }
40
+ var import_node_http = __toESM(require("node:http"));
55
41
 
56
42
  // node_modules/chalk/source/vendor/ansi-styles/index.js
57
43
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -551,6 +537,14 @@ var source_default = chalk;
551
537
  // src/tunnel.ts
552
538
  var import_node_child_process = require("node:child_process");
553
539
  function startTunnel(tunnelProcess2, options) {
540
+ if (!process.env.TUNNEL_TOKEN) {
541
+ console.error(
542
+ source_default.red.bold(
543
+ "\u274C Error: TUNNEL_TOKEN environment variable is not set. Please set it to your tunnel token."
544
+ )
545
+ );
546
+ process.exit(1);
547
+ }
554
548
  const tunnelDomain = `${options.subdomain || crypto.randomUUID()}.browsermationtunnel.com`;
555
549
  tunnelProcess2 = (0, import_node_child_process.spawn)("ssh", [
556
550
  "-o",
@@ -595,12 +589,24 @@ function startTunnel(tunnelProcess2, options) {
595
589
 
596
590
  // src/defineConfig.ts
597
591
  async function fetchEndpoint() {
598
- invariant(
599
- process.env.SERVER_URL,
600
- "SERVER_URL environment variable is not set"
601
- );
592
+ if (!process.env.SERVER_URL) {
593
+ console.error(
594
+ source_default.red.bold("\u274C Error: SERVER_URL environment variable is not set")
595
+ );
596
+ process.exit(1);
597
+ }
598
+ let protocol = import_node_https.default;
599
+ if (process.env.SERVER_URL.startsWith("http:")) {
600
+ protocol = import_node_http.default;
601
+ }
602
602
  return new Promise((resolve, reject) => {
603
- import_node_https.default.get(process.env.SERVER_URL || "", (res) => {
603
+ protocol.get(process.env.SERVER_URL || "", (res) => {
604
+ if (res.statusCode && (res.statusCode < 200 || res.statusCode >= 300)) {
605
+ return reject(new Error(`HTTP status code ${res.statusCode} received`));
606
+ }
607
+ res.on("error", (err) => {
608
+ reject(err);
609
+ });
604
610
  res.on("data", async (chunk) => {
605
611
  try {
606
612
  const parsedData = JSON.parse(chunk.toString());
@@ -638,7 +644,7 @@ async function defineConfig(config) {
638
644
  };
639
645
  }
640
646
 
641
- // ../../node_modules/@playwright/test/index.mjs
647
+ // node_modules/@playwright/test/index.mjs
642
648
  var test_exports = {};
643
649
  __export(test_exports, {
644
650
  default: () => import_test.default
@@ -648,6 +654,23 @@ var import_test = __toESM(require("playwright/test"), 1);
648
654
 
649
655
  // src/test.ts
650
656
  var import_node_https2 = __toESM(require("node:https"));
657
+
658
+ // node_modules/tiny-invariant/dist/esm/tiny-invariant.js
659
+ var isProduction = process.env.NODE_ENV === "production";
660
+ var prefix = "Invariant failed";
661
+ function invariant(condition, message) {
662
+ if (condition) {
663
+ return;
664
+ }
665
+ if (isProduction) {
666
+ throw new Error(prefix);
667
+ }
668
+ var provided = typeof message === "function" ? message() : message;
669
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
670
+ throw new Error(value);
671
+ }
672
+
673
+ // src/test.ts
651
674
  async function fetchEndpoint2() {
652
675
  invariant(
653
676
  process.env.SERVER_URL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsermation/test",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "The testing platform for Playwright by Browsermation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -50,6 +50,7 @@
50
50
  "typescript": "^5.9.2"
51
51
  },
52
52
  "dependencies": {
53
+ "@playwright/test": "^1.55.0",
53
54
  "archiver": "^7.0.1",
54
55
  "axios": "^1.10.0",
55
56
  "chalk": "^5.4.1",