@empiricalrun/test-run 0.10.1 → 0.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @empiricalrun/test-run
2
2
 
3
+ ## 0.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - cfb157a: fix: follow-ups for playwright reporter upgrade
8
+
9
+ ## 0.10.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 9b873e3: fix: escape special characters before creating test-run command
14
+ - 8a83b29: fix: ts-node not found error
15
+
3
16
  ## 0.10.1
4
17
 
5
18
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAIF,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,EACnB,iBAAiB,MAAM,KACtB,OAAO,CAAC;IACT,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;CACd,CAuDA,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAa,OAAO,CACxD,mBAAmB,EAAE,CA0CtB,CAAC"}
1
+ {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../src/dashboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAIF,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,EACnB,iBAAiB,MAAM,KACtB,OAAO,CAAC;IACT,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;CACd,CAwDA,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAa,OAAO,CACxD,mBAAmB,EAAE,CA0CtB,CAAC"}
package/dist/dashboard.js CHANGED
@@ -14,6 +14,7 @@ const fetchEnvironmentAndBuild = async (projectName, environmentSlug) => {
14
14
  console.error("No API token found. Skipping fetch environment and latest build from dashboard.");
15
15
  return;
16
16
  }
17
+ // TODO: This API endpoint is deprecated. We should use the /list endpoint instead.
17
18
  const resp = await fetch(`${DOMAIN}/api/environments?project_repo_name=${projectRepo}&environment_slug=${environmentSlug}`, {
18
19
  method: "GET",
19
20
  headers: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7C,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAC;AAEzC,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;;;GAiBA;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACvE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;CACjD,CAAC,CAaD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7C,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAC;AAczC,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;;;GAiBA;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACvE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;CACjD,CAAC,CAaD"}
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.spawnCmd = exports.runSpecificTestsCmd = void 0;
7
7
  exports.runSingleTest = runSingleTest;
8
8
  exports.getAllPlaywrightProjects = getAllPlaywrightProjects;
9
- const promises_1 = __importDefault(require("fs/promises"));
9
+ const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const cmd_1 = require("./lib/cmd");
12
12
  Object.defineProperty(exports, "spawnCmd", { enumerable: true, get: function () { return cmd_1.spawnCmd; } });
@@ -18,6 +18,13 @@ const utils_1 = require("./utils");
18
18
  // For test-run package, the library entrypoint, we only support web platform
19
19
  // The bin entrypoint has support for mobile also
20
20
  const supportedPlatform = types_1.Platform.WEB;
21
+ function getSummaryJsonPath(repoDir) {
22
+ const pathForPlaywright147 = path_1.default.join(repoDir, "playwright-report", "summary.json");
23
+ const pathForOtherPlaywrightVersions = path_1.default.join(repoDir, "summary.json");
24
+ return fs_1.default.existsSync(pathForPlaywright147)
25
+ ? pathForPlaywright147
26
+ : pathForOtherPlaywrightVersions;
27
+ }
21
28
  async function runSingleTest({ testName, suites, filePath, projects, envOverrides, repoDir, }) {
22
29
  const testDir = "tests";
23
30
  const commandToRun = await (0, run_specific_test_1.runSpecificTestsCmd)({
@@ -28,8 +35,8 @@ async function runSingleTest({ testName, suites, filePath, projects, envOverride
28
35
  repoDir,
29
36
  });
30
37
  const { hasTestPassed } = await (0, cmd_1.runTestsForCmd)(commandToRun, repoDir);
31
- const jsonFilePath = path_1.default.join(repoDir, "playwright-report", `summary.json`);
32
- const jsonFileContents = await promises_1.default.readFile(jsonFilePath, "utf8");
38
+ const jsonFilePath = getSummaryJsonPath(repoDir);
39
+ const jsonFileContents = fs_1.default.readFileSync(jsonFilePath, "utf8");
33
40
  const summaryJson = JSON.parse(jsonFileContents);
34
41
  return {
35
42
  hasTestPassed,
package/dist/lib/cmd.js CHANGED
@@ -12,7 +12,7 @@ function getCommandFromString(command) {
12
12
  args: matches.slice(1).map((match) => {
13
13
  if ((match.startsWith('"') && match.endsWith('"')) ||
14
14
  (match.startsWith("'") && match.endsWith("'"))) {
15
- return match.slice(1, -1);
15
+ return match.slice(1, -1).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16
16
  }
17
17
  return match;
18
18
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../../src/lib/run-all-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAQ5D,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,eAAe,EACf,cAAc,EACd,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GAAG,YAAY,CAyBf"}
1
+ {"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../../src/lib/run-all-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAQ5D,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,eAAe,EACf,cAAc,EACd,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GAAG,YAAY,CAsBf"}
@@ -15,14 +15,13 @@ function runAllTestsCmd({ projects, passthroughArgs, patternsToGrep, filesFilter
15
15
  .map((pattern) => ` -g "${pattern}"`)
16
16
  .join(" ");
17
17
  let args = ` ${filesFilter || ""} ${grepArgs} ${projectsArg} ${passthroughArgs || ""}`;
18
- const env = Object.assign({ ...process.env, PW_TEST_HTML_REPORT_OPEN: "never" }, envOverrides);
19
- if (process.env.RUN_PLAYWRIGHT_HEADED &&
20
- process.env.RUN_PLAYWRIGHT_HEADED === "true") {
18
+ const envVars = Object.assign({ ...process.env, PW_TEST_HTML_REPORT_OPEN: "never" }, envOverrides);
19
+ if (envVars.RUN_PLAYWRIGHT_HEADED === "true") {
21
20
  args = `${args} --headed`;
22
21
  }
23
22
  const testRunCmd = normalizeSpaces(`npx ${testRunner} test ${args}`);
24
23
  return {
25
24
  ...(0, cmd_1.getCommandFromString)(testRunCmd),
26
- env,
25
+ env: envVars,
27
26
  };
28
27
  }
@@ -19,7 +19,7 @@ async function getProjectsFromPlaywrightConfig(platform, repoDir) {
19
19
  const projects = configModule.default.projects;
20
20
  console.log(JSON.stringify(projects));
21
21
  `);
22
- const result = (0, child_process_1.execSync)(`npx -y ts-node ${tmpScriptPath}`, {
22
+ const result = (0, child_process_1.execSync)(`npx -y ts-node@latest ${tmpScriptPath}`, {
23
23
  encoding: "utf8",
24
24
  env: {
25
25
  ...process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-run",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"