Skip to content

Commit

Permalink
chore: print files relative to the root in verbose logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Oct 2, 2024
1 parent 366ac38 commit b0ff804
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/runner/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class TestRunner extends vscode.Disposable {
log.verbose?.('Not starting the runner because tests are being collected')
}
else {
log.verbose?.('The runner is starting because tests', ...files, 'were started due to a file change')
log.verbose?.('The runner is starting because tests', ...files.map(f => this.relative(f)), 'were started due to a file change')
this.startTestRun(files)
}
})
Expand Down Expand Up @@ -101,7 +101,7 @@ export class TestRunner extends vscode.Disposable {
api.onFinished(async (files = [], unhandledError, collecting) => {
const testRun = this.testRun
if (!testRun) {
log.verbose?.('No test run to finish for', files.map(f => f.filepath).join(', '))
log.verbose?.('No test run to finish for', files.map(f => this.relative(f.filepath)).join(', '))
return
}

Expand Down Expand Up @@ -179,7 +179,7 @@ export class TestRunner extends vscode.Disposable {
log.info(
'[RUNNER]',
'Watching test files:',
files.map(f => relative(this.api.workspaceFolder.uri.fsPath, f)).join(', '),
files.map(f => this.relative(f)).join(', '),
testNamePatern ? `with pattern ${testNamePatern}` : '',
)
await this.api.watchTests(files, testNamePatern)
Expand Down Expand Up @@ -257,7 +257,7 @@ export class TestRunner extends vscode.Disposable {
if (testNamePatern)
log.info(`Running ${files.length} file(s) with name pattern: ${testNamePatern}`)
else
log.info(`Running ${files.length} file(s):`, files.map(f => relative(root, f)))
log.info(`Running ${files.length} file(s):`, files.map(f => this.relative(f)))
await runTests(files, testNamePatern)
}
}
Expand Down Expand Up @@ -312,7 +312,7 @@ export class TestRunner extends vscode.Disposable {
const request = primaryRequest || this.nonContinuousRequest || this.createContinuousRequest()

if (!request) {
log.verbose?.('No test run request found for', ...files)
log.verbose?.('No test run request found for', ...files.map(f => this.relative(f)))
return
}

Expand All @@ -324,7 +324,7 @@ export class TestRunner extends vscode.Disposable {

const name = files.length > 1
? undefined
: relative(this.api.workspaceFolder.uri.fsPath, files[0])
: this.relative(files[0])

const run = this.testRun = this.controller.createTestRun(request, name)

Expand Down Expand Up @@ -444,6 +444,10 @@ export class TestRunner extends vscode.Disposable {

this.markTestCase(testRun, test, result)
}

private relative(file: string) {
return relative(this.api.workspaceFolder.uri.fsPath, file)
}
}

function testMessageForTestError(testItem: vscode.TestItem, error: TestError | undefined): vscode.TestMessage {
Expand Down

0 comments on commit b0ff804

Please sign in to comment.