From 8501f1b5b27bd1469dfc7a717888ab39e7a049ef Mon Sep 17 00:00:00 2001 From: David Matejka Date: Fri, 8 Dec 2023 16:45:55 +0100 Subject: [PATCH] fix(interface-tester): fix pages dir resolving --- packages/interface-tester/src/nodes.tsx | 12 ++++++------ packages/interface-tester/src/tests.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/interface-tester/src/nodes.tsx b/packages/interface-tester/src/nodes.tsx index 717a4cd000..4348527beb 100644 --- a/packages/interface-tester/src/nodes.tsx +++ b/packages/interface-tester/src/nodes.tsx @@ -1,4 +1,4 @@ -import { Children, isValidElement, ReactNode } from 'react' +import { Children, Fragment, isValidElement, ReactNode } from 'react' import { CreatePage, @@ -35,15 +35,15 @@ export const createNode = (value: any): ReactNode[] => { const props = value.props as any if (value.type === DataBindingProvider) { - return [<>{props.children}] + return [{props.children}] } else if (value.type === EditPage || value.type === EditScope || value.type === DetailPage || value.type === DetailScope) { - return [] + return [] } else if (value.type === CreatePage || value.type === CreateScope) { - return [] + return [] } else if (value.type === DataGridPage || value.type === DataGrid || value.type === DataGridScope) { - return [] + return [] } else if (value.type === ListPage || value.type === ListScope || value.type === TablePage || value.type === MultiEditPage || value.type === MultiEditScope) { - return [] + return [] } else if (value.type === GenericPage || value.type === Symbol.for('react.fragment')) { return (Array.isArray(props.children) ? props.children : [props.children]).map(createNode).flat() } diff --git a/packages/interface-tester/src/tests.ts b/packages/interface-tester/src/tests.ts index 0222d93734..674d5a4604 100644 --- a/packages/interface-tester/src/tests.ts +++ b/packages/interface-tester/src/tests.ts @@ -31,7 +31,7 @@ export const getTests = async (config: Config): Promise => { let pageBaseDir const possibleDirs = config.pagesDir ? [config.pagesDir] : ['pages', 'admin/pages'] for (const candidateDir of possibleDirs) { - const tmpBaseDir = join(process.cwd(), config.pagesDir ?? 'pages') + const tmpBaseDir = join(process.cwd(), candidateDir) if (await pathExists(tmpBaseDir)) { pageBaseDir = tmpBaseDir }