xunit.ts 1.0.2 → 1.0.3
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/.editorconfig +2 -0
- package/.eslintrc.json +37 -0
- package/cli.ts +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/src/Assertions/Contains.js +1 -1
- package/dist/src/Assertions/Contains.js.map +1 -1
- package/dist/src/Assertions/Count.js.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.js +1 -1
- package/dist/src/Assertions/DoesNotContain.js.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.js +1 -1
- package/dist/src/Assertions/Empty.js.map +1 -1
- package/dist/src/Assertions/Equal.js +1 -1
- package/dist/src/Assertions/Equal.js.map +1 -1
- package/dist/src/Assertions/False.js +1 -1
- 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.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.js +1 -1
- package/dist/src/Assertions/NotEqual.js.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.js +1 -1
- package/dist/src/Assertions/Null.js.map +1 -1
- package/dist/src/Assertions/StringContains.js +1 -1
- package/dist/src/Assertions/StringContains.js.map +1 -1
- package/dist/src/Assertions/StringDoesNotContain.d.ts.map +1 -1
- package/dist/src/Assertions/StringDoesNotContain.js +1 -1
- package/dist/src/Assertions/StringDoesNotContain.js.map +1 -1
- package/dist/src/Assertions/StringDoesNotEndWith.js +1 -1
- package/dist/src/Assertions/StringDoesNotEndWith.js.map +1 -1
- package/dist/src/Assertions/StringDoesNotStartWith.d.ts.map +1 -1
- package/dist/src/Assertions/StringDoesNotStartWith.js +1 -1
- package/dist/src/Assertions/StringDoesNotStartWith.js.map +1 -1
- package/dist/src/Assertions/StringEndsWith.js +1 -1
- package/dist/src/Assertions/StringEndsWith.js.map +1 -1
- package/dist/src/Assertions/StringStartsWith.d.ts.map +1 -1
- package/dist/src/Assertions/StringStartsWith.js +1 -1
- package/dist/src/Assertions/StringStartsWith.js.map +1 -1
- package/dist/src/Assertions/Throws.js +1 -1
- package/dist/src/Assertions/Throws.js.map +1 -1
- package/dist/src/Assertions/True.js +1 -1
- package/dist/src/Assertions/True.js.map +1 -1
- package/dist/src/Assertions/Undefined.js +1 -1
- package/dist/src/Assertions/Undefined.js.map +1 -1
- package/dist/src/Assertions/index.d.ts +22 -22
- package/dist/src/Assertions/index.d.ts.map +1 -1
- package/dist/src/Assertions/index.js.map +1 -1
- package/dist/src/CLI.d.ts.map +1 -1
- package/dist/src/CLI.js +2 -2
- package/dist/src/CLI.js.map +1 -1
- package/dist/src/Factory.d.ts +4 -4
- package/dist/src/Factory.d.ts.map +1 -1
- package/dist/src/Factory.js.map +1 -1
- package/dist/src/Framework/ResultType.d.ts.map +1 -1
- package/dist/src/Framework/ResultType.js.map +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/TestName.d.ts.map +1 -1
- package/dist/src/Framework/TestName.js.map +1 -1
- package/dist/src/Framework/TestResult.d.ts.map +1 -1
- package/dist/src/Framework/TestResult.js.map +1 -1
- package/dist/src/Framework/TestSuite.d.ts +1 -1
- package/dist/src/Framework/TestSuite.d.ts.map +1 -1
- package/dist/src/Framework/TestSuite.js.map +1 -1
- package/dist/src/Framework/TestSuiteResults.d.ts +1 -1
- package/dist/src/Framework/TestSuiteResults.d.ts.map +1 -1
- package/dist/src/Framework/TestSuiteResults.js.map +1 -1
- package/dist/src/IO/FileSystem.d.ts +2 -2
- package/dist/src/IO/FileSystem.d.ts.map +1 -1
- package/dist/src/IO/FileSystem.js +6 -6
- package/dist/src/IO/FileSystem.js.map +1 -1
- package/dist/src/IO/Output.d.ts.map +1 -1
- package/dist/src/IO/Output.js.map +1 -1
- package/dist/src/Reporters/ConsoleReporter.d.ts.map +1 -1
- package/dist/src/Reporters/ConsoleReporter.js +8 -7
- package/dist/src/Reporters/ConsoleReporter.js.map +1 -1
- package/dist/src/Reporters/FileReporter.d.ts.map +1 -1
- package/dist/src/Reporters/FileReporter.js +1 -0
- package/dist/src/Reporters/FileReporter.js.map +1 -1
- package/dist/src/Reporters/JUnitReporter.d.ts +2 -2
- package/dist/src/Reporters/JUnitReporter.d.ts.map +1 -1
- package/dist/src/Reporters/JUnitReporter.js +7 -7
- package/dist/src/Reporters/JUnitReporter.js.map +1 -1
- package/dist/src/Reporters/ResultReporter.d.ts +3 -3
- package/dist/src/Reporters/ResultReporter.d.ts.map +1 -1
- package/dist/src/Reporters/SonarReporter.d.ts +2 -2
- package/dist/src/Reporters/SonarReporter.d.ts.map +1 -1
- package/dist/src/Reporters/SonarReporter.js +16 -16
- package/dist/src/Reporters/SonarReporter.js.map +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 +5 -5
- package/dist/src/Runners/Runner.js.map +1 -1
- package/dist/src/Runners/TestRunner.d.ts +4 -4
- package/dist/src/Runners/TestRunner.d.ts.map +1 -1
- package/dist/src/Runners/TestRunner.js +4 -4
- package/dist/src/Runners/TestRunner.js.map +1 -1
- package/dist/src/Runners/TestSuiteLoader.d.ts +3 -3
- package/dist/src/Runners/TestSuiteLoader.d.ts.map +1 -1
- package/dist/src/Runners/TestSuiteLoader.js +15 -15
- package/dist/src/Runners/TestSuiteLoader.js.map +1 -1
- package/dist/src/Runners/TestSuiteRunner.d.ts +5 -5
- package/dist/src/Runners/TestSuiteRunner.d.ts.map +1 -1
- package/dist/src/Runners/TestSuiteRunner.js +1 -1
- package/dist/src/Runners/TestSuiteRunner.js.map +1 -1
- package/dist/xunit.d.ts +3 -3
- package/dist/xunit.d.ts.map +1 -1
- package/dist/xunit.js.map +1 -1
- package/icon.svg +74 -75
- package/logo.svg +130 -130
- package/package.json +43 -37
- package/src/Assertions/Contains.ts +10 -10
- package/src/Assertions/Count.ts +11 -11
- package/src/Assertions/Defined.ts +11 -11
- package/src/Assertions/DoesNotContain.ts +11 -11
- package/src/Assertions/DoesNotThrow.ts +13 -13
- package/src/Assertions/Empty.ts +11 -11
- package/src/Assertions/Equal.ts +12 -12
- package/src/Assertions/False.ts +11 -11
- package/src/Assertions/InstanceOf.ts +2 -2
- package/src/Assertions/NotEmpty.ts +11 -11
- package/src/Assertions/NotEqual.ts +12 -12
- package/src/Assertions/NotNull.ts +11 -11
- package/src/Assertions/Null.ts +11 -11
- package/src/Assertions/StringContains.ts +11 -11
- package/src/Assertions/StringDoesNotContain.ts +12 -12
- package/src/Assertions/StringDoesNotEndWith.ts +13 -13
- package/src/Assertions/StringDoesNotStartWith.ts +12 -12
- package/src/Assertions/StringEndsWith.ts +13 -13
- package/src/Assertions/StringStartsWith.ts +12 -12
- package/src/Assertions/Throws.ts +11 -11
- package/src/Assertions/True.ts +11 -11
- package/src/Assertions/Undefined.ts +12 -12
- package/src/Assertions/index.ts +45 -45
- package/src/CLI.ts +85 -85
- package/src/Factory.ts +25 -25
- package/src/Framework/ResultType.ts +4 -4
- package/src/Framework/Test.ts +6 -6
- package/src/Framework/TestName.ts +7 -7
- package/src/Framework/TestResult.ts +3 -2
- package/src/Framework/TestSuite.ts +18 -18
- package/src/Framework/TestSuiteResults.ts +17 -16
- package/src/IO/FileSystem.ts +28 -29
- package/src/IO/Output.ts +21 -20
- package/src/Reporters/ConsoleReporter.ts +88 -87
- package/src/Reporters/FileReporter.ts +29 -29
- package/src/Reporters/JUnitReporter.ts +80 -80
- package/src/Reporters/ResultReporter.ts +20 -12
- package/src/Reporters/SonarReporter.ts +86 -86
- package/src/Reporters/XMLReporter.ts +6 -6
- package/src/Runners/Runner.ts +21 -21
- package/src/Runners/TestRunner.ts +34 -33
- package/src/Runners/TestSuiteLoader.ts +41 -40
- package/src/Runners/TestSuiteRunner.ts +27 -26
- package/tsconfig.json +26 -26
- package/xunit.ts +6 -6
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import ResultReporter from
|
|
2
|
-
import TestSuite from
|
|
3
|
-
import TestSuiteResults from
|
|
4
|
-
import TestInfo from
|
|
5
|
-
import TestRunner from
|
|
1
|
+
import ResultReporter from "../Reporters/ResultReporter";
|
|
2
|
+
import TestSuite from "../Framework/TestSuite";
|
|
3
|
+
import TestSuiteResults from "../Framework/TestSuiteResults";
|
|
4
|
+
import TestInfo from "../Framework/TestInfo";
|
|
5
|
+
import TestRunner from "./TestRunner";
|
|
6
6
|
|
|
7
7
|
export default class TestSuiteRunner {
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
constructor(private readonly runner: TestRunner, private readonly reporters: ReadonlyArray<ResultReporter>) {
|
|
10
|
+
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
async runSuite(suite: TestSuite) {
|
|
13
|
+
await Promise.all(this.reporters.map(r => r.suiteStarted(suite)));
|
|
14
|
+
const tests = suite.getTests();
|
|
15
|
+
const results = await this.runTests(suite, tests);
|
|
16
|
+
await Promise.all(this.reporters.map(r => r.suiteCompleted(suite, results)));
|
|
17
|
+
return results;
|
|
18
|
+
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
async runTests(suite: TestSuite, tests: Record<string, TestInfo>) {
|
|
21
|
+
const results = new TestSuiteResults(suite);
|
|
22
|
+
if (tests === undefined || tests === null || Object.keys(tests).length === 0) {
|
|
23
|
+
await Promise.all(this.reporters.map(r => r.testIncomplete(suite, "(no tests found)")));
|
|
24
|
+
return results;
|
|
25
|
+
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const test_names = Object.keys(tests);
|
|
28
|
+
for (const name of test_names) {
|
|
29
|
+
const result = await this.runner.runTest(name, tests[name], suite);
|
|
30
|
+
results.addResult(name, result);
|
|
31
|
+
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
return results;
|
|
34
|
+
}
|
|
34
35
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2015",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"outDir": "./dist/",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"emitDecoratorMetadata": true
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"xunit.ts",
|
|
16
|
+
"cli.ts",
|
|
17
|
+
"tsdoc.ts"
|
|
18
|
+
],
|
|
19
|
+
"include": [
|
|
20
|
+
"src/**/*.ts",
|
|
21
|
+
"tests/**/*.ts",
|
|
22
|
+
"TSDoc/**/*.ts"
|
|
23
|
+
],
|
|
24
|
+
"exclude": [
|
|
25
|
+
"node_modules",
|
|
26
|
+
"dist"
|
|
27
|
+
]
|
|
28
28
|
}
|
package/xunit.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Test from
|
|
2
|
-
import TestSuite from
|
|
3
|
-
import Assert from
|
|
1
|
+
import Test from "./src/Framework/Test";
|
|
2
|
+
import TestSuite from "./src/Framework/TestSuite";
|
|
3
|
+
import Assert from "./src/Assertions";
|
|
4
4
|
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Test,
|
|
7
|
+
TestSuite,
|
|
8
|
+
Assert
|
|
9
9
|
};
|