diff --git a/packages/vest/src/core/produce/genTestsSummary.js b/packages/vest/src/core/produce/genTestsSummary.js index 68d695e5b..59e7159e4 100644 --- a/packages/vest/src/core/produce/genTestsSummary.js +++ b/packages/vest/src/core/produce/genTestsSummary.js @@ -16,9 +16,12 @@ const genTestsSummary = () => { const [skippedTests] = useSkippedTests(); const summary = { - tests: {}, + [SEVERITY_COUNT_ERROR]: 0, + [SEVERITY_COUNT_WARN]: 0, + [TEST_COUNT]: 0, groups: {}, name: suiteIdState.name, + tests: {}, }; appendSummary(testObjects); @@ -53,10 +56,6 @@ const genTestsSummary = () => { * @param {Object} summary (generated by genTestsSummary) */ export const countFailures = summary => { - summary[SEVERITY_COUNT_ERROR] = 0; - summary[SEVERITY_COUNT_WARN] = 0; - summary[TEST_COUNT] = 0; - for (const test in summary.tests) { summary[SEVERITY_COUNT_ERROR] += summary.tests[test][SEVERITY_COUNT_ERROR]; summary[SEVERITY_COUNT_WARN] += summary.tests[test][SEVERITY_COUNT_WARN]; diff --git a/packages/vest/src/core/state/createStateRef.js b/packages/vest/src/core/state/createStateRef.js index 5f5b367bb..68fe57ce1 100644 --- a/packages/vest/src/core/state/createStateRef.js +++ b/packages/vest/src/core/state/createStateRef.js @@ -7,7 +7,7 @@ export default function createStateRef(state, { suiteId, name }) { skippedTests: state.registerStateKey(() => []), suiteId: state.registerStateKey(() => ({ id: suiteId, name })), testCallbacks: state.registerStateKey(() => ({ - fieldCallbacks: [], + fieldCallbacks: {}, doneCallbacks: [], })), testObjects: state.registerStateKey(() => []), diff --git a/packages/vest/src/core/test/lib/__tests__/__snapshots__/pending.test.js.snap b/packages/vest/src/core/test/lib/__tests__/__snapshots__/pending.test.js.snap index c2d5df98d..2d110bb0b 100644 --- a/packages/vest/src/core/test/lib/__tests__/__snapshots__/pending.test.js.snap +++ b/packages/vest/src/core/test/lib/__tests__/__snapshots__/pending.test.js.snap @@ -13,7 +13,7 @@ Object { }, "testCallbacks": Object { "doneCallbacks": Array [], - "fieldCallbacks": Array [], + "fieldCallbacks": Object {}, }, "testObjects": Array [], } @@ -32,7 +32,7 @@ Object { }, "testCallbacks": Object { "doneCallbacks": Array [], - "fieldCallbacks": Array [], + "fieldCallbacks": Object {}, }, "testObjects": Array [], } @@ -61,7 +61,7 @@ Object { }, "testCallbacks": Object { "doneCallbacks": Array [], - "fieldCallbacks": Array [], + "fieldCallbacks": Object {}, }, "testObjects": Array [], } @@ -107,7 +107,7 @@ Object { }, "testCallbacks": Object { "doneCallbacks": Array [], - "fieldCallbacks": Array [], + "fieldCallbacks": Object {}, }, "testObjects": Array [], }