Skip to content
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

feat: Add support for Vitest workspace #377

Merged
merged 8 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions src/inputs/getViteConfigPath.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ describe("getViteConfigPath", () => {
const warningMessage = vi.mocked(core.warning).mock.calls[0][0];
expect(warningMessage).toContain(`${mockWorkingDirectory}/doesNotExist`);
});

it("resolves Vitest workspace file", async (): Promise<void> => {
await expect(
getViteConfigPath(mockWorkingDirectory, "vitest.workspace.js")
).resolves.toMatch('test/mockConfig/vitest.workspace.js');
});
});
10 changes: 8 additions & 2 deletions src/inputs/getViteConfigPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ const testFilePath = async (workingDirectory: string, filePath: string) => {
};

const defaultPaths = [
"vitest.config.ts",
"vitest.config.mts",
"vitest.config.cts",
"vitest.config.js",
"vitest.config.mjs",
"vitest.config.cjs",
xeho91 marked this conversation as resolved.
Show resolved Hide resolved
"vitest.config.ts",
"vitest.config.mts",
"vitest.config.cts",
Expand Down Expand Up @@ -39,9 +45,9 @@ const getViteConfigPath = async (workingDirectory: string, input: string) => {
: `any default location in "${workingDirectory}"`;

core.warning(stripIndent`
Failed to read vite config file at ${searchPath}.
Failed to read vite config file at ${searchPath}.
Make sure you provide the vite-config-path option if you're using a non-default location or name of your config file.

Will not include thresholds in the final report.
`);
return null;
Expand Down
3 changes: 3 additions & 0 deletions test/mockConfig/vitest.workspace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineWorkspace } from "vitest/config";

export default defineWorkspace(["./*"]);