@locustjs/test 1.1.4 → 1.1.5

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/index.cjs.js CHANGED
@@ -433,9 +433,9 @@ class Test {
433
433
  }
434
434
  run() {
435
435
  return new Promise(res => {
436
+ const start = new Date();
436
437
  if (isFunction(this.fn)) {
437
438
  try {
438
- const start = new Date();
439
439
  const _result = this.fn(expect);
440
440
  if (_result && isFunction(_result.then)) {
441
441
  _result.then(result => {
@@ -640,7 +640,7 @@ class TestRunner {
640
640
  const content = JSON.stringify({
641
641
  results: this._results,
642
642
  errors: this._errors
643
- });
643
+ }, null, '\t');
644
644
  if (filename == null) {
645
645
  const d = new Date();
646
646
  const year = d.getFullYear().toString().padStart(4, '0');
@@ -649,7 +649,7 @@ class TestRunner {
649
649
  const hours = d.getHours().toString().padStart(2, '0');
650
650
  const minutes = d.getMinutes().toString().padStart(2, '0');
651
651
  const seconds = d.getSeconds().toString().padStart(2, '0');
652
- filename = `test-${year}-${month}-${day}-${hours}${minutes}${seconds}.log`;
652
+ filename = `test-${year}-${month}-${day}-${hours}${minutes}${seconds}.json`;
653
653
  }
654
654
  const filepath = path.join(process.cwd(), filename);
655
655
  try {
package/index.esm.js CHANGED
@@ -282,9 +282,10 @@ class Test {
282
282
  }
283
283
  run() {
284
284
  return new Promise(res => {
285
+ const start = new Date();
286
+
285
287
  if (isFunction(this.fn)) {
286
288
  try {
287
- const start = new Date();
288
289
  const _result = this.fn(expect);
289
290
 
290
291
  if (_result && isFunction(_result.then)) {
@@ -457,7 +458,7 @@ class TestRunner {
457
458
  const content = JSON.stringify({
458
459
  results: this._results,
459
460
  errors: this._errors
460
- });
461
+ }, null, '\t');
461
462
 
462
463
  if (filename == null) {
463
464
  const d = new Date();
@@ -469,7 +470,7 @@ class TestRunner {
469
470
  const minutes = d.getMinutes().toString().padStart(2, '0');
470
471
  const seconds = d.getSeconds().toString().padStart(2, '0');
471
472
 
472
- filename = `test-${year}-${month}-${day}-${hours}${minutes}${seconds}.log`;
473
+ filename = `test-${year}-${month}-${day}-${hours}${minutes}${seconds}.json`;
473
474
  }
474
475
 
475
476
  const filepath = path.join(process.cwd(), filename);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locustjs/test",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "This library provides a simple test runner.",
5
5
  "main": "index.cjs.js",
6
6
  "module": "index.esm.js",