diff --git a/packages/vest/src/exports/SuiteSerializer.ts b/packages/vest/src/exports/SuiteSerializer.ts index ba5ca5a76..a771315f7 100644 --- a/packages/vest/src/exports/SuiteSerializer.ts +++ b/packages/vest/src/exports/SuiteSerializer.ts @@ -1,21 +1,23 @@ +import { assign } from 'vest-utils'; import { IsolateSerializer } from 'vestjs-runtime'; import { TIsolateSuite } from 'IsolateSuite'; import { IsolateTestPayload } from 'IsolateTest'; import { TFieldName, TGroupName } from 'SuiteResultTypes'; import { Suite } from 'SuiteTypes'; +import { IsolateFocusedPayload } from 'focused'; export class SuiteSerializer { static serialize(suite: Suite) { const dump = { ...suite.dump(), output: undefined }; - return IsolateSerializer.serialize(dump, miniMap); + return IsolateSerializer.serialize(dump, MiniMap); } static deserialize( serialized: string | TIsolateSuite | Record ): TIsolateSuite { - return IsolateSerializer.deserialize(serialized, miniMap) as TIsolateSuite; + return IsolateSerializer.deserialize(serialized, MiniMap) as TIsolateSuite; } static resume( @@ -28,7 +30,7 @@ export class SuiteSerializer { } } -const miniMap: Record = { +const testMiniMap: Record = { asyncTest: '_at', // asyncTest is not serialized fieldName: 'fN', groupName: 'gN', @@ -37,3 +39,11 @@ const miniMap: Record = { status: 'st', testFn: '_tf', // testFn is not serialized }; + +const focusMiniMap: Record = { + focusMode: 'fM', + match: 'm', + matchAll: 'mA', +}; + +const MiniMap = assign({}, testMiniMap, focusMiniMap); diff --git a/packages/vest/src/exports/__tests__/__snapshots__/SuiteSerializer.test.ts.snap b/packages/vest/src/exports/__tests__/__snapshots__/SuiteSerializer.test.ts.snap index 529ff56bf..e5bb86f3d 100644 --- a/packages/vest/src/exports/__tests__/__snapshots__/SuiteSerializer.test.ts.snap +++ b/packages/vest/src/exports/__tests__/__snapshots__/SuiteSerializer.test.ts.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`SuiteSerializer Should produce a valid serialized dump 1`] = `"{"C":[{"D":{"focusMode":0,"match":["field_1"],"matchAll":false},"$":"Focused","S":"DONE"},{"D":{"sv":"error","fN":"field_1","msg":"field_1_message"},"$":"Test","S":"FAILED"},{"D":{"sv":"error","fN":"field_2","msg":"field_2_message"},"$":"Test","S":"SKIPPED"},{"C":[{"D":{"sv":"error","fN":"field_3","gN":"group_1","msg":"field_3_message_1"},"$":"Test","S":"SKIPPED"},{"D":{"sv":"error","fN":"field_3","gN":"group_1","msg":"field_3_message_2"},"$":"Test","S":"SKIPPED"},{"D":{"sv":"error","fN":"field_4","gN":"group_1","msg":"field_4_message"},"$":"Test","S":"SKIPPED"}],"$":"Group","S":"DONE"},{"C":[{"D":{"sv":"error","fN":"field_5","msg":"field_5_message"},"$":"Test","S":"SKIPPED"}],"$":"SkipWhen","S":"DONE"}],"D":{"optional":{}},"$":"Suite","S":"DONE"}"`; +exports[`SuiteSerializer Should produce a valid serialized dump 1`] = `"{"C":[{"D":{"fM":0,"m":["field_1"],"mA":false},"$":"Focused","S":"DONE"},{"D":{"sv":"error","fN":"field_1","msg":"field_1_message"},"$":"Test","S":"FAILED"},{"D":{"sv":"error","fN":"field_2","msg":"field_2_message"},"$":"Test","S":"SKIPPED"},{"C":[{"D":{"sv":"error","fN":"field_3","gN":"group_1","msg":"field_3_message_1"},"$":"Test","S":"SKIPPED"},{"D":{"sv":"error","fN":"field_3","gN":"group_1","msg":"field_3_message_2"},"$":"Test","S":"SKIPPED"},{"D":{"sv":"error","fN":"field_4","gN":"group_1","msg":"field_4_message"},"$":"Test","S":"SKIPPED"}],"$":"Group","S":"DONE"},{"C":[{"D":{"sv":"error","fN":"field_5","msg":"field_5_message"},"$":"Test","S":"SKIPPED"}],"$":"SkipWhen","S":"DONE"}],"D":{"optional":{}},"$":"Suite","S":"DONE"}"`; diff --git a/packages/vest/src/hooks/focused/focused.ts b/packages/vest/src/hooks/focused/focused.ts index 5737a7904..08bc45a92 100644 --- a/packages/vest/src/hooks/focused/focused.ts +++ b/packages/vest/src/hooks/focused/focused.ts @@ -17,11 +17,13 @@ export type ExclusionItem = Maybe>; export type FieldExclusion = Maybe>; export type GroupExclusion = Maybe>; -export type TIsolateFocused = TIsolate<{ +export type TIsolateFocused = TIsolate; + +export type IsolateFocusedPayload = { focusMode: FocusModes; match: FieldExclusion; matchAll: boolean; -}>; +}; export function IsolateFocused( focusMode: FocusModes,