Skip to content

Commit

Permalink
patch(vest): use isolate hook directly
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed May 27, 2022
1 parent f5d5c18 commit 1944122
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/vest/src/core/isolate/isolate.ts
Expand Up @@ -45,7 +45,7 @@ export function useIsolate(): Isolate {
* @returns {boolean} Whether or not the current isolate allows tests to be reordered
*/
export function shouldAllowReorder(): boolean {
return ctx.useX().isolate.type === IsolateTypes.EACH;
return useIsolate().type === IsolateTypes.EACH;
}

/**
Expand Down
9 changes: 3 additions & 6 deletions packages/vest/src/core/test/key.ts
Expand Up @@ -4,8 +4,7 @@ import * as nestedArray from 'nestedArray';
import { deferThrow } from 'throwError';

import VestTest from 'VestTest';
import ctx from 'ctx';
import { useCurrentPath } from 'isolate';
import { useCurrentPath, useIsolate } from 'isolate';
import { useTestObjects } from 'stateHooks';

export function usePrevKeys(): Record<string, VestTest> {
Expand All @@ -29,14 +28,12 @@ export function usePrevKeys(): Record<string, VestTest> {
}

export function usePrevTestByKey(key: string): VestTest | undefined {
const prev = ctx.useX().isolate.keys.prev;
const prev = useIsolate().keys.prev;
return prev[key];
}

export function useRetainTestKey(key: string, testObject: VestTest) {
const context = ctx.useX();

const current = context.isolate.keys.current;
const current = useIsolate().keys.current;
if (isNullish(current[key])) {
current[key] = testObject;
} else {
Expand Down

1 comment on commit 1944122

@vercel
Copy link

@vercel vercel bot commented on 1944122 May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest-next – ./website

vest-website.vercel.app
vest-next-git-latest-ealush.vercel.app
vest-next-ealush.vercel.app
vest-next.vercel.app

Please sign in to comment.