xunit.ts 2.0.0 → 3.0.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/README.md +25 -2
- package/cli.ts +9 -4
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/eslint.config.js +46 -0
- package/dist/eslint.config.js.map +1 -0
- package/dist/src/Assertions/Contains.d.ts +1 -1
- package/dist/src/Assertions/Contains.d.ts.map +1 -1
- package/dist/src/Assertions/Contains.js +2 -2
- package/dist/src/Assertions/Contains.js.map +1 -1
- package/dist/src/Assertions/Count.d.ts +1 -1
- package/dist/src/Assertions/Count.d.ts.map +1 -1
- package/dist/src/Assertions/Count.js +2 -2
- package/dist/src/Assertions/Count.js.map +1 -1
- package/dist/src/Assertions/Defined.d.ts +1 -1
- package/dist/src/Assertions/Defined.d.ts.map +1 -1
- package/dist/src/Assertions/Defined.js +2 -2
- package/dist/src/Assertions/Defined.js.map +1 -1
- package/dist/src/Assertions/DoesNotContain.d.ts +1 -1
- package/dist/src/Assertions/DoesNotContain.d.ts.map +1 -1
- package/dist/src/Assertions/DoesNotContain.js +2 -2
- package/dist/src/Assertions/DoesNotContain.js.map +1 -1
- package/dist/src/Assertions/DoesNotThrow.d.ts +1 -1
- package/dist/src/Assertions/DoesNotThrow.d.ts.map +1 -1
- package/dist/src/Assertions/DoesNotThrow.js +2 -2
- package/dist/src/Assertions/DoesNotThrow.js.map +1 -1
- package/dist/src/Assertions/Empty.d.ts +1 -1
- package/dist/src/Assertions/Empty.d.ts.map +1 -1
- package/dist/src/Assertions/Empty.js +2 -2
- package/dist/src/Assertions/Empty.js.map +1 -1
- package/dist/src/Assertions/Equal.d.ts +1 -1
- package/dist/src/Assertions/Equal.d.ts.map +1 -1
- package/dist/src/Assertions/Equal.js +2 -2
- package/dist/src/Assertions/Equal.js.map +1 -1
- package/dist/src/Assertions/False.d.ts +1 -1
- package/dist/src/Assertions/False.d.ts.map +1 -1
- package/dist/src/Assertions/False.js +2 -2
- package/dist/src/Assertions/False.js.map +1 -1
- package/dist/src/Assertions/InstanceOf.d.ts +1 -1
- package/dist/src/Assertions/InstanceOf.d.ts.map +1 -1
- package/dist/src/Assertions/InstanceOf.js +2 -2
- package/dist/src/Assertions/InstanceOf.js.map +1 -1
- package/dist/src/Assertions/NotEmpty.d.ts +1 -1
- package/dist/src/Assertions/NotEmpty.d.ts.map +1 -1
- package/dist/src/Assertions/NotEmpty.js +2 -2
- package/dist/src/Assertions/NotEmpty.js.map +1 -1
- package/dist/src/Assertions/NotEqual.d.ts +1 -1
- package/dist/src/Assertions/NotEqual.d.ts.map +1 -1
- package/dist/src/Assertions/NotEqual.js +2 -2
- package/dist/src/Assertions/NotEqual.js.map +1 -1
- package/dist/src/Assertions/NotNull.d.ts +1 -1
- package/dist/src/Assertions/NotNull.d.ts.map +1 -1
- package/dist/src/Assertions/NotNull.js +2 -2
- package/dist/src/Assertions/NotNull.js.map +1 -1
- package/dist/src/Assertions/Null.d.ts +1 -1
- package/dist/src/Assertions/Null.d.ts.map +1 -1
- package/dist/src/Assertions/Null.js +2 -2
- package/dist/src/Assertions/Null.js.map +1 -1
- package/dist/src/Assertions/StringContains.js +3 -3
- package/dist/src/Assertions/StringContains.js.map +1 -1
- package/dist/src/Assertions/StringDoesNotContain.js +3 -3
- package/dist/src/Assertions/StringDoesNotContain.js.map +1 -1
- package/dist/src/Assertions/StringDoesNotEndWith.d.ts.map +1 -1
- package/dist/src/Assertions/StringDoesNotEndWith.js +3 -5
- package/dist/src/Assertions/StringDoesNotEndWith.js.map +1 -1
- package/dist/src/Assertions/StringDoesNotMatch.d.ts +1 -1
- package/dist/src/Assertions/StringDoesNotMatch.d.ts.map +1 -1
- package/dist/src/Assertions/StringDoesNotMatch.js +2 -2
- package/dist/src/Assertions/StringDoesNotMatch.js.map +1 -1
- package/dist/src/Assertions/StringDoesNotStartWith.js +2 -2
- package/dist/src/Assertions/StringDoesNotStartWith.js.map +1 -1
- package/dist/src/Assertions/StringEndsWith.d.ts.map +1 -1
- package/dist/src/Assertions/StringEndsWith.js +3 -5
- package/dist/src/Assertions/StringEndsWith.js.map +1 -1
- package/dist/src/Assertions/StringMatches.d.ts +1 -1
- package/dist/src/Assertions/StringMatches.d.ts.map +1 -1
- package/dist/src/Assertions/StringMatches.js +2 -2
- package/dist/src/Assertions/StringMatches.js.map +1 -1
- package/dist/src/Assertions/StringStartsWith.js +2 -2
- package/dist/src/Assertions/StringStartsWith.js.map +1 -1
- package/dist/src/Assertions/Throws.d.ts +1 -1
- package/dist/src/Assertions/Throws.d.ts.map +1 -1
- package/dist/src/Assertions/Throws.js +3 -3
- package/dist/src/Assertions/Throws.js.map +1 -1
- package/dist/src/Assertions/True.d.ts +1 -1
- package/dist/src/Assertions/True.d.ts.map +1 -1
- package/dist/src/Assertions/True.js +2 -2
- package/dist/src/Assertions/True.js.map +1 -1
- package/dist/src/Assertions/Undefined.d.ts +1 -1
- package/dist/src/Assertions/Undefined.d.ts.map +1 -1
- package/dist/src/Assertions/Undefined.js +2 -2
- package/dist/src/Assertions/Undefined.js.map +1 -1
- package/dist/src/Assertions/index.d.ts +15 -15
- package/dist/src/Assertions/index.d.ts.map +1 -1
- package/dist/src/Assertions/index.js +15 -15
- package/dist/src/Assertions/index.js.map +1 -1
- package/dist/src/CLI.d.ts +1 -1
- package/dist/src/CLI.d.ts.map +1 -1
- package/dist/src/CLI.js +7 -6
- package/dist/src/CLI.js.map +1 -1
- package/dist/src/Factory.d.ts +1 -1
- package/dist/src/Factory.d.ts.map +1 -1
- package/dist/src/Factory.js +7 -7
- package/dist/src/Factory.js.map +1 -1
- package/dist/src/Framework/Test.d.ts +1 -1
- package/dist/src/Framework/Test.d.ts.map +1 -1
- package/dist/src/Framework/Test.js.map +1 -1
- package/dist/src/Framework/TestInfo.d.ts +5 -1
- package/dist/src/Framework/TestInfo.d.ts.map +1 -1
- package/dist/src/Framework/TestName.js +2 -2
- package/dist/src/Framework/TestName.js.map +1 -1
- package/dist/src/Framework/TestSuite.d.ts +2 -2
- package/dist/src/Framework/TestSuite.d.ts.map +1 -1
- package/dist/src/Framework/TestSuite.js +7 -6
- package/dist/src/Framework/TestSuite.js.map +1 -1
- package/dist/src/IO/FileSystem.d.ts +1 -1
- package/dist/src/IO/FileSystem.d.ts.map +1 -1
- package/dist/src/IO/FileSystem.js +4 -4
- package/dist/src/IO/FileSystem.js.map +1 -1
- package/dist/src/IO/Output.d.ts +1 -1
- package/dist/src/IO/Output.d.ts.map +1 -1
- package/dist/src/Reporters/ConsoleReporter.d.ts +4 -4
- package/dist/src/Reporters/ConsoleReporter.d.ts.map +1 -1
- package/dist/src/Reporters/ConsoleReporter.js +39 -28
- package/dist/src/Reporters/ConsoleReporter.js.map +1 -1
- package/dist/src/Reporters/FileReporter.d.ts +4 -4
- package/dist/src/Reporters/FileReporter.d.ts.map +1 -1
- package/dist/src/Reporters/FileReporter.js +0 -1
- package/dist/src/Reporters/FileReporter.js.map +1 -1
- package/dist/src/Reporters/JUnitReporter.d.ts.map +1 -1
- package/dist/src/Reporters/JUnitReporter.js +1 -1
- package/dist/src/Reporters/JUnitReporter.js.map +1 -1
- package/dist/src/Reporters/ResultReporter.d.ts +2 -2
- package/dist/src/Reporters/ResultReporter.d.ts.map +1 -1
- package/dist/src/Reporters/ResultReporter.js +1 -0
- package/dist/src/Reporters/ResultReporter.js.map +1 -1
- package/dist/src/Reporters/SonarReporter.d.ts.map +1 -1
- package/dist/src/Reporters/SonarReporter.js +2 -2
- package/dist/src/Reporters/SonarReporter.js.map +1 -1
- package/dist/src/Reporters/XMLReporter.d.ts +1 -1
- package/dist/src/Reporters/XMLReporter.d.ts.map +1 -1
- package/dist/src/Reporters/XMLReporter.js.map +1 -1
- package/dist/src/Runners/Runner.d.ts +3 -3
- package/dist/src/Runners/Runner.d.ts.map +1 -1
- package/dist/src/Runners/Runner.js +1 -1
- package/dist/src/Runners/Runner.js.map +1 -1
- package/dist/src/Runners/TestRunner.d.ts +4 -2
- package/dist/src/Runners/TestRunner.d.ts.map +1 -1
- package/dist/src/Runners/TestRunner.js +13 -8
- package/dist/src/Runners/TestRunner.js.map +1 -1
- package/dist/src/Runners/TestSuiteLoader.d.ts.map +1 -1
- package/dist/src/Runners/TestSuiteLoader.js +15 -11
- package/dist/src/Runners/TestSuiteLoader.js.map +1 -1
- package/dist/src/Runners/TestSuiteRunner.d.ts +4 -4
- package/dist/src/Runners/TestSuiteRunner.d.ts.map +1 -1
- package/dist/src/Runners/TestSuiteRunner.js +3 -3
- package/dist/src/Runners/TestSuiteRunner.js.map +1 -1
- package/dist/xunit.d.ts +2 -2
- package/dist/xunit.d.ts.map +1 -1
- package/dist/xunit.js +3 -3
- package/dist/xunit.js.map +1 -1
- package/eslint.config.ts +44 -0
- package/package.json +13 -9
- package/src/Assertions/Contains.ts +2 -2
- package/src/Assertions/Count.ts +2 -2
- package/src/Assertions/Defined.ts +2 -2
- package/src/Assertions/DoesNotContain.ts +2 -2
- package/src/Assertions/DoesNotThrow.ts +2 -2
- package/src/Assertions/Empty.ts +2 -2
- package/src/Assertions/Equal.ts +3 -2
- package/src/Assertions/False.ts +2 -2
- package/src/Assertions/InstanceOf.ts +2 -2
- package/src/Assertions/NotEmpty.ts +2 -2
- package/src/Assertions/NotEqual.ts +3 -2
- package/src/Assertions/NotNull.ts +2 -2
- package/src/Assertions/Null.ts +2 -2
- package/src/Assertions/StringContains.ts +2 -2
- package/src/Assertions/StringDoesNotContain.ts +2 -2
- package/src/Assertions/StringDoesNotEndWith.ts +2 -4
- package/src/Assertions/StringDoesNotMatch.ts +2 -2
- package/src/Assertions/StringDoesNotStartWith.ts +1 -1
- package/src/Assertions/StringEndsWith.ts +2 -4
- package/src/Assertions/StringMatches.ts +2 -2
- package/src/Assertions/StringStartsWith.ts +1 -1
- package/src/Assertions/Throws.ts +3 -3
- package/src/Assertions/True.ts +2 -2
- package/src/Assertions/Undefined.ts +2 -2
- package/src/Assertions/index.ts +15 -27
- package/src/CLI.ts +9 -6
- package/src/Factory.ts +11 -9
- package/src/Framework/Test.ts +1 -1
- package/src/Framework/TestInfo.ts +7 -1
- package/src/Framework/TestName.ts +2 -2
- package/src/Framework/TestSuite.ts +10 -8
- package/src/IO/FileSystem.ts +4 -4
- package/src/IO/Output.ts +1 -1
- package/src/Reporters/ConsoleReporter.ts +13 -11
- package/src/Reporters/FileReporter.ts +7 -5
- package/src/Reporters/JUnitReporter.ts +3 -2
- package/src/Reporters/ResultReporter.ts +4 -3
- package/src/Reporters/SonarReporter.ts +4 -2
- package/src/Reporters/XMLReporter.ts +2 -2
- package/src/Runners/Runner.ts +5 -5
- package/src/Runners/TestRunner.ts +19 -11
- package/src/Runners/TestSuiteLoader.ts +14 -7
- package/src/Runners/TestSuiteRunner.ts +7 -7
- package/tsconfig.json +3 -0
- package/xunit.ts +3 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import TestSuiteResults from "../Framework/TestSuiteResults";
|
|
2
|
+
import ResultReporter from "../Reporters/ResultReporter";
|
|
1
3
|
import TestSuiteLoader from "./TestSuiteLoader";
|
|
2
4
|
import TestSuiteRunner from "./TestSuiteRunner";
|
|
3
|
-
import ResultReporter from "../Reporters/ResultReporter";
|
|
4
|
-
import TestSuiteResults from "../Framework/TestSuiteResults";
|
|
5
5
|
export default class Runner {
|
|
6
6
|
private readonly loader;
|
|
7
7
|
private readonly runner;
|
|
8
8
|
private readonly reporters;
|
|
9
|
-
constructor(loader: TestSuiteLoader, runner: TestSuiteRunner, reporters:
|
|
9
|
+
constructor(loader: TestSuiteLoader, runner: TestSuiteRunner, reporters: readonly ResultReporter[]);
|
|
10
10
|
static allTestsPassed(results: Record<string, TestSuiteResults>): boolean;
|
|
11
11
|
runAll(dir: string, filters: RegExp[]): Promise<Record<string, TestSuiteResults>>;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runner.d.ts","sourceRoot":"","sources":["../../../src/Runners/Runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Runner.d.ts","sourceRoot":"","sources":["../../../src/Runners/Runner.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,MAAM;IAEd,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAmB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAmB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAA7F,MAAM,EAAE,eAAe,EAAmB,MAAM,EAAE,eAAe,EAAmB,SAAS,EAAE,SAAS,cAAc,EAAE;IAGrJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,OAAO;IAMnE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAWvF"}
|
|
@@ -23,7 +23,7 @@ class Runner {
|
|
|
23
23
|
}
|
|
24
24
|
runAll(dir, filters) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
|
|
26
|
+
this.reporters.map(r => r.runStarted());
|
|
27
27
|
const results = {};
|
|
28
28
|
const suites = yield this.loader.loadTestSuites(dir, filters);
|
|
29
29
|
for (const file of Object.keys(suites)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runner.js","sourceRoot":"","sources":["../../../src/Runners/Runner.ts"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Runner.js","sourceRoot":"","sources":["../../../src/Runners/Runner.ts"],"names":[],"mappings":";;;;;;;;;;;AAA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AE,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACpE,OAAO,OAAO,CAAC;QAChB,CAAC;KAAA;CACD;AAtBD,yBAsBC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import TestInfo from "../Framework/TestInfo";
|
|
2
|
+
import TestResult from "../Framework/TestResult";
|
|
2
3
|
import TestSuite from "../Framework/TestSuite";
|
|
3
4
|
import ResultReporter from "../Reporters/ResultReporter";
|
|
4
|
-
import TestResult from "../Framework/TestResult";
|
|
5
5
|
export default class TestRunner {
|
|
6
6
|
private readonly reporters;
|
|
7
|
-
constructor(reporters:
|
|
7
|
+
constructor(reporters: readonly ResultReporter[]);
|
|
8
8
|
private static msSince;
|
|
9
|
+
private static isSyncTest;
|
|
10
|
+
private static isAsyncTest;
|
|
9
11
|
runTest(name: string, info: TestInfo, suite: TestSuite): Promise<TestResult>;
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=TestRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestRunner.d.ts","sourceRoot":"","sources":["../../../src/Runners/TestRunner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TestRunner.d.ts","sourceRoot":"","sources":["../../../src/Runners/TestRunner.ts"],"names":[],"mappings":"AAGA,OAAO,QAAyC,MAAM,uBAAuB,CAAC;AAC9E,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,cAAc,MAAM,6BAA6B,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,UAAU;IAElB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS,cAAc,EAAE;IAGjE,OAAO,CAAC,MAAM,CAAC,OAAO;IAKtB,OAAO,CAAC,MAAM,CAAC,UAAU,CAA2E;IACpG,OAAO,CAAC,MAAM,CAAC,WAAW,CAA4E;IAEhG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;CA8BlF"}
|
|
@@ -12,9 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const node_assert_1 = require("node:assert");
|
|
15
16
|
const ResultType_1 = require("../Framework/ResultType");
|
|
16
17
|
const TestResult_1 = __importDefault(require("../Framework/TestResult"));
|
|
17
|
-
const assert_1 = require("assert");
|
|
18
18
|
class TestRunner {
|
|
19
19
|
constructor(reporters) {
|
|
20
20
|
this.reporters = reporters;
|
|
@@ -25,30 +25,35 @@ class TestRunner {
|
|
|
25
25
|
}
|
|
26
26
|
runTest(name, info, suite) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
28
|
+
this.reporters.map(r => r.testStarted(suite, name));
|
|
29
29
|
if (info.value === undefined) {
|
|
30
|
-
|
|
30
|
+
this.reporters.map(r => r.testIncomplete(suite, name));
|
|
31
31
|
return new TestResult_1.default(ResultType_1.ResultType.Incomplete, 0);
|
|
32
32
|
}
|
|
33
33
|
const start = process.hrtime();
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
if (TestRunner.isAsyncTest(info))
|
|
36
|
+
yield info.value.call(suite);
|
|
37
|
+
else if (TestRunner.isSyncTest(info))
|
|
38
|
+
info.value.call(suite);
|
|
36
39
|
const duration = TestRunner.msSince(start);
|
|
37
|
-
|
|
40
|
+
this.reporters.map(r => r.testPassed(suite, name, duration));
|
|
38
41
|
return new TestResult_1.default(ResultType_1.ResultType.Passed, duration);
|
|
39
42
|
}
|
|
40
43
|
catch (error) {
|
|
41
44
|
const duration = TestRunner.msSince(start);
|
|
42
45
|
const typedError = error;
|
|
43
|
-
if (typedError instanceof
|
|
44
|
-
|
|
46
|
+
if (typedError instanceof node_assert_1.AssertionError) {
|
|
47
|
+
this.reporters.map(r => r.testFailed(suite, name, typedError, duration));
|
|
45
48
|
return new TestResult_1.default(ResultType_1.ResultType.Failed, duration, typedError);
|
|
46
49
|
}
|
|
47
|
-
|
|
50
|
+
this.reporters.map(r => r.testErrored(suite, name, typedError, duration));
|
|
48
51
|
return new TestResult_1.default(ResultType_1.ResultType.Error, duration, typedError);
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
55
|
}
|
|
56
|
+
TestRunner.isSyncTest = (test) => test !== undefined;
|
|
57
|
+
TestRunner.isAsyncTest = (test) => test !== undefined;
|
|
53
58
|
exports.default = TestRunner;
|
|
54
59
|
//# sourceMappingURL=TestRunner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestRunner.js","sourceRoot":"","sources":["../../../src/Runners/TestRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TestRunner.js","sourceRoot":"","sources":["../../../src/Runners/TestRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAA6C;AAE7C,wDAAqD;AAErD,yEAAiD;AAIjD,MAAqB,UAAU;IAE9B,YAA6B,SAAoC;QAApC,cAAS,GAAT,SAAS,CAA2B;IACjE,CAAC;IAEO,MAAM,CAAC,OAAO,CAAC,KAAyB;QAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,OAAO,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAS,CAAC;IACtD,CAAC;IAKK,OAAO,CAAC,IAAY,EAAE,IAAc,EAAE,KAAgB;;YAC3D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;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AU,CAAC,uBAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;gBAChE,CAAC;gBAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;gBAC1E,OAAO,IAAI,oBAAU,CAAC,uBAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC/D,CAAC;QACF,CAAC;KAAA;;AAhCc,qBAAU,GAAG,CAAC,IAAe,EAAkC,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC;AACrF,sBAAW,GAAG,CAAC,IAAe,EAAmC,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC;kBAXlF,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestSuiteLoader.d.ts","sourceRoot":"","sources":["../../../src/Runners/TestSuiteLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TestSuiteLoader.d.ts","sourceRoot":"","sources":["../../../src/Runners/TestSuiteLoader.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,eAAe;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,UAAU;WAGvC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;IAuB1D,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAWtD,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAI9B,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAcxF"}
|
|
@@ -45,42 +45,46 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
48
49
|
const TestSuite_1 = __importDefault(require("../Framework/TestSuite"));
|
|
49
50
|
const FileSystem_1 = __importDefault(require("../IO/FileSystem"));
|
|
50
|
-
const path_1 = __importDefault(require("path"));
|
|
51
51
|
class TestSuiteLoader {
|
|
52
52
|
constructor(file_system) {
|
|
53
53
|
this.file_system = file_system;
|
|
54
54
|
}
|
|
55
55
|
static loadTestSuite(file, filters) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
var _a, _b;
|
|
58
57
|
const module_path = TestSuiteLoader.getModulePath(__dirname, file);
|
|
59
58
|
const test_class = yield Promise.resolve(`${module_path}`).then(s => __importStar(require(s)));
|
|
60
|
-
|
|
59
|
+
const constructor = test_class.default;
|
|
60
|
+
if (!constructor) {
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const prototype = constructor.prototype;
|
|
64
|
+
if (!(prototype instanceof TestSuite_1.default)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const tests = prototype.getTests(filters);
|
|
64
68
|
if (tests === undefined || Object.keys(tests).length === 0) {
|
|
65
69
|
return null;
|
|
66
70
|
}
|
|
67
|
-
const suite = new
|
|
71
|
+
const suite = new constructor();
|
|
68
72
|
suite.setTests(tests);
|
|
69
73
|
return suite;
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
static getModulePath(current_dir, file) {
|
|
73
|
-
const root = TestSuiteLoader.isFromNodeModules(
|
|
74
|
-
? `..${
|
|
75
|
-
: `..${
|
|
77
|
+
const root = TestSuiteLoader.isFromNodeModules(node_path_1.default.resolve(current_dir))
|
|
78
|
+
? `..${node_path_1.default.sep}..${node_path_1.default.sep}..${node_path_1.default.sep}..${node_path_1.default.sep}..`
|
|
79
|
+
: `..${node_path_1.default.sep}..${node_path_1.default.sep}..`;
|
|
76
80
|
const extension = FileSystem_1.default.extension(file);
|
|
77
81
|
const module_name = extension.length > 0
|
|
78
82
|
? file.substring(0, file.length - extension.length - 1)
|
|
79
83
|
: file;
|
|
80
|
-
return `${root}${
|
|
84
|
+
return `${root}${node_path_1.default.sep}${module_name}`;
|
|
81
85
|
}
|
|
82
86
|
static isFromNodeModules(dir) {
|
|
83
|
-
return dir.
|
|
87
|
+
return dir.includes("node_modules");
|
|
84
88
|
}
|
|
85
89
|
loadTestSuites(dir, filters) {
|
|
86
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -89,7 +93,7 @@ class TestSuiteLoader {
|
|
|
89
93
|
.filter((file) => FileSystem_1.default.extension(file) === FileSystem_1.default.extension(__filename));
|
|
90
94
|
for (const file of files) {
|
|
91
95
|
const suite = yield TestSuiteLoader.loadTestSuite(file, filters);
|
|
92
|
-
if (suite !==
|
|
96
|
+
if (suite !== null) {
|
|
93
97
|
suites[file] = suite;
|
|
94
98
|
}
|
|
95
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestSuiteLoader.js","sourceRoot":"","sources":["../../../src/Runners/TestSuiteLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAA+C;AAC/C,kEAA0C;
|
|
1
|
+
{"version":3,"file":"TestSuiteLoader.js","sourceRoot":"","sources":["../../../src/Runners/TestSuiteLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA6B;AAE7B,uEAA+C;AAC/C,kEAA0C;AAE1C,MAAqB,eAAe;IACnC,YAA6B,WAAuB;QAAvB,gBAAW,GAAX,WAAW,CAAY;IACpD,CAA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,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;YACvD,CAAC,CAAC,IAAI,CAAC;QACR,OAAO,GAAG,IAAI,GAAG,mBAAI,CAAC,GAAG,GAAG,WAAW,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,GAAW;QACnC,OAAO,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;IAEK,cAAc,CAAC,GAAW,EAAE,OAAiB;;YAClD,MAAM,MAAM,GAA8B,EAAE,CAAC;YAE7C,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;iBAClD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAU,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,oBAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;YAEpF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBACjE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBACpB,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;gBACtB,CAAC;YACF,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAAC;KAAA;CACD;AAxDD,kCAwDC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TestInfo from "../Framework/TestInfo";
|
|
2
2
|
import TestSuite from "../Framework/TestSuite";
|
|
3
3
|
import TestSuiteResults from "../Framework/TestSuiteResults";
|
|
4
|
-
import
|
|
4
|
+
import ResultReporter from "../Reporters/ResultReporter";
|
|
5
5
|
import TestRunner from "./TestRunner";
|
|
6
6
|
export default class TestSuiteRunner {
|
|
7
7
|
private readonly runner;
|
|
8
8
|
private readonly reporters;
|
|
9
|
-
constructor(runner: TestRunner, reporters:
|
|
9
|
+
constructor(runner: TestRunner, reporters: readonly ResultReporter[]);
|
|
10
10
|
runSuite(suite: TestSuite, filters: RegExp[]): Promise<TestSuiteResults>;
|
|
11
|
-
runTests(suite: TestSuite, tests
|
|
11
|
+
runTests(suite: TestSuite, tests?: Record<string, TestInfo> | null): Promise<TestSuiteResults>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=TestSuiteRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestSuiteRunner.d.ts","sourceRoot":"","sources":["../../../src/Runners/TestSuiteRunner.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TestSuiteRunner.d.ts","sourceRoot":"","sources":["../../../src/Runners/TestSuiteRunner.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,OAAO,OAAO,eAAe;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAc,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAA9C,MAAM,EAAE,UAAU,EAAmB,SAAS,EAAE,SAAS,cAAc,EAAE;IAGhG,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE;IAQ5C,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI;CAexE"}
|
|
@@ -20,10 +20,10 @@ class TestSuiteRunner {
|
|
|
20
20
|
}
|
|
21
21
|
runSuite(suite, filters) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
|
|
23
|
+
this.reporters.map(r => r.suiteStarted(suite));
|
|
24
24
|
const tests = suite.getTests(filters);
|
|
25
25
|
const results = yield this.runTests(suite, tests);
|
|
26
|
-
|
|
26
|
+
this.reporters.map(r => r.suiteCompleted(suite, results));
|
|
27
27
|
return results;
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ class TestSuiteRunner {
|
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
const results = new TestSuiteResults_1.default(suite);
|
|
33
33
|
if (tests === undefined || tests === null || Object.keys(tests).length === 0) {
|
|
34
|
-
|
|
34
|
+
this.reporters.map(r => r.testIncomplete(suite, "(no tests found)"));
|
|
35
35
|
return results;
|
|
36
36
|
}
|
|
37
37
|
const test_names = Object.keys(tests);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestSuiteRunner.js","sourceRoot":"","sources":["../../../src/Runners/TestSuiteRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qFAA6D;AAI7D,MAAqB,eAAe;IAEnC,YAA6B,MAAkB,EAAmB,
|
|
1
|
+
{"version":3,"file":"TestSuiteRunner.js","sourceRoot":"","sources":["../../../src/Runners/TestSuiteRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qFAA6D;AAI7D,MAAqB,eAAe;IAEnC,YAA6B,MAAkB,EAAmB,SAAoC;QAAzE,WAAM,GAAN,MAAM,CAAY;QAAmB,cAAS,GAAT,SAAS,CAA2B;IACtG,CAAC;IAEK,QAAQ,CAAC,KAAgB,EAAE,OAAiB;;YACjD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,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export { Test, TestSuite, Assert };
|
|
4
|
+
export { Assert, Test, TestSuite };
|
|
5
5
|
//# sourceMappingURL=xunit.d.ts.map
|
package/dist/xunit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xunit.d.ts","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"xunit.d.ts","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,sBAAsB,CAAC;AACxC,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAElD,OAAO,EACN,MAAM,EACN,IAAI,EACJ,SAAS,EAAE,CAAC"}
|
package/dist/xunit.js
CHANGED
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.TestSuite = exports.Test = exports.Assert = void 0;
|
|
7
|
+
const Assertions_1 = __importDefault(require("./src/Assertions"));
|
|
8
|
+
exports.Assert = Assertions_1.default;
|
|
7
9
|
const Test_1 = __importDefault(require("./src/Framework/Test"));
|
|
8
10
|
exports.Test = Test_1.default;
|
|
9
11
|
const TestSuite_1 = __importDefault(require("./src/Framework/TestSuite"));
|
|
10
12
|
exports.TestSuite = TestSuite_1.default;
|
|
11
|
-
const Assertions_1 = __importDefault(require("./src/Assertions"));
|
|
12
|
-
exports.Assert = Assertions_1.default;
|
|
13
13
|
//# sourceMappingURL=xunit.js.map
|
package/dist/xunit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xunit.js","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAwC;AAKvC,eALM,cAAI,CAKN;AAJL,0EAAkD;AAKjD,oBALM,mBAAS,CAKN
|
|
1
|
+
{"version":3,"file":"xunit.js","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAsC;AAKrC,iBALM,oBAAM,CAKN;AAJP,gEAAwC;AAKvC,eALM,cAAI,CAKN;AAJL,0EAAkD;AAKjD,oBALM,mBAAS,CAKN"}
|
package/eslint.config.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
3
|
+
import { defineConfig } from "eslint/config";
|
|
4
|
+
import sort from "eslint-plugin-simple-import-sort";
|
|
5
|
+
import tseslint from "typescript-eslint";
|
|
6
|
+
|
|
7
|
+
export default defineConfig([
|
|
8
|
+
{
|
|
9
|
+
ignores: ["dist"]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
languageOptions: {
|
|
13
|
+
parser: tseslint.parser,
|
|
14
|
+
parserOptions: { projectService: true }
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
"@stylistic": stylistic,
|
|
18
|
+
"simple-import-sort": sort
|
|
19
|
+
},
|
|
20
|
+
files: ["**/*.ts"],
|
|
21
|
+
extends: [
|
|
22
|
+
js.configs.recommended,
|
|
23
|
+
tseslint.configs.recommended,
|
|
24
|
+
tseslint.configs.strictTypeChecked,
|
|
25
|
+
tseslint.configs.stylisticTypeChecked
|
|
26
|
+
],
|
|
27
|
+
rules: {
|
|
28
|
+
"indent": ["warn", "tab"],
|
|
29
|
+
"quotes": ["warn", "double"],
|
|
30
|
+
|
|
31
|
+
"simple-import-sort/imports": "warn",
|
|
32
|
+
"simple-import-sort/exports": "warn",
|
|
33
|
+
"sort-imports": "off",
|
|
34
|
+
|
|
35
|
+
"@stylistic/object-curly-spacing": ["warn", "always"],
|
|
36
|
+
"@stylistic/semi": ["error", "always"],
|
|
37
|
+
|
|
38
|
+
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
39
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
40
|
+
"@typescript-eslint/no-unsafe-function-type": "off",
|
|
41
|
+
"@typescript-eslint/restrict-template-expressions": "off"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xunit.ts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A unit testing framework for TypeScript, following standard xUnit patterns",
|
|
5
5
|
"main": "dist/xunit.js",
|
|
6
6
|
"author": "ecoAPM LLC",
|
|
7
7
|
"homepage": "https://github.com/ecoAPM/xunit.ts",
|
|
8
|
+
"repository": "https://github.com/ecoAPM/xunit.ts",
|
|
8
9
|
"bugs": "https://github.com/ecoAPM/xunit.ts/issues",
|
|
9
10
|
"license": "MIT",
|
|
10
11
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
12
|
+
"node": ">= 24"
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
14
15
|
"colors": "1.4.0",
|
|
15
|
-
"command-line-args": "6.0.
|
|
16
|
-
"command-line-usage": "7.0.
|
|
16
|
+
"command-line-args": "6.0.2",
|
|
17
|
+
"command-line-usage": "7.0.4",
|
|
17
18
|
"lodash.escaperegexp": "4.1.2",
|
|
18
19
|
"lodash.isequal": "4.5.0",
|
|
19
20
|
"xml": "1.0.1"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
23
|
+
"@eslint/js": "10.0.1",
|
|
24
|
+
"@stylistic/eslint-plugin": "5.10.0",
|
|
22
25
|
"@types/command-line-args": "5.2.3",
|
|
23
26
|
"@types/command-line-usage": "5.0.4",
|
|
24
27
|
"@types/lodash.escaperegexp": "4.1.9",
|
|
25
28
|
"@types/lodash.isequal": "4.5.8",
|
|
26
|
-
"@types/node": "
|
|
29
|
+
"@types/node": "25.9.3",
|
|
27
30
|
"@types/xml": "1.0.11",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
+
"eslint": "10.4.1",
|
|
32
|
+
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
33
|
+
"jiti": "2.7.0",
|
|
31
34
|
"ts-mockito": "2.6.1",
|
|
32
|
-
"typescript": "
|
|
35
|
+
"typescript": "6.0.3",
|
|
36
|
+
"typescript-eslint": "8.61.0"
|
|
33
37
|
},
|
|
34
38
|
"peerDependencies": {
|
|
35
39
|
"typescript": ">= 4"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that an array contains a given element
|
|
@@ -15,7 +15,7 @@ import { AssertionError } from "assert";
|
|
|
15
15
|
* @example
|
|
16
16
|
* this.assert.contains(needle, haystack);
|
|
17
17
|
*/
|
|
18
|
-
export default function Contains<T>(needle: T, haystack:
|
|
18
|
+
export default function Contains<T>(needle: T, haystack: readonly T[], message?: string) {
|
|
19
19
|
if (haystack.includes(needle)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
package/src/Assertions/Count.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that an array contains a certain number of elements
|
|
@@ -15,7 +15,7 @@ import { AssertionError } from "assert";
|
|
|
15
15
|
* @example
|
|
16
16
|
* this.assert.count(expected, array);
|
|
17
17
|
*/
|
|
18
|
-
export default function Count(expected: number, array:
|
|
18
|
+
export default function Count(expected: number, array: readonly unknown[], message?: string) {
|
|
19
19
|
if (array.length === expected) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that a value is defined (any value other than `undefined`)
|
|
@@ -14,7 +14,7 @@ import { AssertionError } from "assert";
|
|
|
14
14
|
* @example
|
|
15
15
|
* this.assert.defined(expression);
|
|
16
16
|
*/
|
|
17
|
-
export default function Defined(expression:
|
|
17
|
+
export default function Defined(expression: unknown, message?: string) {
|
|
18
18
|
if (expression !== undefined) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that an array does not contain a given element
|
|
@@ -15,7 +15,7 @@ import { AssertionError } from "assert";
|
|
|
15
15
|
* @example
|
|
16
16
|
* this.assert.doesNotContain(needle, haystack);
|
|
17
17
|
*/
|
|
18
|
-
export default function DoesNotContain<T>(needle: T, haystack:
|
|
18
|
+
export default function DoesNotContain<T>(needle: T, haystack: readonly T[], message?: string) {
|
|
19
19
|
if (!haystack.includes(needle)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that an expression does not throw an error/exception
|
|
@@ -14,7 +14,7 @@ import { AssertionError } from "assert";
|
|
|
14
14
|
* @example
|
|
15
15
|
* this.assert.doesNotThrow(() => expression);
|
|
16
16
|
*/
|
|
17
|
-
export default function DoesNotThrow(expression: () =>
|
|
17
|
+
export default function DoesNotThrow(expression: () => unknown, message?: string) {
|
|
18
18
|
try {
|
|
19
19
|
expression();
|
|
20
20
|
return;
|
package/src/Assertions/Empty.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that an array is empty
|
|
@@ -14,7 +14,7 @@ import { AssertionError } from "assert";
|
|
|
14
14
|
* @example
|
|
15
15
|
* this.assert.empty(array);
|
|
16
16
|
*/
|
|
17
|
-
export default function Empty(array:
|
|
17
|
+
export default function Empty(array: readonly unknown[], message?: string) {
|
|
18
18
|
if (array.length === 0) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
package/src/Assertions/Equal.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
|
+
|
|
2
3
|
import equal from "lodash.isequal";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -16,7 +17,7 @@ import equal from "lodash.isequal";
|
|
|
16
17
|
* @example
|
|
17
18
|
* this.assert.equal(expected, actual);
|
|
18
19
|
*/
|
|
19
|
-
export default function Equal(expected:
|
|
20
|
+
export default function Equal(expected: unknown, actual: unknown, message?: string) {
|
|
20
21
|
if (equal(actual, expected)) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
package/src/Assertions/False.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that a given value is equal to `false`
|
|
@@ -14,7 +14,7 @@ import { AssertionError } from "assert";
|
|
|
14
14
|
* @example
|
|
15
15
|
* this.assert.false(expression);
|
|
16
16
|
*/
|
|
17
|
-
export default function False(expression:
|
|
17
|
+
export default function False(expression: unknown, message?: string) {
|
|
18
18
|
if (expression === false) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that a value is an instance of a certain type
|
|
@@ -15,7 +15,7 @@ import { AssertionError } from "assert";
|
|
|
15
15
|
* @example
|
|
16
16
|
* this.assert.instanceOf(type, object);
|
|
17
17
|
*/
|
|
18
|
-
export default function InstanceOf(type:
|
|
18
|
+
export default function InstanceOf(type: Function, expression: unknown, message?: string) {
|
|
19
19
|
if (expression instanceof type) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that an array is not empty
|
|
@@ -14,7 +14,7 @@ import { AssertionError } from "assert";
|
|
|
14
14
|
* @example
|
|
15
15
|
* this.assert.notEmpty(array);
|
|
16
16
|
*/
|
|
17
|
-
export default function NotEmpty(array:
|
|
17
|
+
export default function NotEmpty(array: readonly unknown[], message?: string) {
|
|
18
18
|
if (array.length > 0) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
|
+
|
|
2
3
|
import equal from "lodash.isequal";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -16,7 +17,7 @@ import equal from "lodash.isequal";
|
|
|
16
17
|
* @example
|
|
17
18
|
* this.assert.notEqual(expected, actual);
|
|
18
19
|
*/
|
|
19
|
-
export default function NotEqual(expected:
|
|
20
|
+
export default function NotEqual(expected: unknown, actual: unknown, message?: string) {
|
|
20
21
|
if (!equal(actual, expected)) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that a value is not `null`
|
|
@@ -14,7 +14,7 @@ import { AssertionError } from "assert";
|
|
|
14
14
|
* @example
|
|
15
15
|
* this.assert.notNull(expression);
|
|
16
16
|
*/
|
|
17
|
-
export default function NotNull(expression:
|
|
17
|
+
export default function NotNull(expression: unknown, message?: string) {
|
|
18
18
|
if (expression !== null) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
package/src/Assertions/Null.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import { AssertionError } from "node:assert";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Asserts that a value is `null`
|
|
@@ -14,7 +14,7 @@ import { AssertionError } from "assert";
|
|
|
14
14
|
* @example
|
|
15
15
|
* this.assert.null(expression);
|
|
16
16
|
*/
|
|
17
|
-
export default function Null(expression:
|
|
17
|
+
export default function Null(expression: unknown, message?: string) {
|
|
18
18
|
if (expression === null) {
|
|
19
19
|
return;
|
|
20
20
|
}
|