fix: fix storybook coverage task (#5256)

- Fixes storybook coverage command: the coverage directory path was
incorrect, but instead of failing `storybook:test --configuration=ci`,
it was hanging indefinitely.
- Switches back to `concurrently` to launch `storybook:static` and
`storybook:test` in parallel, which allows to use options to explicitly
kill `storybook:static` when `storybook:test` fails.
- Moves `storybook:test --configuration=ci` to its own command
`storybook:static:test`: used in the CI, and can be used locally to run
storybook tests without having to launch `storybook:dev` first.
- Creates command `storybook:coverage` and enables cache for this
command.
- Fixes Jest tests that were failing.
- Improves caching conditions for some tasks (for instance, no need to
invalidate Jest test cache if only Storybook story files were modified).
This commit is contained in:
Thaïs
2024-05-03 14:59:09 +02:00
committed by GitHub
parent 50421863d4
commit 1351a95754
11 changed files with 123 additions and 75 deletions

View File

@ -62,8 +62,8 @@ describe('generateCsv', () => {
},
];
const csv = generateCsv({ columns, rows });
expect(csv).toEqual(`Foo,Empty,Nested Foo,Nested Nested
some field,,foo,nested`);
expect(csv).toEqual(`Foo,Empty,Nested Foo,Nested Nested,Relation
some field,,foo,nested,a relation`);
});
});

View File

@ -36,14 +36,16 @@ export const generateCsv: GenerateExport = ({
}: GenerateExportOptions): string => {
const columnsToExport = columns.filter(
(col) =>
!('relationType' in col.metadata && col.metadata.relationType) ||
!('relationType' in col.metadata) ||
col.metadata.relationType === 'TO_ONE_OBJECT',
);
const keys = columnsToExport.flatMap((col) => {
const column = {
field: `${col.metadata.fieldName}${col.type === 'RELATION' ? 'Id' : ''}`,
title: `${col.label} ${col.type === 'RELATION' ? 'Id' : ''}`,
title: [col.label, col.type === 'RELATION' ? 'Id' : null]
.filter(isDefined)
.join(' '),
};
const fieldsWithSubFields = rows.find((row) => {

View File

@ -2,6 +2,7 @@ import { useNavigate } from 'react-router-dom';
import { Section } from '@react-email/components';
import { useDeleteOneDatabaseConnection } from '@/databases/hooks/useDeleteOneDatabaseConnection';
import { SettingsIntegrationDatabaseConnectionSummaryCard } from '@/settings/integrations/database-connection/components/SettingsIntegrationDatabaseConnectionSummaryCard';
import { SettingsIntegrationDatabaseTablesListCard } from '@/settings/integrations/database-connection/components/SettingsIntegrationDatabaseTablesListCard';
import { useDatabaseConnection } from '@/settings/integrations/database-connection/hooks/useDatabaseConnection';
import { getConnectionDbName } from '@/settings/integrations/utils/getConnectionDbName';
@ -9,7 +10,6 @@ import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
import { SettingsPath } from '@/types/SettingsPath';
import { H2Title } from '@/ui/display/typography/components/H2Title';
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
import { SettingsIntegrationDatabaseConnectionSummaryCard } from '~/pages/settings/integrations/SettingsIntegrationDatabaseConnectionSummaryCard';
export const SettingsIntegrationDatabaseConnectionShowContainer = () => {
const navigate = useNavigate();

View File

@ -1,4 +1,5 @@
import {
FieldMetadataType,
ObjectEdge,
ObjectMetadataItemsQuery,
} from '~/generated-metadata/graphql';
@ -3201,7 +3202,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
node: {
__typename: 'field',
id: '7ada51cb-58be-42cd-86df-16c3f2bb8b58',
type: 'TEXT',
type: FieldMetadataType.Phone,
name: 'phone',
label: 'Phone',
description: 'Contacts phone number',