mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
test: fix file paths in vitest GitHub Actions annotations (#54813)
CI checks Electron out in src/electron rather than at GITHUB_WORKSPACE, so the github-actions reporter emitted absolute paths in failure annotations and job summary permalinks that pointed at src/electron/spec/... Map them to paths relative to the repo root. Claude-Session: https://claude.ai/code/session_017VP4oeZGEQd17hf55hysYL Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
1a4f7601a1
commit
2ccdf3f405
1 file changed
+10
-2
+10
-2
@@ -71,8 +71,16 @@ process.env.ELECTRON_SPEC_WORKERS = String(maxWorkers);
|
||||
const reporters: (string | [string, Record<string, unknown>] | SpecTimingsReporter)[] = ['default'];
|
||||
if (process.env.GITHUB_ACTIONS === 'true') {
|
||||
// Annotates failures on the PR; vitest only adds it by itself when no
|
||||
// reporters are configured.
|
||||
reporters.push('github-actions');
|
||||
// reporters are configured. CI checks Electron out in src/electron, not at
|
||||
// GITHUB_WORKSPACE, so give GitHub paths relative to the repo root.
|
||||
const repoRoot = path.resolve(specDir, '..');
|
||||
reporters.push([
|
||||
'github-actions',
|
||||
{
|
||||
onWritePath: (file: string) => path.relative(repoRoot, file).replaceAll(path.sep, '/'),
|
||||
jobSummary: { fileLinks: { workspacePath: repoRoot } }
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (process.env.MOCHA_FILE) {
|
||||
reporters.push(['junit', { outputFile: process.env.MOCHA_FILE, includeConsoleOutput: false }]);
|
||||
|
||||
Reference in new issue
Block a user