@jsenv/test 3.4.1 → 3.4.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.
@@ -4143,26 +4143,28 @@ const formatErrorForTerminal = (
4143
4143
  error.site.url.startsWith("file:") &&
4144
4144
  typeof error.site.line === "number"
4145
4145
  ) {
4146
- const content = readFileSync(new URL(error.site.url), "utf8");
4147
- text += generateContentFrame({
4148
- content,
4149
- line: error.site.line,
4150
- column: error.site.column,
4151
- linesAbove: 2,
4152
- linesBelow: 0,
4153
- lineMaxWidth: process.stdout.columns,
4154
- format: (string, type) => {
4155
- return {
4156
- line_number_aside: () => ANSI.color(string, ANSI.GREY),
4157
- char: () => string,
4158
- marker_overflow_left: () => ANSI.color(string, ANSI.GREY),
4159
- marker_overflow_right: () => ANSI.color(string, ANSI.GREY),
4160
- marker_line: () => ANSI.color(string, ANSI.RED),
4161
- marker_column: () => ANSI.color(string, ANSI.RED),
4162
- }[type]();
4163
- },
4164
- });
4165
- text += `\n`;
4146
+ try {
4147
+ const content = readFileSync(new URL(error.site.url), "utf8");
4148
+ text += generateContentFrame({
4149
+ content,
4150
+ line: error.site.line,
4151
+ column: error.site.column,
4152
+ linesAbove: 2,
4153
+ linesBelow: 0,
4154
+ lineMaxWidth: process.stdout.columns,
4155
+ format: (string, type) => {
4156
+ return {
4157
+ line_number_aside: () => ANSI.color(string, ANSI.GREY),
4158
+ char: () => string,
4159
+ marker_overflow_left: () => ANSI.color(string, ANSI.GREY),
4160
+ marker_overflow_right: () => ANSI.color(string, ANSI.GREY),
4161
+ marker_line: () => ANSI.color(string, ANSI.RED),
4162
+ marker_column: () => ANSI.color(string, ANSI.RED),
4163
+ }[type]();
4164
+ },
4165
+ });
4166
+ text += `\n`;
4167
+ } catch {}
4166
4168
  }
4167
4169
  }
4168
4170
  text += `${error.name}: ${error.message}`;
