Skip to content

Commit d9a491e

Browse files
committed
fix: TestRunWriter.appendLine should append trailing newline
1 parent 8828ff5 commit d9a491e

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { describe, expect, it, vi } from 'vitest';
2+
import type { TestRun } from 'vscode';
3+
import { TestRunWriter } from './TestRunWriter';
4+
5+
describe('TestRunWriter', () => {
6+
it('append delegates to testRun.appendOutput', () => {
7+
const spy = vi.fn();
8+
const testRun = { appendOutput: spy } as unknown as TestRun;
9+
const writer = new TestRunWriter(testRun);
10+
11+
writer.append('hello');
12+
13+
expect(spy).toHaveBeenCalledWith('hello');
14+
});
15+
16+
it('appendLine delegates to testRun.appendOutput with trailing newline', () => {
17+
const spy = vi.fn();
18+
const testRun = { appendOutput: spy } as unknown as TestRun;
19+
const writer = new TestRunWriter(testRun);
20+
21+
writer.appendLine('hello');
22+
23+
expect(spy).toHaveBeenCalledWith('hello\n');
24+
});
25+
});

packages/extension/src/Observers/Writers/TestRunWriter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export class TestRunWriter implements OutputWriter {
99
}
1010

1111
appendLine(text: string): void {
12-
this.testRun.appendOutput(text);
12+
this.testRun.appendOutput(text + '\n');
1313
}
1414
}

0 commit comments

Comments
 (0)