-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
feat: reportersIssues and PRs related to Vitest reportersIssues and PRs related to Vitest reportersp2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)pr welcome
Description
Clear and concise description of the problem
- Our project runs vitest in CI, and the file paths it reports don't line up with GitHub.
Suggested solution
- A config option for
GithubActionsReporterto customize the path prefix it outputs (maybe atransformfunction)
Alternative
export class CustomGithubReporter extends GithubActionsReporter {
override onInit(ctx: Vitest) {
/**
* GitHub expects that when formatting an error message, the filename is relative to the project root.
* Since we run in a Docker container for CI, we need to ensure that the filename matches what GitHub expects.
* https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message
*/
super.onInit(ctx);
const origLog = this.ctx.logger.log;
this.ctx.logger.log = (...args: any[]) => {
if (args.length === 1) {
args[0] = args[0].replaceAll(/(file=)\/PrairieLearn\//g, '$1');
}
origLog.call(this.ctx.logger, ...args);
};
}
}Additional context
N/A
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feat: reportersIssues and PRs related to Vitest reportersIssues and PRs related to Vitest reportersp2-to-be-discussedEnhancement under consideration (priority)Enhancement under consideration (priority)pr welcome
Type
Projects
Status
P2 - 2