bug(cli): Exclude only specific tests. (#6244)

This commit is contained in:
joshualitt
2025-08-14 10:35:34 -07:00
committed by GitHub
parent 4973e7e1e0
commit ef54f720de
3 changed files with 74 additions and 8 deletions

View File

@@ -12,15 +12,16 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { expect } from 'vitest';
import { Assertion, expect } from 'vitest';
import type { TextBuffer } from '../ui/components/shared/text-buffer.js';
// RegExp to detect invalid characters: backspace, and ANSI escape codes
// eslint-disable-next-line no-control-regex
const invalidCharsRegex = /[\b\x1b]/;
function toHaveOnlyValidCharacters(this: vi.Assertion, buffer: TextBuffer) {
const { isNot } = this;
function toHaveOnlyValidCharacters(this: Assertion, buffer: TextBuffer) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { isNot } = this as any;
let pass = true;
const invalidLines: Array<{ line: number; content: string }> = [];
@@ -50,7 +51,8 @@ function toHaveOnlyValidCharacters(this: vi.Assertion, buffer: TextBuffer) {
expect.extend({
toHaveOnlyValidCharacters,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any);
// Extend Vitest's `expect` interface with the custom matcher's type definition.
declare module 'vitest' {