@sentinelqa/playwright 0.1.1 → 0.1.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/env.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const loadSentinelEnv: () => void;
package/dist/env.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadSentinelEnv = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const parseLine = (line) => {
10
+ const trimmed = line.trim();
11
+ if (!trimmed || trimmed.startsWith("#"))
12
+ return null;
13
+ const eqIndex = trimmed.indexOf("=");
14
+ if (eqIndex === -1)
15
+ return null;
16
+ const key = trimmed.slice(0, eqIndex).trim();
17
+ if (!key)
18
+ return null;
19
+ let value = trimmed.slice(eqIndex + 1).trim();
20
+ if ((value.startsWith('"') && value.endsWith('"')) ||
21
+ (value.startsWith("'") && value.endsWith("'"))) {
22
+ value = value.slice(1, -1);
23
+ }
24
+ return { key, value };
25
+ };
26
+ const loadSentinelEnv = () => {
27
+ const candidates = [".env", ".env.local"];
28
+ for (const candidate of candidates) {
29
+ const fullPath = path_1.default.resolve(process.cwd(), candidate);
30
+ if (!fs_1.default.existsSync(fullPath))
31
+ continue;
32
+ if (!fs_1.default.statSync(fullPath).isFile())
33
+ continue;
34
+ const raw = fs_1.default.readFileSync(fullPath, "utf8");
35
+ for (const line of raw.split(/\r?\n/)) {
36
+ const parsed = parseLine(line);
37
+ if (!parsed)
38
+ continue;
39
+ if (typeof process.env[parsed.key] === "undefined") {
40
+ process.env[parsed.key] = parsed.value;
41
+ }
42
+ }
43
+ }
44
+ };
45
+ exports.loadSentinelEnv = loadSentinelEnv;
package/dist/reporter.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  const node_1 = require("@sentinelqa/uploader/node");
3
+ const env_1 = require("./env");
3
4
  const pluralize = (count, singular, plural) => {
4
5
  return count === 1 ? singular : plural;
5
6
  };
@@ -7,6 +8,7 @@ class SentinelReporter {
7
8
  constructor(options) {
8
9
  this.failedCount = 0;
9
10
  this.totalCount = 0;
11
+ (0, env_1.loadSentinelEnv)();
10
12
  this.options = options;
11
13
  }
12
14
  onBegin(config, suite) {
@@ -26,6 +28,8 @@ class SentinelReporter {
26
28
  console.log("Playwright run finished");
27
29
  console.log(`${this.failedCount} ${pluralize(this.failedCount, "test", "tests")} failed`);
28
30
  if (!process.env.SENTINEL_TOKEN) {
31
+ console.log("");
32
+ console.log("Sentinel upload disabled. Set SENTINEL_TOKEN to enable uploads.");
29
33
  return;
30
34
  }
31
35
  const hasCiEnv = (0, node_1.hasSupportedCiEnv)(process.env);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentinelqa/playwright",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "description": "Playwright config wrapper and reporter for SentinelQA",
6
6
  "license": "MIT",