-
Notifications
You must be signed in to change notification settings - Fork 75
feat: remove vitest/jest define method and support vitest in-source test #715
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@ice/pkg': major | ||
| --- | ||
|
|
||
| feat: remove vitest/jest define method and support vitest in-source test | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,10 @@ | ||||||||||||
| import pkgService, { defineJestConfig } from '@ice/pkg'; | ||||||||||||
|
|
||||||||||||
| export default defineJestConfig(pkgService, { | ||||||||||||
| export default { | ||||||||||||
| preset: 'ts-jest', | ||||||||||||
| setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'], | ||||||||||||
| testEnvironment: 'jest-environment-jsdom', | ||||||||||||
|
||||||||||||
| testEnvironment: 'jest-environment-jsdom', | |
| testEnvironment: 'jest-environment-jsdom', | |
| globals: { | |
| __DEV__: true, | |
| }, |
XGHeaven marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| export * from './test/index.js'; | ||
|
|
||
| export * from './types.js'; | ||
|
|
||
| export { getBuiltInPlugins } from './utils.js'; | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import getDefaultDefineValues from '../src/engine/shared/define'; | ||
|
|
||
| describe('getDefaultDefineValues', () => { | ||
| it('should include vitest in-source test guard by default', () => { | ||
| expect(getDefaultDefineValues('development')).toEqual({ | ||
| __DEV__: 'true', | ||
| 'process.env.NODE_ENV': '"development"', | ||
| 'import.meta.vitest': 'undefined', | ||
| }); | ||
| }); | ||
|
|
||
| it('should preserve production defaults', () => { | ||
| expect(getDefaultDefineValues('production')).toEqual({ | ||
| __DEV__: 'false', | ||
| 'process.env.NODE_ENV': '"production"', | ||
| 'import.meta.vitest': 'undefined', | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR 描述目前聚焦在示例 Jest 的 moduleNameMapper 修复,但本 changeset 声明了
@ice/pkg的 major 变更(移除 defineJestConfig/defineVitestConfig 等公共 API、默认 define/transform 行为调整)。建议同步更新 PR 描述,明确包含的破坏性变更点与迁移方式,避免发布说明与实际变更不一致。