Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export async function setupBrowserConfiguration(
if (!providerName) {
errors ??= [];
errors.push(
'The "browsers" option requires either "playwright" or "webdriverio" to be installed within the project.' +
'The "browsers" option requires either "@vitest/browser-playwright", "@vitest/browser-webdriverio", ' +
'or "@vitest/browser-preview" to be installed within the project.' +
' Please install one of these packages and rerun the test command.',
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,28 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
`The "browsers" option requires either "@vitest/browser-playwright", "@vitest/browser-webdriverio", or "@vitest/browser-preview" to be installed`,
);
});

it('should name the provider packages when a runner config skips the dependency check', async () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't this a duplicate of the above test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It exercises a different path. With runnerConfig set, the up-front package check in index.ts is skipped, and the error comes from browser-provider.ts, which had the stale "playwright"/"webdriverio" wording. The two messages differ ("to be installed." versus "to be installed within the project."), but my assertion matched only the common prefix, so they looked the same. I've tightened the assertion to the text unique to the second path. I can also drop the test if you'd rather not cover it.

await harness.writeFile(
'vitest-base.config.mts',
`
import { defineConfig } from 'vitest/config';
export default defineConfig({});
`,
);

harness.useTarget('test', {
...BASE_OPTIONS,
runnerConfig: 'vitest-base.config.mts',
browsers: ['chrome'],
});

const { result, logs } = await harness.executeOnce();
expect(result?.success).toBeFalse();
expectLog(
logs,
`The "browsers" option requires either "@vitest/browser-playwright", "@vitest/browser-webdriverio", or "@vitest/browser-preview" to be installed within the project`,
);
});
});
});
Loading