@camperaid/watest 2.4.12 → 2.5.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.
- package/core/series.js +21 -7
- package/package.json +1 -1
package/core/series.js
CHANGED
|
@@ -641,6 +641,16 @@ class Series {
|
|
|
641
641
|
let kungFuDeathGrip = null;
|
|
642
642
|
let kungFuDeathGripResolve = null;
|
|
643
643
|
let kungFuDeathGripTimer = 0;
|
|
644
|
+
|
|
645
|
+
// Take snapshots before the test runs
|
|
646
|
+
const testSnapshots = {
|
|
647
|
+
fcnt: this.core.failureCount,
|
|
648
|
+
icnt: this.core.intermittentCount,
|
|
649
|
+
tcnt: this.core.todoCount,
|
|
650
|
+
wcnt: this.core.warningCount,
|
|
651
|
+
ocnt: this.core.okCount,
|
|
652
|
+
};
|
|
653
|
+
|
|
644
654
|
try {
|
|
645
655
|
this.core.setExpectedFailures(failures_info);
|
|
646
656
|
|
|
@@ -687,6 +697,7 @@ class Series {
|
|
|
687
697
|
init_or_uninit,
|
|
688
698
|
path,
|
|
689
699
|
webdriver,
|
|
700
|
+
snapshots: testSnapshots,
|
|
690
701
|
});
|
|
691
702
|
|
|
692
703
|
// If failed, then stop running the current tests.
|
|
@@ -715,12 +726,12 @@ class Series {
|
|
|
715
726
|
await this.LogPipe.release();
|
|
716
727
|
}
|
|
717
728
|
|
|
718
|
-
recordStats({ name, init_or_uninit, path, webdriver }) {
|
|
729
|
+
recordStats({ name, init_or_uninit, path, webdriver, snapshots }) {
|
|
719
730
|
let hasChanged = false;
|
|
720
731
|
let hasFailures = false;
|
|
721
732
|
|
|
722
733
|
// Record intermittents.
|
|
723
|
-
let delta = this.core.intermittentCount -
|
|
734
|
+
let delta = this.core.intermittentCount - snapshots.icnt;
|
|
724
735
|
if (delta > 0) {
|
|
725
736
|
log(`>${name} has ${delta} intermittent(s)`);
|
|
726
737
|
this.icnt = this.core.intermittentCount;
|
|
@@ -728,7 +739,7 @@ class Series {
|
|
|
728
739
|
}
|
|
729
740
|
|
|
730
741
|
// Record todos.
|
|
731
|
-
delta = this.core.todoCount -
|
|
742
|
+
delta = this.core.todoCount - snapshots.tcnt;
|
|
732
743
|
if (delta > 0) {
|
|
733
744
|
log(`>${name} has ${delta} todo(s)`);
|
|
734
745
|
this.tcnt = this.core.todoCount;
|
|
@@ -736,7 +747,7 @@ class Series {
|
|
|
736
747
|
}
|
|
737
748
|
|
|
738
749
|
// Record warnings.
|
|
739
|
-
delta = this.core.warningCount -
|
|
750
|
+
delta = this.core.warningCount - snapshots.wcnt;
|
|
740
751
|
if (delta > 0) {
|
|
741
752
|
log(`>${name} has ${delta} warnings(s)`);
|
|
742
753
|
this.wcnt = this.core.warningCount;
|
|
@@ -744,14 +755,14 @@ class Series {
|
|
|
744
755
|
}
|
|
745
756
|
|
|
746
757
|
// Record successful test count.
|
|
747
|
-
delta = this.core.okCount -
|
|
758
|
+
delta = this.core.okCount - snapshots.ocnt;
|
|
748
759
|
if (delta > 0) {
|
|
749
760
|
this.ocnt = this.core.okCount;
|
|
750
761
|
hasChanged = true;
|
|
751
762
|
}
|
|
752
763
|
|
|
753
764
|
// Fail if no changes.
|
|
754
|
-
delta = this.core.failureCount -
|
|
765
|
+
delta = this.core.failureCount - snapshots.fcnt;
|
|
755
766
|
if (!init_or_uninit) {
|
|
756
767
|
if (delta == 0 && !hasChanged) {
|
|
757
768
|
delta = 1;
|
|
@@ -908,7 +919,10 @@ class Series {
|
|
|
908
919
|
let args = [];
|
|
909
920
|
if (loader) {
|
|
910
921
|
// Use the new --import flag with register() API instead of deprecated --loader
|
|
911
|
-
args.push(
|
|
922
|
+
args.push(
|
|
923
|
+
'--import',
|
|
924
|
+
`data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("${loader}", pathToFileURL("./"));`,
|
|
925
|
+
);
|
|
912
926
|
}
|
|
913
927
|
const watest_bin = nodepath.join(__dirname, '../bin/watest.js');
|
|
914
928
|
args.push(
|