Skip to content

Commit

Permalink
fix: verbose mode runtime error
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrywu001 committed Apr 11, 2023
1 parent 5d02656 commit 5f52f6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sandpack-react/src/components/Tests/Describes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const Describes: React.FC<{ describes: Describe[] }> = ({
return null;
}

const tests = Object.values(describe.tests);
const describes = Object.values(describe.describes);
const tests = Object.values(describe.tests ?? {});
const describes = Object.values(describe.describes ?? {});

return (
<div
Expand Down
8 changes: 4 additions & 4 deletions sandpack-react/src/components/Tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const getAllSuiteResults = (specs: Spec[]): SuiteResults =>
specs
.filter(
(spec) =>
Object.values(spec.describes).length > 0 ||
Object.values(spec.tests).length > 0
Object.values(spec.describes ?? {}).length > 0 ||
Object.values(spec.tests ?? {}).length > 0
)
.map(getSpecTestResults)
.reduce(
Expand All @@ -65,8 +65,8 @@ export const getDuration = (specs: Spec[]): number =>
flatMap(specs, getTests).reduce((acc, test) => acc + (test.duration || 0), 0);

export const isEmpty = (block: Spec | Describe): boolean =>
Object.values(block.describes).length === 0 &&
Object.values(block.tests).length === 0;
Object.values(block.describes ?? {}).length === 0 &&
Object.values(block.tests ?? {}).length === 0;

export const splitTail = <A>(as: A[]): [A[], A | undefined] => {
const lastIndex = as.length - 1;
Expand Down

0 comments on commit 5f52f6c

Please sign in to comment.