Skip to content

Add vitest config to prevent deploy side-effect#44

Merged
cyanzhong merged 3 commits intomainfrom
copilot/fix-test-step-deployment
Mar 15, 2026
Merged

Add vitest config to prevent deploy side-effect#44
cyanzhong merged 3 commits intomainfrom
copilot/fix-test-step-deployment

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

vitest run falls back to vite.config.mts when no vitest.config.mts exists. This causes the markedit-copy-dist-file plugin's closeBundle hook to fire during test runs, printing "Successfully deployed to …" and copying files when a dist/ directory is present from a prior build.

  • Add vitest.config.mts with only the define needed for __PKG_VERSION__ — no build/deploy plugins
  • Revert the earlier build/precheck script split since the root cause was config inheritance, not script chaining
// vitest.config.mts — standalone, does not inherit vite.config.mts
import { defineConfig } from 'vitest/config';
import mainPackage from './package.json' with { type: 'json' };

export default defineConfig({
  define: {
    __PKG_VERSION__: JSON.stringify(mainPackage.version),
  },
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Is this file being used out of the box?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — vitest automatically discovers vitest.config.{ts,mts,js,...} in the project root before falling back to vite.config.*. No extra flags or package.json changes needed. The test script stays as vitest run and it picks up vitest.config.mts on its own.

Copilot AI and others added 3 commits March 15, 2026 19:23
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
@cyanzhong cyanzhong force-pushed the copilot/fix-test-step-deployment branch from d2de4d5 to 2a82cdf Compare March 15, 2026 11:23
@cyanzhong cyanzhong changed the title Add dedicated vitest config to prevent deploy side-effect during tests Add vitest config to prevent deploy side-effect Mar 15, 2026
@cyanzhong cyanzhong merged commit 5273e76 into main Mar 15, 2026
1 check passed
@cyanzhong cyanzhong deleted the copilot/fix-test-step-deployment branch March 15, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants