Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastBuild: Fix disabledAddons filter #24924

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions code/lib/core-common/src/presets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,4 +655,68 @@ describe('loadPreset', () => {
]
`);
});

it('should filter out disabledAddons', async () => {
const loaded = await loadPreset(
{
name: '',
type: 'virtual',
framework: '@storybook/react',
presets: ['@storybook/preset-typescript'],
addons: ['@storybook/addon-docs', 'addon-bar'],
},
0,
{
build: {
test: {
disabledAddons: ['@storybook/addon-docs'],
},
},
}
);

// addon-docs should not be at the top level, but addon-bar and others should be.
expect(loaded).toMatchInlineSnapshot(`
Array [
Object {
"name": "@storybook/preset-typescript",
"options": Object {},
"preset": Object {},
},
Object {
"name": "@storybook/addon-interactions/preset",
"options": Object {},
"preset": Object {},
},
Object {
"name": "@storybook/addon-cool",
"options": Object {},
"preset": Object {},
},
Object {
"name": "addon-bar",
"options": Object {},
"preset": Object {},
},
Object {
"name": Object {
"addons": Array [
"@storybook/addon-docs",
"addon-bar",
],
"framework": "@storybook/react",
"name": "",
"presets": Array [
"@storybook/preset-typescript",
],
"type": "virtual",
},
"options": Object {},
"preset": Object {
"framework": "@storybook/react",
},
},
]
`);
});
});
2 changes: 1 addition & 1 deletion code/lib/core-common/src/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export async function loadPreset(
// @ts-expect-error (Converted from ts-ignore)
const name = i.name ? i.name : i;

return !!storybookOptions.build?.test?.disabledAddons?.find((n) => name.includes(n));
return !storybookOptions.build?.test?.disabledAddons?.find((n) => name.includes(n));
};
}

Expand Down