Skip to content

Commit

Permalink
Save each test's log to a different file
Browse files Browse the repository at this point in the history
This also stores them as GitHub actions artifacts
  • Loading branch information
jonahgraham committed Sep 17, 2022
1 parent 7ff3e99 commit e204760
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ jobs:
run: yarn
- name: Test
run: yarn test

- uses: actions/upload-artifact@v3
with:
name: test-logs
path: test-logs/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ node_modules
/build/
/dist/
/test-reports/
/test-logs/
*.tgz
yarn-error.log
7 changes: 7 additions & 0 deletions src/integration-tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export function fillDefaults(
}
const args = argsIn !== undefined ? argsIn : ({} as RequestArguments);
args.verbose = true;
args.logFile = logFileName(test);
args.gdb = gdbPath;
args.openGdbConsole = openGdbConsole;
args.gdbAsync = gdbAsync;
Expand Down Expand Up @@ -276,6 +277,12 @@ beforeEach(function () {
}
});

export function logFileName(test: Runnable): string {
// Clean up characters that GitHub actions doesn't like in filenames
const cleaned = test.fullTitle().replace('>', '&gt;').replace('<', '&lt;');
return `${process.cwd()}/test-logs/${cleaned}.log`;
}

function getGdbPathCli(): string | undefined {
const keyIndex = process.argv.indexOf('--gdb-path');
if (keyIndex === -1) {
Expand Down

0 comments on commit e204760

Please sign in to comment.