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) => {