@locustjs/test 1.1.0 → 1.1.2
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 +10 -6
- package/index.esm.js +10 -6
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray, isFunction,
|
|
1
|
+
import { isArray, isFunction, isObject, isPrimitive, equals } from '@locustjs/base';
|
|
2
2
|
import { Exception } from '@locustjs/exception';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
@@ -522,7 +522,7 @@ class TestRunner {
|
|
|
522
522
|
} catch (ex) {
|
|
523
523
|
this._errors.push({
|
|
524
524
|
index: i,
|
|
525
|
-
test,
|
|
525
|
+
test: test.name,
|
|
526
526
|
err: new Exception({
|
|
527
527
|
message: `onProgress failed for test '${test.name} at index ${i}'.`,
|
|
528
528
|
code: 1500,
|
|
@@ -612,11 +612,11 @@ class TestRunner {
|
|
|
612
612
|
if (detailed) {
|
|
613
613
|
let message;
|
|
614
614
|
if (result.success) {
|
|
615
|
-
message = `${i}. ${result.test
|
|
615
|
+
message = `${i}. ${result.test}: \x1b[${ConsoleColors.ForeColor.Green}m passed ${ConsoleColors.Modifier.Reset} (${this._getTime(result.time)})`;
|
|
616
616
|
} else {
|
|
617
|
-
message = `${i}. ${result.test
|
|
617
|
+
message = `${i}. ${result.test}: \x1b[${ConsoleColors.ForeColor.Red}m failed ${ConsoleColors.Modifier.Reset} (${this._getTime(result.time)})`;
|
|
618
618
|
message += '\n';
|
|
619
|
-
message += `\x1b[${ConsoleColors.ForeColor.White}m${result.err.code}: ${result.err.toString(
|
|
619
|
+
message += `\x1b[${ConsoleColors.ForeColor.White}m${result.err.code}: ${result.err.toString()} ${ConsoleColors.Modifier.Reset}`;
|
|
620
620
|
message += '\n';
|
|
621
621
|
}
|
|
622
622
|
console.log(message);
|
|
@@ -626,7 +626,11 @@ class TestRunner {
|
|
|
626
626
|
if (detailed && this._errors.length) {
|
|
627
627
|
console.log('Progress errors:');
|
|
628
628
|
for (let error of this._errors) {
|
|
629
|
-
|
|
629
|
+
if (error.index !== undefined) {
|
|
630
|
+
console.log(`${error.index}. ${error.test}: ${error.err.innerException.toString()}`);
|
|
631
|
+
} else {
|
|
632
|
+
console.log(`${error.err.toString()}`);
|
|
633
|
+
}
|
|
630
634
|
}
|
|
631
635
|
}
|
|
632
636
|
const text = (detailed ? '\n' : '') + (this._failed > 0 ? `\x1b[${ConsoleColors.ForeColor.Red}m ${this._failed} tests failed ${ConsoleColors.Modifier.Reset}` : '0 tests failed') + ', ' + (this._passed > 0 ? `\x1b[${ConsoleColors.ForeColor.Green}m ${this._passed} tests passed ${ConsoleColors.Modifier.Reset}` : '0 tests passed') + '\n' + `Tests: ${this._passed + this._failed}` + '\n' + `Time: ${time / 1000} sec` + '\n';
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray, isFunction,
|
|
1
|
+
import { isArray, isFunction, isObject, isPrimitive, equals } from '@locustjs/base';
|
|
2
2
|
import { Exception } from '@locustjs/exception';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
@@ -333,7 +333,7 @@ class TestRunner {
|
|
|
333
333
|
try {
|
|
334
334
|
onProgress(i, test);
|
|
335
335
|
} catch (ex) {
|
|
336
|
-
this._errors.push({ index: i, test, err: new Exception({ message: `onProgress failed for test '${test.name} at index ${i}'.`, code: 1500, status: 'progress-failed', innerException: ex }) })
|
|
336
|
+
this._errors.push({ index: i, test: test.name, err: new Exception({ message: `onProgress failed for test '${test.name} at index ${i}'.`, code: 1500, status: 'progress-failed', innerException: ex }) })
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
|
|
@@ -415,11 +415,11 @@ class TestRunner {
|
|
|
415
415
|
let message;
|
|
416
416
|
|
|
417
417
|
if (result.success) {
|
|
418
|
-
message = `${i}. ${result.test
|
|
418
|
+
message = `${i}. ${result.test}: \x1b[${ConsoleColors.ForeColor.Green}m passed ${ConsoleColors.Modifier.Reset} (${this._getTime(result.time)})`
|
|
419
419
|
} else {
|
|
420
|
-
message = `${i}. ${result.test
|
|
420
|
+
message = `${i}. ${result.test}: \x1b[${ConsoleColors.ForeColor.Red}m failed ${ConsoleColors.Modifier.Reset} (${this._getTime(result.time)})`;
|
|
421
421
|
message += '\n';
|
|
422
|
-
message += `\x1b[${ConsoleColors.ForeColor.White}m${result.err.code}: ${result.err.toString(
|
|
422
|
+
message += `\x1b[${ConsoleColors.ForeColor.White}m${result.err.code}: ${result.err.toString()} ${ConsoleColors.Modifier.Reset}`;
|
|
423
423
|
message += '\n';
|
|
424
424
|
}
|
|
425
425
|
|
|
@@ -433,7 +433,11 @@ class TestRunner {
|
|
|
433
433
|
console.log('Progress errors:');
|
|
434
434
|
|
|
435
435
|
for (let error of this._errors) {
|
|
436
|
-
|
|
436
|
+
if (error.index !== undefined) {
|
|
437
|
+
console.log(`${error.index}. ${error.test}: ${error.err.innerException.toString()}`);
|
|
438
|
+
} else {
|
|
439
|
+
console.log(`${error.err.toString()}`);
|
|
440
|
+
}
|
|
437
441
|
}
|
|
438
442
|
}
|
|
439
443
|
|