Skip to content

Commit

Permalink
Merge pull request #909 from chromaui/todd/fix-e2e-peer-deps
Browse files Browse the repository at this point in the history
Rename E2E peer dependencies
  • Loading branch information
tevanoff authored Feb 2, 2024
2 parents b5e5cc1 + 61cecf6 commit c123412
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inputs:
configFile:
description: 'Path from where to load the Chromatic config JSON file.'
cypress:
description: 'Run build against `chromatic-cypress` test archives'
description: 'Run build against `@chromatic-com/cypress` test archives'
required: false
debug:
description: 'Output verbose debugging information'
Expand Down Expand Up @@ -69,7 +69,7 @@ inputs:
description: 'Only run a single story or a subset of stories by their filename(s)'
required: false
playwright:
description: 'Run build against `chromatic-playwright` test archives'
description: 'Run build against `@chromatic-com/playwright` test archives'
required: false
preserveMissing:
description: 'Deprecated, use onlyChanged, onlyStoryNames or onlyStoryFiles instead'
Expand Down
12 changes: 6 additions & 6 deletions bin-src/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,34 @@ describe('installArchiveDependencies', () => {
it('successfully installs list of dependencies for Playwright if SB package is not found and Essentials is not found', async () => {
await installArchiveDependencies({}, 'playwright')
expect(execaCommand).toHaveBeenCalledOnce()
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic chromatic-playwright storybook@latest @storybook/addon-essentials@latest @storybook/server-webpack5@latest')
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic @chromatic-com/playwright storybook@latest @storybook/addon-essentials@latest @storybook/server-webpack5@latest')
})
it('successfully installs list of dependencies for Cypress if SB package is not found and Essentials is not found', async () => {
await installArchiveDependencies({}, 'cypress')
expect(execaCommand).toHaveBeenCalledOnce()
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic chromatic-cypress storybook@latest @storybook/addon-essentials@latest @storybook/server-webpack5@latest')
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic @chromatic-com/cypress storybook@latest @storybook/addon-essentials@latest @storybook/server-webpack5@latest')
})
it('successfully installs list of dependencies if SB package is found and Essentials is not found', async () => {
await installArchiveDependencies({devDependencies: {'storybook': '7.6.5'}}, 'playwright')
expect(execaCommand).toHaveBeenCalledOnce()
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic chromatic-playwright @storybook/addon-essentials@7.6.5 @storybook/server-webpack5@7.6.5')
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic @chromatic-com/playwright @storybook/addon-essentials@7.6.5 @storybook/server-webpack5@7.6.5')
})
it('successfully installs list of dependencies if SB package is found and Essentials is found in devDependencies', async () => {
await installArchiveDependencies({devDependencies: {storybook: '7.6.5', '@storybook/addon-essentials': '7.6.5'}}, 'playwright')
expect(execaCommand).toHaveBeenCalledOnce()
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic chromatic-playwright @storybook/server-webpack5@7.6.5')
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic @chromatic-com/playwright @storybook/server-webpack5@7.6.5')
vi.clearAllMocks()
})
it('successfully installs list of dependencies if SB package is found and Essentials is found in dependencies', async () => {
await installArchiveDependencies({dependencies: {storybook: '7.6.5', '@storybook/addon-essentials': '7.6.5'}}, 'playwright')
expect(execaCommand).toHaveBeenCalledOnce()
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic chromatic-playwright @storybook/server-webpack5@7.6.5')
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic @chromatic-com/playwright @storybook/server-webpack5@7.6.5')
vi.clearAllMocks()
})
it('successfully installs list of dependencies if SB package is not found and Essentials is found in dependencies', async () => {
await installArchiveDependencies({dependencies: {'@storybook/addon-essentials': '7.6.5'}}, 'playwright')
expect(execaCommand).toHaveBeenCalledOnce()
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic chromatic-playwright storybook@7.6.5 @storybook/server-webpack5@7.6.5')
expect(execaCommand).toHaveBeenCalledWith('yarn add -D chromatic @chromatic-com/playwright storybook@7.6.5 @storybook/server-webpack5@7.6.5')
vi.clearAllMocks()
})
})
2 changes: 1 addition & 1 deletion bin-src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const getStorybookPackages = (pkgJson: PackageJson) => {
}

export const installArchiveDependencies = async (packageJson: PackageJson, testFramework: TestFrameworkType) => {
const defaultInstallArgs = ['-D', 'chromatic',`chromatic-${testFramework}`]
const defaultInstallArgs = ['-D', 'chromatic',`@chromatic-com/${testFramework}`]
const sbPackages = getStorybookPackages(packageJson)
const installArgs = [...defaultInstallArgs, ...sbPackages]
const installCommand = await getPackageManagerInstallCommand(installArgs)
Expand Down
2 changes: 1 addition & 1 deletion node-src/lib/getE2eBinPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { exitCodes, setExitCode } from './setExitCode';
import { failed } from '../ui/tasks/build';

export function getE2eBinPath(ctx: Context, flag: 'playwright' | 'cypress') {
const dependencyName = `chromatic-${flag}`;
const dependencyName = `@chromatic-com/${flag}`;
try {
return require.resolve(`${dependencyName}/bin/build-archive-storybook`);
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion node-src/ui/messages/errors/missingDependency.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export default {
};

export const MissingDependency = () =>
missingDependency({ dependencyName: 'chromatic-playwright', flag: 'playwright' });
missingDependency({ dependencyName: '@chromatic-com/playwright', flag: 'playwright' });
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@
"zod": "^3.22.2"
},
"peerDependencies": {
"chromatic-cypress": "^0.4.0 || ^1.0.0",
"chromatic-playwright": "^0.4.0 || ^1.0.0"
"@chromatic-com/cypress": "^0.5.2 || ^1.0.0",
"@chromatic-com/playwright": "^0.5.2 || ^1.0.0"
},
"peerDependenciesMeta": {
"chromatic-cypress": {
"@chromatic-com/cypress": {
"optional": true
},
"chromatic-playwright": {
"@chromatic-com/playwright": {
"optional": true
}
},
Expand Down

0 comments on commit c123412

Please sign in to comment.