@jsenv/test 3.0.26 → 3.0.28

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.
@@ -4814,7 +4814,10 @@ const reporterList = ({
4814
4814
 
4815
4815
  logOptions.group = Object.keys(testPlanResult.groups).length > 1;
4816
4816
  write(renderIntro(testPlanResult, logOptions));
4817
- if (!animatedLogEnabled) {
4817
+ if (
4818
+ !animatedLogEnabled ||
4819
+ Object.keys(testPlanResult.results).length === 0
4820
+ ) {
4818
4821
  return {
4819
4822
  afterEachInOrder: (execution) => {
4820
4823
  const log = renderExecutionLog(execution, logOptions);
@@ -4923,7 +4926,6 @@ const reporterList = ({
4923
4926
  mockFluctuatingValues, // used for snapshot testing logs
4924
4927
  spy: () => {
4925
4928
  let rawOutput = "";
4926
-
4927
4929
  return {
4928
4930
  write: (log) => {
4929
4931
  rawOutput += stripAnsi(log);
@@ -4940,7 +4942,39 @@ const reporterList = ({
4940
4942
  };
4941
4943
 
4942
4944
  const renderIntro = (testPlanResult, logOptions) => {
4945
+ const directory = logOptions.mockFluctuatingValues
4946
+ ? "/mock/"
4947
+ : urlToFileSystemPath(testPlanResult.rootDirectoryUrl);
4948
+ const numberOfFiles = Object.keys(testPlanResult.results).length;
4949
+
4950
+ let title;
4951
+ if (numberOfFiles === 0) {
4952
+ title = `no file to execute`;
4953
+ } else if (numberOfFiles === 1) {
4954
+ title = `1 file to execute`;
4955
+ } else {
4956
+ title = `${numberOfFiles} files to execute`;
4957
+ }
4943
4958
  const lines = [];
4959
+ lines.push(`directory: ${directory}`);
4960
+ if (numberOfFiles === 0) {
4961
+ let testPlanLog = "";
4962
+ testPlanLog += "{";
4963
+ testPlanLog += "\n";
4964
+ const single = testPlanResult.patterns.length === 1;
4965
+ for (const pattern of testPlanResult.patterns) {
4966
+ testPlanLog += " ";
4967
+ testPlanLog += JSON.stringify(pattern);
4968
+ testPlanLog += ": ";
4969
+ testPlanLog += "...";
4970
+ if (!single) {
4971
+ testPlanLog += ",";
4972
+ }
4973
+ }
4974
+ testPlanLog += "\n";
4975
+ testPlanLog += "}";
4976
+ lines.push(`testPlan: ${testPlanLog}`);
4977
+ }
4944
4978
  if (logOptions.platformInfo) {
4945
4979
  {
4946
4980
  let osLine = `os: `;
@@ -4961,6 +4995,7 @@ const renderIntro = (testPlanResult, logOptions) => {
4961
4995
  }),
4962
4996
  });
4963
4997
  lines.push(osLine);
4998
+ // TODO: an option to log how many cpu, memory etc we'll use?
4964
4999
  }
4965
5000
  {
4966
5001
  const process = logOptions.mockFluctuatingValues
@@ -4970,27 +5005,8 @@ const renderIntro = (testPlanResult, logOptions) => {
4970
5005
  lines.push(processLine);
4971
5006
  }
4972
5007
  }
4973
-
4974
- const directory = logOptions.mockFluctuatingValues
4975
- ? "/mock/"
4976
- : urlToFileSystemPath(testPlanResult.rootDirectoryUrl);
4977
- const numberOfFiles = Object.keys(testPlanResult.results).length;
4978
- let fileFoundLine = "";
4979
- if (numberOfFiles === 0) {
4980
- fileFoundLine += `no file matching "testPlan" in ${directory}:
4981
- ${testPlanResult.patterns.join("\n")}`;
4982
- } else if (numberOfFiles === 1) {
4983
- fileFoundLine += `1 file matching "testPlan" in ${directory}`;
4984
- } else {
4985
- fileFoundLine += `${numberOfFiles} files matching "testPlan" in ${directory}`;
4986
- }
4987
-
4988
- // TODO: an option to log how many cpu, memory etc we'll use?
4989
-
4990
- lines.push(fileFoundLine);
4991
-
4992
5008
  return `${renderBigSection({
4993
- title: "execution start",
5009
+ title,
4994
5010
  content: lines.join("\n"),
4995
5011
  })}\n`;
4996
5012
  };
@@ -5314,6 +5330,11 @@ const renderErrors = (execution, logOptions) => {
5314
5330
  };
5315
5331
 
5316
5332
  const renderOutro = (testPlanResult, logOptions = {}) => {
5333
+ const { counters } = testPlanResult;
5334
+ const { planified } = counters;
5335
+ if (planified === 0) {
5336
+ return "";
5337
+ }
5317
5338
  return `${renderBigSection({
5318
5339
  title: "",
5319
5340
  content: renderOutroContent(testPlanResult, logOptions),
@@ -5542,7 +5563,7 @@ const logsDefault = {
5542
5563
  level: "info",
5543
5564
  type: "list",
5544
5565
  animated: true,
5545
- platformInfo: false,
5566
+ platformInfo: false, // maybe true as long as not executed by npm workspace?
5546
5567
  memoryUsage: false,
5547
5568
  cpuUsage: false,
5548
5569
  fileUrl: undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.0.26",
3
+ "version": "3.0.28",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,11 +39,11 @@
39
39
  "@c88/v8-coverage": "0.1.1",
40
40
  "@jsenv/abort": "4.3.0",
41
41
  "@jsenv/ast": "6.0.7",
42
- "@jsenv/filesystem": "4.7.1",
43
- "@jsenv/github-check-run": "0.1.15",
42
+ "@jsenv/filesystem": "4.7.2",
43
+ "@jsenv/github-check-run": "0.1.16",
44
44
  "@jsenv/humanize": "1.1.3",
45
45
  "@jsenv/plugin-supervisor": "1.4.11",
46
- "@jsenv/url-meta": "8.4.1",
46
+ "@jsenv/url-meta": "8.4.2",
47
47
  "@jsenv/urls": "2.2.7",
48
48
  "@jsenv/utils": "2.1.1",
49
49
  "istanbul-lib-coverage": "3.2.2",
@@ -50,7 +50,7 @@ const logsDefault = {
50
50
  level: "info",
51
51
  type: "list",
52
52
  animated: true,
53
- platformInfo: false,
53
+ platformInfo: false, // maybe true as long as not executed by npm workspace?
54
54
  memoryUsage: false,
55
55
  cpuUsage: false,
56
56
  fileUrl: undefined,
@@ -81,7 +81,10 @@ export const reporterList = ({
81
81
 
82
82
  logOptions.group = Object.keys(testPlanResult.groups).length > 1;
83
83
  write(renderIntro(testPlanResult, logOptions));
84
- if (!animatedLogEnabled) {
84
+ if (
85
+ !animatedLogEnabled ||
86
+ Object.keys(testPlanResult.results).length === 0
87
+ ) {
85
88
  return {
86
89
  afterEachInOrder: (execution) => {
87
90
  const log = renderExecutionLog(execution, logOptions);
@@ -190,7 +193,6 @@ export const reporterList = ({
190
193
  mockFluctuatingValues, // used for snapshot testing logs
191
194
  spy: () => {
192
195
  let rawOutput = "";
193
-
194
196
  return {
195
197
  write: (log) => {
196
198
  rawOutput += stripAnsi(log);
@@ -207,7 +209,39 @@ export const reporterList = ({
207
209
  };
208
210
 
209
211
  const renderIntro = (testPlanResult, logOptions) => {
212
+ const directory = logOptions.mockFluctuatingValues
213
+ ? "/mock/"
214
+ : urlToFileSystemPath(testPlanResult.rootDirectoryUrl);
215
+ const numberOfFiles = Object.keys(testPlanResult.results).length;
216
+
217
+ let title;
218
+ if (numberOfFiles === 0) {
219
+ title = `no file to execute`;
220
+ } else if (numberOfFiles === 1) {
221
+ title = `1 file to execute`;
222
+ } else {
223
+ title = `${numberOfFiles} files to execute`;
224
+ }
210
225
  const lines = [];
226
+ lines.push(`directory: ${directory}`);
227
+ if (numberOfFiles === 0) {
228
+ let testPlanLog = "";
229
+ testPlanLog += "{";
230
+ testPlanLog += "\n";
231
+ const single = testPlanResult.patterns.length === 1;
232
+ for (const pattern of testPlanResult.patterns) {
233
+ testPlanLog += " ";
234
+ testPlanLog += JSON.stringify(pattern);
235
+ testPlanLog += ": ";
236
+ testPlanLog += "...";
237
+ if (!single) {
238
+ testPlanLog += ",";
239
+ }
240
+ }
241
+ testPlanLog += "\n";
242
+ testPlanLog += "}";
243
+ lines.push(`testPlan: ${testPlanLog}`);
244
+ }
211
245
  if (logOptions.platformInfo) {
212
246
  os_line: {
213
247
  let osLine = `os: `;
@@ -228,6 +262,7 @@ const renderIntro = (testPlanResult, logOptions) => {
228
262
  }),
229
263
  });
230
264
  lines.push(osLine);
265
+ // TODO: an option to log how many cpu, memory etc we'll use?
231
266
  }
232
267
  process_line: {
233
268
  const process = logOptions.mockFluctuatingValues
@@ -237,27 +272,8 @@ const renderIntro = (testPlanResult, logOptions) => {
237
272
  lines.push(processLine);
238
273
  }
239
274
  }
240
-
241
- const directory = logOptions.mockFluctuatingValues
242
- ? "/mock/"
243
- : urlToFileSystemPath(testPlanResult.rootDirectoryUrl);
244
- const numberOfFiles = Object.keys(testPlanResult.results).length;
245
- let fileFoundLine = "";
246
- if (numberOfFiles === 0) {
247
- fileFoundLine += `no file matching "testPlan" in ${directory}:
248
- ${testPlanResult.patterns.join("\n")}`;
249
- } else if (numberOfFiles === 1) {
250
- fileFoundLine += `1 file matching "testPlan" in ${directory}`;
251
- } else {
252
- fileFoundLine += `${numberOfFiles} files matching "testPlan" in ${directory}`;
253
- }
254
-
255
- // TODO: an option to log how many cpu, memory etc we'll use?
256
-
257
- lines.push(fileFoundLine);
258
-
259
275
  return `${renderBigSection({
260
- title: "execution start",
276
+ title,
261
277
  content: lines.join("\n"),
262
278
  })}\n`;
263
279
  };
@@ -581,6 +597,11 @@ const renderErrors = (execution, logOptions) => {
581
597
  };
582
598
 
583
599
  const renderOutro = (testPlanResult, logOptions = {}) => {
600
+ const { counters } = testPlanResult;
601
+ const { planified } = counters;
602
+ if (planified === 0) {
603
+ return "";
604
+ }
584
605
  return `${renderBigSection({
585
606
  title: "",
586
607
  content: renderOutroContent(testPlanResult, logOptions),