@@ -5576,7 +5578,7 @@ const startServerUsingCommand = async (
5576
5578
  if (timeoutAbortSource.signal.aborted) {
5577
5579
  // aborted by timeout
5578
5580
  throw new Error(
5579
- `"${webServer.command}" command did not start a server in less than ${allocatedMs}ms`,
5581
+ `"${webServer.command}" command did not start a server at ${webServer.origin} in less than ${allocatedMs}ms`,
5580
5582
  );
5581
5583
  }
5582
5584
  if (signal.aborted) {
@@ -9208,11 +9210,24 @@ const reportAsJunitXml = async (
9208
9210
  const testCase = testSuite.createNode("testcase", {
9209
9211
  file: fileRelativeUrl,
9210
9212
  name: group,
9211
- time: mockFluctuatingValues ? "[mock]" : executionResult.timings.end, // duration of this execution
9212
- timestamp: mockFluctuatingValues
9213
+ // duration of this execution
9214
+ time: mockFluctuatingValues
9213
9215
  ? "[mock]"
9214
- : new Date(executionResult.timings.origin).toISOString().slice(0, -5), // Date and time of when the test run was executed
9215
- tests: 1, // Total number of tests for this execution
9216
+ : executionResult.status === "skipped"
9217
+ ? 0
9218
+ : executionResult.timings.end,
9219
+ // Date and time of when the test run was executed
9220
+ ...(executionResult.status === "skipped"
9221
+ ? {}
9222
+ : {
9223
+ timestamp: mockFluctuatingValues
9224
+ ? "[mock]"
9225
+ : new Date(executionResult.timings.origin)
9226
+ .toISOString()
9227
+ .slice(0, -5),
9228
+ }),
9229
+ // Total number of tests for this execution
9230
+ tests: 1,
9216
9231
  });
9217
9232
  testSuite.appendChild(testCase);
9218
9233
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.4.1",
3
+ "version": "3.4.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,7 @@
41
41
  "@jsenv/ast": "6.2.16",
42
42
  "@jsenv/exception": "1.1.2",
43
43
  "@jsenv/filesystem": "4.10.2",
44
- "@jsenv/github-check-run": "0.1.32",
44
+ "@jsenv/github-check-run": "0.2.0",
45
45
  "@jsenv/humanize": "1.2.8",
46
46
  "@jsenv/plugin-supervisor": "1.5.18",
47
47
  "@jsenv/sourcemap": "1.2.23",
@@ -25,7 +25,6 @@ import {
25
25
  import { memoryUsage } from "node:process";
26
26
  import { takeCoverage } from "node:v8";
27
27
  import stripAnsi from "strip-ansi";
28
-
29
28
  import { generateCoverage } from "../coverage/generate_coverage.js";
30
29
  import { createCallOrderer } from "../helpers/call_orderer.js";
31
30
  import { startMeasuringTotalCpuUsage } from "../helpers/cpu_usage.js";
@@ -25,26 +25,28 @@ export const formatErrorForTerminal = (
25
25
  error.site.url.startsWith("file:") &&
26
26
  typeof error.site.line === "number"
27
27
  ) {
28
- const content = readFileSync(new URL(error.site.url), "utf8");
29
- text += generateContentFrame({
30
- content,
31
- line: error.site.line,
32
- column: error.site.column,
33
- linesAbove: 2,
34
- linesBelow: 0,
35
- lineMaxWidth: process.stdout.columns,
36
- format: (string, type) => {
37
- return {
38
- line_number_aside: () => ANSI.color(string, ANSI.GREY),
39
- char: () => string,
40
- marker_overflow_left: () => ANSI.color(string, ANSI.GREY),
41
- marker_overflow_right: () => ANSI.color(string, ANSI.GREY),
42
- marker_line: () => ANSI.color(string, ANSI.RED),
43
- marker_column: () => ANSI.color(string, ANSI.RED),
44
- }[type]();
45
- },
46
- });
47
- text += `\n`;
28
+ try {
29
+ const content = readFileSync(new URL(error.site.url), "utf8");
30
+ text += generateContentFrame({
31
+ content,
32
+ line: error.site.line,
33
+ column: error.site.column,
34
+ linesAbove: 2,
35
+ linesBelow: 0,
36
+ lineMaxWidth: process.stdout.columns,
37
+ format: (string, type) => {
38
+ return {
39
+ line_number_aside: () => ANSI.color(string, ANSI.GREY),
40
+ char: () => string,
41
+ marker_overflow_left: () => ANSI.color(string, ANSI.GREY),
42
+ marker_overflow_right: () => ANSI.color(string, ANSI.GREY),
43
+ marker_line: () => ANSI.color(string, ANSI.RED),
44
+ marker_column: () => ANSI.color(string, ANSI.RED),
45
+ }[type]();
46
+ },
47
+ });
48
+ text += `\n`;
49
+ } catch {}
48
50
  }
49
51
  }
50
52
  text += `${error.name}: ${error.message}`;
@@ -38,11 +38,24 @@ export const reportAsJunitXml = async (
38
38
  const testCase = testSuite.createNode("testcase", {
39
39
  file: fileRelativeUrl,
40
40
  name: group,
41
- time: mockFluctuatingValues ? "[mock]" : executionResult.timings.end, // duration of this execution
42
- timestamp: mockFluctuatingValues
41
+ // duration of this execution
42
+ time: mockFluctuatingValues
43
43
  ? "[mock]"
44
- : new Date(executionResult.timings.origin).toISOString().slice(0, -5), // Date and time of when the test run was executed
45
- tests: 1, // Total number of tests for this execution
44
+ : executionResult.status === "skipped"
45
+ ? 0
46
+ : executionResult.timings.end,
47
+ // Date and time of when the test run was executed
48
+ ...(executionResult.status === "skipped"
49
+ ? {}
50
+ : {
51
+ timestamp: mockFluctuatingValues
52
+ ? "[mock]"
53
+ : new Date(executionResult.timings.origin)
54
+ .toISOString()
55
+ .slice(0, -5),
56
+ }),
57
+ // Total number of tests for this execution
58
+ tests: 1,
46
59
  });
47
60
  testSuite.appendChild(testCase);
48
61
 
@@ -117,7 +117,7 @@ export const startServerUsingCommand = async (
117
117
  if (timeoutAbortSource.signal.aborted) {
118
118
  // aborted by timeout
119
119
  throw new Error(
120
- `"${webServer.command}" command did not start a server in less than ${allocatedMs}ms`,
120
+ `"${webServer.command}" command did not start a server at ${webServer.origin} in less than ${allocatedMs}ms`,
121
121
  );
122
122
  }
123
123
  if (signal.aborted) {