-
-
Notifications
You must be signed in to change notification settings - Fork 75
fix(laravel): make mock work #421
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
Conversation
| const agent = await detect({ cwd: dir, autoInstall: false }) | ||
| if (!agent) { | ||
| throw new Error(`failed to detect packageManager in ${dir}`) | ||
| } |
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.
This detection returned pnpm, but we should use the agent variable so that options.agent is respected.
| branch: '1.x', | ||
| branch: '2.x', |
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.
The latest version uses 2.x branch.
| async beforeTest() { | ||
| const dir = path.resolve(options.workspace, 'vite-plugin') | ||
| const vitestConfigFile = path.join(dir, 'vitest.config.ts') | ||
| fs.writeFileSync(vitestConfigFile, vitestConfig, 'utf-8') | ||
| }, |
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.
Added vitest.config.ts to exclude Vite from inlined by Vitest. Otherwise the mock here doesn't work.
https://github.com/laravel/vite-plugin/blob/3f7bf9eddc69580796c26890c99065d7259c785e/tests/index.test.ts#L7-L22
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.
Maybe we can add this info as a comment in code
No description provided.