@locustjs/test 1.1.3 → 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 +5 -5
- package/index.esm.js +6 -5
- package/package.json +1 -1
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 => {
|
|
@@ -624,7 +624,7 @@ class TestRunner {
|
|
|
624
624
|
time += result.time;
|
|
625
625
|
}
|
|
626
626
|
if (detailed && this._errors.length) {
|
|
627
|
-
console.log('
|
|
627
|
+
console.log('Errors:');
|
|
628
628
|
for (let error of this._errors) {
|
|
629
629
|
if (error.index !== undefined) {
|
|
630
630
|
console.log(`${error.index}. ${error.test}: ${error.err.innerException.toString()}`);
|
|
@@ -640,8 +640,8 @@ class TestRunner {
|
|
|
640
640
|
const content = JSON.stringify({
|
|
641
641
|
results: this._results,
|
|
642
642
|
errors: this._errors
|
|
643
|
-
});
|
|
644
|
-
if (filename
|
|
643
|
+
}, null, '\t');
|
|
644
|
+
if (filename == null) {
|
|
645
645
|
const d = new Date();
|
|
646
646
|
const year = d.getFullYear().toString().padStart(4, '0');
|
|
647
647
|
const month = (d.getMonth() + 1).toString().padStart(2, '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}.
|
|
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)) {
|
|
@@ -430,7 +431,7 @@ class TestRunner {
|
|
|
430
431
|
}
|
|
431
432
|
|
|
432
433
|
if (detailed && this._errors.length) {
|
|
433
|
-
console.log('
|
|
434
|
+
console.log('Errors:');
|
|
434
435
|
|
|
435
436
|
for (let error of this._errors) {
|
|
436
437
|
if (error.index !== undefined) {
|
|
@@ -457,9 +458,9 @@ 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
|
-
if (filename
|
|
463
|
+
if (filename == null) {
|
|
463
464
|
const d = new Date();
|
|
464
465
|
|
|
465
466
|
const year = d.getFullYear().toString().padStart(4, '0');
|
|
@@ -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}.
|
|
473
|
+
filename = `test-${year}-${month}-${day}-${hours}${minutes}${seconds}.json`;
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
const filepath = path.join(process.cwd(), filename);
|