Skip to content

Conversation

@sapphi-red
Copy link
Member

No description provided.

Comment on lines -543 to -546
const agent = await detect({ cwd: dir, autoInstall: false })
if (!agent) {
throw new Error(`failed to detect packageManager in ${dir}`)
}
Copy link
Member Author

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.

Comment on lines -10 to +12
branch: '1.x',
branch: '2.x',
Copy link
Member Author

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.

Comment on lines 14 to 18
async beforeTest() {
const dir = path.resolve(options.workspace, 'vite-plugin')
const vitestConfigFile = path.join(dir, 'vitest.config.ts')
fs.writeFileSync(vitestConfigFile, vitestConfig, 'utf-8')
},
Copy link
Member Author

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

Copy link
Member

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

@sapphi-red sapphi-red merged commit bccd855 into main Oct 30, 2025
4 checks passed
@sapphi-red sapphi-red deleted the fix/laravel-make-mock-work branch October 30, 2025 02:52
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.

3 participants