Skip to content

Commit acd327e

Browse files
authored
Merge pull request #198 from no23reason/issue-197-todo-tests
fix: handle todo tests properly
2 parents fb9a939 + e9146e2 commit acd327e

File tree

3 files changed

+60
-54
lines changed

3 files changed

+60
-54
lines changed

src/__tests__/trx-generator.test.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,61 @@ describe("trx-generator", (): void => {
249249
expect(result).toBeTruthy();
250250
});
251251

252+
it("handles todo tests", (): void => {
253+
const input: AggregatedResult = {
254+
numFailedTestSuites: 0,
255+
numFailedTests: 0,
256+
numPassedTestSuites: 0,
257+
numPassedTests: 0,
258+
numPendingTestSuites: 0,
259+
numPendingTests: 0,
260+
numRuntimeErrorTestSuites: 0,
261+
numTodoTests: 1,
262+
numTotalTestSuites: 1,
263+
numTotalTests: 1,
264+
openHandles: [],
265+
snapshot: emptySnapshotSummary,
266+
startTime: 1511376995239,
267+
success: true,
268+
testResults: [
269+
{
270+
leaks: false,
271+
numFailingTests: 0,
272+
numPassingTests: 0,
273+
numPendingTests: 0,
274+
numTodoTests: 1,
275+
openHandles: [],
276+
perfStats: {
277+
end: 1511376996104,
278+
start: 1511376995923,
279+
},
280+
snapshot: emptySnapshot,
281+
testFilePath: "C:\\Users\\Github\\test\\test.spec.js",
282+
testResults: [
283+
{
284+
ancestorTitles: [],
285+
duration: 0,
286+
failureMessages: [],
287+
fullName: "first",
288+
numPassingAsserts: 0,
289+
status: "todo",
290+
title: "first",
291+
location: {
292+
column: 0,
293+
line: 0,
294+
},
295+
},
296+
],
297+
sourceMaps: {},
298+
skipped: true,
299+
},
300+
],
301+
wasInterrupted: false,
302+
};
303+
const result = generateTrx(input);
304+
expect(result).toBeTruthy();
305+
});
306+
252307
it("verify runtime suite failures", done => {
253308
const input: AggregatedResult = {
254309
numFailedTestSuites: 0,

src/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export const getSuitePerTestDuration = (testSuiteResult: TestResult): number =>
4444
(testSuiteResult.perfStats.end - testSuiteResult.perfStats.start) /
4545
(testSuiteResult.numPassingTests +
4646
testSuiteResult.numFailingTests +
47-
testSuiteResult.numPendingTests),
47+
testSuiteResult.numPendingTests +
48+
testSuiteResult.numTodoTests),
4849
);
4950

5051
export const getEnvInfo = (

yarn.lock

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -762,16 +762,6 @@
762762
regexpp "^3.0.0"
763763
tsutils "^3.17.1"
764764

765-
"@typescript-eslint/[email protected]":
766-
version "2.28.0"
767-
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.28.0.tgz#1fd0961cd8ef6522687b4c562647da6e71f8833d"
768-
integrity sha512-4SL9OWjvFbHumM/Zh/ZeEjUFxrYKtdCi7At4GyKTbQlrj1HcphIDXlje4Uu4cY+qzszR5NdVin4CCm6AXCjd6w==
769-
dependencies:
770-
"@types/json-schema" "^7.0.3"
771-
"@typescript-eslint/typescript-estree" "2.28.0"
772-
eslint-scope "^5.0.0"
773-
eslint-utils "^2.0.0"
774-
775765
"@typescript-eslint/[email protected]":
776766
version "2.29.0"
777767
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.29.0.tgz#3cb8060de9265ba131625a96bbfec31ba6d4a0fe"
@@ -792,19 +782,6 @@
792782
"@typescript-eslint/typescript-estree" "2.29.0"
793783
eslint-visitor-keys "^1.1.0"
794784

795-
"@typescript-eslint/[email protected]":
796-
version "2.28.0"
797-
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.28.0.tgz#d34949099ff81092c36dc275b6a1ea580729ba00"
798-
integrity sha512-HDr8MP9wfwkiuqzRVkuM3BeDrOC4cKbO5a6BymZBHUt5y/2pL0BXD6I/C/ceq2IZoHWhcASk+5/zo+dwgu9V8Q==
799-
dependencies:
800-
debug "^4.1.1"
801-
eslint-visitor-keys "^1.1.0"
802-
glob "^7.1.6"
803-
is-glob "^4.0.1"
804-
lodash "^4.17.15"
805-
semver "^6.3.0"
806-
tsutils "^3.17.1"
807-
808785
"@typescript-eslint/[email protected]":
809786
version "2.29.0"
810787
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.29.0.tgz#1be6612bb02fc37ac9f466521c1459a4744e8d3a"
@@ -3694,17 +3671,7 @@ jest-config@^25.4.0:
36943671
pretty-format "^25.4.0"
36953672
realpath-native "^2.0.0"
36963673

3697-
jest-diff@^25.2.1:
3698-
version "25.2.6"
3699-
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.2.6.tgz#a6d70a9ab74507715ea1092ac513d1ab81c1b5e7"
3700-
integrity sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg==
3701-
dependencies:
3702-
chalk "^3.0.0"
3703-
diff-sequences "^25.2.6"
3704-
jest-get-type "^25.2.6"
3705-
pretty-format "^25.2.6"
3706-
3707-
jest-diff@^25.4.0:
3674+
jest-diff@^25.2.1, jest-diff@^25.4.0:
37083675
version "25.4.0"
37093676
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.4.0.tgz#260b70f19a46c283adcad7f081cae71eb784a634"
37103677
integrity sha512-kklLbJVXW0y8UKOWOdYhI6TH5MG6QAxrWiBMgQaPIuhj3dNFGirKCd+/xfplBXICQ7fI+3QcqHm9p9lWu1N6ug==
@@ -5602,17 +5569,7 @@ prepend-http@^1.0.1:
56025569
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
56035570
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
56045571

5605-
pretty-format@^25.2.1, pretty-format@^25.2.6:
5606-
version "25.2.6"
5607-
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.2.6.tgz#542a1c418d019bbf1cca2e3620443bc1323cb8d7"
5608-
integrity sha512-DEiWxLBaCHneffrIT4B+TpMvkV9RNvvJrd3lY9ew1CEQobDzEXmYT1mg0hJhljZty7kCc10z13ohOFAE8jrUDg==
5609-
dependencies:
5610-
"@jest/types" "^25.2.6"
5611-
ansi-regex "^5.0.0"
5612-
ansi-styles "^4.0.0"
5613-
react-is "^16.12.0"
5614-
5615-
pretty-format@^25.4.0:
5572+
pretty-format@^25.2.1, pretty-format@^25.2.6, pretty-format@^25.4.0:
56165573
version "25.4.0"
56175574
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.4.0.tgz#c58801bb5c4926ff4a677fe43f9b8b99812c7830"
56185575
integrity sha512-PI/2dpGjXK5HyXexLPZU/jw5T9Q6S1YVXxxVxco+LIqzUFHXIbKZKdUVt7GcX7QUCr31+3fzhi4gN4/wUYPVxQ==
@@ -7307,14 +7264,7 @@ which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1:
73077264
dependencies:
73087265
isexe "^2.0.0"
73097266

7310-
which@^2.0.1:
7311-
version "2.0.1"
7312-
resolved "https://registry.yarnpkg.com/which/-/which-2.0.1.tgz#f1cf94d07a8e571b6ff006aeb91d0300c47ef0a4"
7313-
integrity sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==
7314-
dependencies:
7315-
isexe "^2.0.0"
7316-
7317-
which@^2.0.2:
7267+
which@^2.0.1, which@^2.0.2:
73187268
version "2.0.2"
73197269
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
73207270
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==

0 commit comments

Comments
 (0)