@jsenv/test 3.0.27 → 3.1.0

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,41 @@ 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
+ const { counters } = testPlanResult;
4950
+ const { planified } = counters;
4951
+
4952
+ let title;
4953
+ if (planified === 0) {
4954
+ title = `no file to execute`;
4955
+ } else if (planified === 1) {
4956
+ title = `1 execution planified`;
4957
+ } else {
4958
+ title = `${planified} executions planified`;
4959
+ }
4943
4960
  const lines = [];
4961
+ lines.push(`directory: ${directory}`);
4962
+ if (numberOfFiles === 0) {
4963
+ let testPlanLog = "";
4964
+ testPlanLog += "{";
4965
+ testPlanLog += "\n";
4966
+ const single = testPlanResult.patterns.length === 1;
4967
+ for (const pattern of testPlanResult.patterns) {
4968
+ testPlanLog += " ";
4969
+ testPlanLog += JSON.stringify(pattern);
4970
+ testPlanLog += ": ";
4971
+ testPlanLog += "...";
4972
+ if (!single) {
4973
+ testPlanLog += ",";
4974
+ }
4975
+ }
4976
+ testPlanLog += "\n";
4977
+ testPlanLog += "}";
4978
+ lines.push(`testPlan: ${testPlanLog}`);
4979
+ }
4944
4980
  if (logOptions.platformInfo) {
4945
4981
  {
4946
4982
  let osLine = `os: `;
@@ -4961,6 +4997,7 @@ const renderIntro = (testPlanResult, logOptions) => {
4961
4997
  }),
4962
4998
  });
4963
4999
  lines.push(osLine);
5000
+ // TODO: an option to log how many cpu, memory etc we'll use?
4964
5001
  }
4965
5002
  {
4966
5003
  const process = logOptions.mockFluctuatingValues
@@ -4970,27 +5007,8 @@ const renderIntro = (testPlanResult, logOptions) => {
4970
5007
  lines.push(processLine);
4971
5008
  }
4972
5009
  }
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
5010
  return `${renderBigSection({
4993
- title: "execution start",
5011
+ title,
4994
5012
  content: lines.join("\n"),
4995
5013
  })}\n`;
4996
5014
  };
@@ -5314,8 +5332,21 @@ const renderErrors = (execution, logOptions) => {
5314
5332
  };
5315
5333
 
5316
5334
  const renderOutro = (testPlanResult, logOptions = {}) => {
5335
+ const { counters } = testPlanResult;
5336
+ const { planified } = counters;
5337
+ if (planified === 0) {
5338
+ return "";
5339
+ }
5340
+ let title;
5341
+ if (planified === 0) {
5342
+ title = `no execution`;
5343
+ } else if (planified === 1) {
5344
+ title = `1 execution done`;
5345
+ } else {
5346
+ title = `${planified} executions done`;
5347
+ }
5317
5348
  return `${renderBigSection({
5318
- title: "",
5349
+ title,
5319
5350
  content: renderOutroContent(testPlanResult, logOptions),
5320
5351
  })}\n`;
5321
5352
  };
