Skip to content

Commit

Permalink
types(vest): add suiteName type to SuiteResult
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Jul 16, 2022
1 parent 47d688a commit 9b46fb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/vest/src/core/suite/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export type Suite<T extends CB> = {
* });
* });
*/
function create<T extends CB>(suiteName: string, suiteCallback: T): Suite<T>;
function create<T extends CB>(suiteName: SuiteName, suiteCallback: T): Suite<T>;
function create<T extends CB>(suiteCallback: T): Suite<T>;
// eslint-disable-next-line max-lines-per-function
function create<T extends CB>(
...args: [suiteName: string, suiteCallback: T] | [suiteCallback: T]
...args: [suiteName: SuiteName, suiteCallback: T] | [suiteCallback: T]
): Suite<T> {
const [suiteCallback, suiteName] = args.reverse() as [T, string];
const [suiteCallback, suiteName] = args.reverse() as [T, SuiteName];

invariant(
isFunction(suiteCallback),
Expand Down Expand Up @@ -101,3 +101,5 @@ function create<T extends CB>(
}

export default create;

export type SuiteName = string | void;
5 changes: 4 additions & 1 deletion packages/vest/src/core/suite/produce/produceSuiteResult.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { cache as createCache, assign } from 'vest-utils';

import { SuiteSummary } from 'SuiteSummaryTypes';
import { SuiteName } from 'create';
import ctx from 'ctx';
import genTestsSummary from 'genTestsSummary';
import { useStateRef, useTestsFlat, useSuiteName } from 'stateHooks';
Expand All @@ -24,4 +26,5 @@ export function produceSuiteResult(): SuiteResult {
);
}

export type SuiteResult = ReturnType<typeof genTestsSummary> & SuiteSelectors;
export type SuiteResult = SuiteSummary &
SuiteSelectors & { suiteName: SuiteName };

1 comment on commit 9b46fb6

@vercel
Copy link

@vercel vercel bot commented on 9b46fb6 Jul 16, 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.vercel.app
vest-next-git-latest-ealush.vercel.app
vest-next-ealush.vercel.app

Please sign in to comment.