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

Release 0.19.0 #465

Closed
wants to merge 9 commits into from
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@storybook/addon-coverage": "^0.0.9",
"@storybook/addon-coverage": "^1.0.0",
"@storybook/addon-essentials": "^8.0.0",
"@storybook/addon-interactions": "^8.0.0",
"@storybook/react": "^8.0.0",
Expand Down
7 changes: 5 additions & 2 deletions src/playwright/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BrowserContext, Page } from 'playwright';
import type { StoryContext } from '@storybook/csf';
import type { StoryContextForEnhancers } from '@storybook/csf';

export type TestContext = {
id: string;
Expand Down Expand Up @@ -73,7 +73,10 @@ export const setPostVisit = (postVisit: TestHook) => {
globalThis.__sbPostVisit = postVisit;
};

export const getStoryContext = async (page: Page, context: TestContext): Promise<StoryContext> => {
export const getStoryContext = async (
page: Page,
context: TestContext
): Promise<StoryContextForEnhancers> => {
return page.evaluate(({ storyId }) => globalThis.__getContext(storyId), {
storyId: context.id,
});
Expand Down
20 changes: 11 additions & 9 deletions src/test-storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function reportCoverage() {
if (process.env.JEST_SHARD !== 'true') {
const nycBinFullPath = getNycBinPath();
execSync(
`${nycBinFullPath} report --reporter=text --reporter=lcov -t ${coverageFolder} --report-dir ${coverageFolder}`,
`node ${nycBinFullPath} report --reporter=text --reporter=lcov -t ${coverageFolder} --report-dir ${coverageFolder}`,
{
stdio: 'inherit',
cwd: process.cwd(),
Expand Down Expand Up @@ -362,17 +362,19 @@ const main = async () => {
process.env.TEST_MATCH = '**/*.test.js';
}

const { storiesPaths, lazyCompilation } = getStorybookMetadata();
process.env.STORYBOOK_STORIES_PATTERN = storiesPaths;
if (!shouldRunIndexJson) {
const { storiesPaths, lazyCompilation } = getStorybookMetadata();
process.env.STORYBOOK_STORIES_PATTERN = storiesPaths;

if (runnerOptions.failOnConsole) {
process.env.TEST_CHECK_CONSOLE = 'true';
if (lazyCompilation && isLocalStorybookIp) {
log(
`You're running Storybook with lazy compilation enabled, and will likely cause issues with the test runner locally. Consider disabling 'lazyCompilation' in ${runnerOptions.configDir}/main.js when running 'test-storybook' locally.`
);
}
}

if (lazyCompilation && isLocalStorybookIp) {
log(
`You're running Storybook with lazy compilation enabled, and will likely cause issues with the test runner locally. Consider disabling 'lazyCompilation' in ${runnerOptions.configDir}/main.js when running 'test-storybook' locally.`
);
if (runnerOptions.failOnConsole) {
process.env.TEST_CHECK_CONSOLE = 'true';
}

await executeJestPlaywright(jestOptions);
Expand Down
Loading
Loading