@@ -5323,17 +5354,8 @@ const renderOutro = (testPlanResult, logOptions = {}) => {
5323
5354
  const renderOutroContent = (testPlanResult, logOptions = {}) => {
5324
5355
  const lines = [];
5325
5356
  const { counters } = testPlanResult;
5326
- const { planified } = counters;
5327
5357
 
5328
- let executionLine = "";
5329
- if (planified === 0) {
5330
- executionLine += `no execution`;
5331
- } else if (planified === 1) {
5332
- executionLine += `1 execution: `;
5333
- } else {
5334
- executionLine += `${planified} executions: `;
5335
- }
5336
- executionLine += renderStatusRepartition(counters);
5358
+ let executionLine = `status: ${renderStatusRepartition(counters)}`;
5337
5359
  lines.push(executionLine);
5338
5360
 
5339
5361
  let durationLine = `duration: `;
@@ -5542,7 +5564,7 @@ const logsDefault = {
5542
5564
  level: "info",
5543
5565
  type: "list",
5544
5566
  animated: true,
5545
- platformInfo: false,
5567
+ platformInfo: false, // maybe true as long as not executed by npm workspace?
5546
5568
  memoryUsage: false,
5547
5569
  cpuUsage: false,
5548
5570
  fileUrl: undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.0.27",
3
+ "version": "3.1.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,11 +38,11 @@
38
38
  "dependencies": {
39
39
  "@c88/v8-coverage": "0.1.1",
40
40
  "@jsenv/abort": "4.3.0",
41
- "@jsenv/ast": "6.0.7",
41
+ "@jsenv/ast": "6.1.0",
42
42
  "@jsenv/filesystem": "4.7.2",
43
43
  "@jsenv/github-check-run": "0.1.16",
44
44
  "@jsenv/humanize": "1.1.3",
45
- "@jsenv/plugin-supervisor": "1.4.11",
45
+ "@jsenv/plugin-supervisor": "1.4.12",
46
46
  "@jsenv/url-meta": "8.4.2",
47
47
  "@jsenv/urls": "2.2.7",
48
48
  "@jsenv/utils": "2.1.1",
@@ -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,41 @@ 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
+ const { counters } = testPlanResult;
217
+ const { planified } = counters;
218
+
219
+ let title;
220
+ if (planified === 0) {
221
+ title = `no file to execute`;
222
+ } else if (planified === 1) {
223
+ title = `1 execution planified`;
224
+ } else {
225
+ title = `${planified} executions planified`;
226
+ }
210
227
  const lines = [];
228
+ lines.push(`directory: ${directory}`);
229
+ if (numberOfFiles === 0) {
230
+ let testPlanLog = "";
231
+ testPlanLog += "{";
232
+ testPlanLog += "\n";
233
+ const single = testPlanResult.patterns.length === 1;
234
+ for (const pattern of testPlanResult.patterns) {
235
+ testPlanLog += " ";
236
+ testPlanLog += JSON.stringify(pattern);
237
+ testPlanLog += ": ";
238
+ testPlanLog += "...";
239
+ if (!single) {
240
+ testPlanLog += ",";
241
+ }
242
+ }
243
+ testPlanLog += "\n";
244
+ testPlanLog += "}";
245
+ lines.push(`testPlan: ${testPlanLog}`);
246
+ }
211
247
  if (logOptions.platformInfo) {
212
248
  os_line: {
213
249
  let osLine = `os: `;
@@ -228,6 +264,7 @@ const renderIntro = (testPlanResult, logOptions) => {
228
264
  }),
229
265
  });
230
266
  lines.push(osLine);
267
+ // TODO: an option to log how many cpu, memory etc we'll use?
231
268
  }
232
269
  process_line: {
233
270
  const process = logOptions.mockFluctuatingValues
@@ -237,27 +274,8 @@ const renderIntro = (testPlanResult, logOptions) => {
237
274
  lines.push(processLine);
238
275
  }
239
276
  }
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
277
  return `${renderBigSection({
260
- title: "execution start",
278
+ title,
261
279
  content: lines.join("\n"),
262
280
  })}\n`;
263
281
  };
@@ -581,8 +599,21 @@ const renderErrors = (execution, logOptions) => {
581
599
  };
582
600
 
583
601
  const renderOutro = (testPlanResult, logOptions = {}) => {
602
+ const { counters } = testPlanResult;
603
+ const { planified } = counters;
604
+ if (planified === 0) {
605
+ return "";
606
+ }
607
+ let title;
608
+ if (planified === 0) {
609
+ title = `no execution`;
610
+ } else if (planified === 1) {
611
+ title = `1 execution done`;
612
+ } else {
613
+ title = `${planified} executions done`;
614
+ }
584
615
  return `${renderBigSection({
585
- title: "",
616
+ title,
586
617
  content: renderOutroContent(testPlanResult, logOptions),
587
618
  })}\n`;
588
619
  };
@@ -590,17 +621,8 @@ const renderOutro = (testPlanResult, logOptions = {}) => {
590
621
  export const renderOutroContent = (testPlanResult, logOptions = {}) => {
591
622
  const lines = [];
592
623
  const { counters } = testPlanResult;
593
- const { planified } = counters;
594
624
 
595
- let executionLine = "";
596
- if (planified === 0) {
597
- executionLine += `no execution`;
598
- } else if (planified === 1) {
599
- executionLine += `1 execution: `;
600
- } else {
601
- executionLine += `${planified} executions: `;
602
- }
603
- executionLine += renderStatusRepartition(counters);
625
+ let executionLine = `status: ${renderStatusRepartition(counters)}`;
604
626
  lines.push(executionLine);
605
627
 
606
628
  let durationLine = `duration: `;