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

Maintenance: Rename addon-vitest to addon-test #29014

Merged
merged 6 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 code/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const config: StorybookConfig = {
'@storybook/addon-interactions',
'@storybook/addon-storysource',
'@storybook/addon-designs',
'@storybook/experimental-addon-vitest',
'@storybook/experimental-addon-test',
'@storybook/addon-a11y',
'@chromatic-com/storybook',
],
Expand Down
2 changes: 1 addition & 1 deletion code/.storybook/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default mergeConfig(
vitestCommonConfig,
defineProject({
plugins: [
import('@storybook/experimental-addon-vitest/plugin').then(({ storybookTest }) =>
import('@storybook/experimental-addon-test/vite-plugin').then(({ storybookTest }) =>
storybookTest({
configDir: process.cwd(),
})
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@storybook/experimental-addon-vitest",
"name": "@storybook/experimental-addon-test",
"version": "8.3.0-beta.0",
"description": "Integrate Vitest with Storybook",
"keywords": [
Expand Down Expand Up @@ -29,7 +29,7 @@
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./plugin": {
"./vite-plugin": {
"types": "./dist/plugin/index.d.ts",
"import": "./dist/plugin/index.js",
"require": "./dist/plugin/index.cjs"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "vitest",
"name": "addon-test",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"targets": {
"build": {}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,22 @@ export const storybookTest = (options?: UserOptions): Plugin => {
if (typeof config.test.setupFiles === 'string') {
config.test.setupFiles = [config.test.setupFiles];
}
config.test.setupFiles.push('@storybook/experimental-addon-vitest/internal/setup-file');
config.test.setupFiles.push('@storybook/experimental-addon-test/internal/setup-file');

// when a Storybook script is provided, we spawn Storybook for the user when in watch mode
if (finalOptions.storybookScript) {
config.test.globalSetup = config.test.globalSetup ?? [];
if (typeof config.test.globalSetup === 'string') {
config.test.globalSetup = [config.test.globalSetup];
}
config.test.globalSetup.push('@storybook/experimental-addon-vitest/internal/global-setup');
config.test.globalSetup.push('@storybook/experimental-addon-test/internal/global-setup');
}

config.test.server ??= {};
config.test.server.deps ??= {};
config.test.server.deps.inline ??= [];
if (Array.isArray(config.test.server.deps.inline)) {
config.test.server.deps.inline.push('@storybook/experimental-addon-vitest');
config.test.server.deps.inline.push('@storybook/experimental-addon-test');
}
},
async transform(code, id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default async function postInstall(options: PostinstallOptions) {
browserWorkspaceFile,
dedent`
import { defineWorkspace } from 'vitest/config';
import { storybookTest } from '@storybook/experimental-addon-vitest/plugin';
import { storybookTest } from '@storybook/experimental-addon-test/vite-plugin';
${vitestInfo.frameworkPluginImport ? vitestInfo.frameworkPluginImport + '\n' : ''}
export default defineWorkspace([
'${relative(dirname(browserWorkspaceFile), rootConfig)}',
Expand Down Expand Up @@ -154,7 +154,7 @@ export default async function postInstall(options: PostinstallOptions) {
resolve('vitest.config.ts'),
dedent`
import { defineConfig } from "vitest/config";
import { storybookTest } from "@storybook/experimental-addon-vitest/plugin";
import { storybookTest } from "@storybook/experimental-addon-test/vite-plugin";
${vitestInfo.frameworkPluginImport ? vitestInfo.frameworkPluginImport + '\n' : ''}
export default defineConfig({
plugins: [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion code/core/src/common/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export default {
'@storybook/addon-onboarding': '8.3.0-beta.0',
'@storybook/addon-outline': '8.3.0-beta.0',
'@storybook/addon-storysource': '8.3.0-beta.0',
'@storybook/experimental-addon-test': '8.3.0-beta.0',
'@storybook/addon-themes': '8.3.0-beta.0',
'@storybook/addon-toolbars': '8.3.0-beta.0',
'@storybook/addon-viewport': '8.3.0-beta.0',
'@storybook/experimental-addon-vitest': '8.3.0-beta.0',
'@storybook/builder-vite': '8.3.0-beta.0',
'@storybook/builder-webpack5': '8.3.0-beta.0',
'@storybook/core': '8.3.0-beta.0',
Expand Down
24 changes: 12 additions & 12 deletions code/core/src/csf-tools/vitest-plugin/transformer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
component: Button,
title: "automatic/calculated/title"
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
title: "automatic/calculated/title",
component: Button
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const meta = {
component: Button,
title: "automatic/calculated/title"
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const meta = {
title: "automatic/calculated/title",
component: Button
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
component: Button,
title: "automatic/calculated/title"
Expand Down Expand Up @@ -229,7 +229,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
title: "automatic/calculated/title"
};
Expand Down Expand Up @@ -264,7 +264,7 @@ describe('transformer', () => {
const result = await transform({ code });
expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
title: "automatic/calculated/title"
};
Expand Down Expand Up @@ -299,7 +299,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
title: "automatic/calculated/title",
component: Button,
Expand Down Expand Up @@ -356,7 +356,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
title: "automatic/calculated/title"
};
Expand Down Expand Up @@ -387,7 +387,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
title: "automatic/calculated/title"
};
Expand Down Expand Up @@ -416,7 +416,7 @@ describe('transformer', () => {

expect(result.code).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const _meta = {
title: "automatic/calculated/title"
};
Expand Down Expand Up @@ -449,7 +449,7 @@ describe('transformer', () => {

expect(transformedCode).toMatchInlineSnapshot(`
import { test as _test, expect as _expect } from "vitest";
import { testStory as _testStory } from "@storybook/experimental-addon-vitest/internal/test-utils";
import { testStory as _testStory } from "@storybook/experimental-addon-test/internal/test-utils";
const meta = {
title: "automatic/calculated/title",
component: Button
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/csf-tools/vitest-plugin/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export async function vitestTransform({
),
t.importDeclaration(
[t.importSpecifier(testStoryId, t.identifier('testStory'))],
t.stringLiteral('@storybook/experimental-addon-vitest/internal/test-utils')
t.stringLiteral('@storybook/experimental-addon-test/internal/test-utils')
),
];

Expand Down
2 changes: 1 addition & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"@storybook/csf-plugin": "workspace:*",
"@storybook/ember": "workspace:*",
"@storybook/eslint-config-storybook": "^4.0.0",
"@storybook/experimental-addon-vitest": "workspace:*",
"@storybook/experimental-addon-test": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/html": "workspace:*",
"@storybook/html-vite": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6126,9 +6126,9 @@ __metadata:
languageName: node
linkType: hard

"@storybook/experimental-addon-vitest@workspace:*, @storybook/experimental-addon-vitest@workspace:addons/vitest":
"@storybook/experimental-addon-test@workspace:*, @storybook/experimental-addon-test@workspace:addons/test":
version: 0.0.0-use.local
resolution: "@storybook/experimental-addon-vitest@workspace:addons/vitest"
resolution: "@storybook/experimental-addon-test@workspace:addons/test"
dependencies:
"@storybook/csf": "npm:^0.1.11"
"@vitest/browser": "npm:^2.0.0"
Expand Down Expand Up @@ -6720,7 +6720,7 @@ __metadata:
"@storybook/csf-plugin": "workspace:*"
"@storybook/ember": "workspace:*"
"@storybook/eslint-config-storybook": "npm:^4.0.0"
"@storybook/experimental-addon-vitest": "workspace:*"
"@storybook/experimental-addon-test": "workspace:*"
"@storybook/global": "npm:^5.0.0"
"@storybook/html": "workspace:*"
"@storybook/html-vite": "workspace:*"
Expand Down
4 changes: 2 additions & 2 deletions scripts/tasks/sandbox-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export async function setupVitest(details: TemplateDetails, options: PassedOptio
join(sandboxDir, 'vitest.workspace.ts'),
dedent`
import { defineWorkspace, defaultExclude } from "vitest/config";
import { storybookTest } from "@storybook/experimental-addon-vitest/plugin";
import { storybookTest } from "@storybook/experimental-addon-test/vite-plugin";
${frameworkPluginImport}

export default defineWorkspace([
Expand Down Expand Up @@ -513,7 +513,7 @@ export async function setupVitest(details: TemplateDetails, options: PassedOptio
const vitestAddonPath = relative(sandboxDir, join(CODE_DIRECTORY, 'addons', 'vitest'));
packageJson.resolutions = {
...packageJson.resolutions,
'@storybook/experimental-addon-vitest': `file:${vitestAddonPath}`,
'@storybook/experimental-addon-test': `file:${vitestAddonPath}`,
};
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/tasks/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const sandbox: Task = {
'vitest',
'playwright',
'@vitest/browser',
'@storybook/experimental-addon-vitest'
'@storybook/experimental-addon-test'
);

if (details.template.expected.framework.includes('nextjs')) {
Expand Down
Loading