Skip to content

Commit

Permalink
Show relative path instead of a full one. (#566)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Sep 10, 2024
1 parent a51361e commit a499dbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tools/src/tester/ResultLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { overall_result } from './helpers'
import * as ansi from './Ansi'
import TestResults from './TestResults'
import _ from 'lodash'
import * as path from 'path'

export interface ResultLogger {
log: (evaluation: StoryEvaluation) => void
Expand Down Expand Up @@ -71,7 +72,7 @@ export class ConsoleResultLogger implements ResultLogger {
}

#log_story ({ result, full_path, display_path, message, warnings }: StoryEvaluation): void {
this.#log_evaluation({ result, message: message ?? full_path }, ansi.cyan(ansi.b(display_path)))
this.#log_evaluation({ result, message: message ?? path.relative('.', full_path) }, ansi.cyan(ansi.b(display_path)))
this.#log_warnings(warnings)
}

Expand Down
4 changes: 1 addition & 3 deletions tools/tests/tester/test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import { spawnSync } from 'child_process'
import * as ansi from 'tester/Ansi'
import * as path from 'path'
import { type Chapter, type ChapterRequest, type Output, type Request, Story } from 'tester/types/story.types'
import { ChapterEvaluation, Result, StoryEvaluation } from 'tester/types/eval.types'
import StoryEvaluator from 'tester/StoryEvaluator'
Expand Down Expand Up @@ -158,11 +157,10 @@ test.todo('--tab-width')
test('--dry-run', () => {
const test_yaml = 'tools/tests/tester/fixtures/empty_with_all_the_parts.yaml'
const s = spec(['--dry-run', '--tests', test_yaml]).stdout
const full_path = path.join(__dirname, '../../../' + test_yaml)
expect(s).not.toContain(`${ansi.yellow('SKIPPED')} CHAPTERS`)
expect(s).not.toContain(`${ansi.yellow('SKIPPED')} EPILOGUES`)
expect(s).not.toContain(`${ansi.yellow('SKIPPED')} PROLOGUES`)
expect(s).toContain(`${ansi.yellow('SKIPPED')} ${ansi.cyan(ansi.b('empty_with_all_the_parts.yaml'))} ${ansi.gray('(' + full_path + ')')}`)
expect(s).toContain(`${ansi.yellow('SKIPPED')} ${ansi.cyan(ansi.b('empty_with_all_the_parts.yaml'))} ${ansi.gray('(' + test_yaml + ')')}`)
})

test('--dry-run --verbose', () => {
Expand Down

0 comments on commit a499dbf

Please sign in to comment.