Skip to content

Commit bd0d8bc

Browse files
committed
Ignore blank lines when comparing test results
1 parent 11e3783 commit bd0d8bc

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

tests/dynamic-tests.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ function createApplication(logOutput: string[]) {
4040
return app;
4141
}
4242

43+
function removeBlankLines(input: string) {
44+
return input.replace(/^$\r?\n/gm, '');
45+
}
46+
4347
describe('Dynamic test suite', () => {
4448
test.each(folders)('should execute test: %s', (testFile) => {
4549
const logOutput: string[] = [];
@@ -96,7 +100,7 @@ describe('Dynamic test suite', () => {
96100
if (writeOutput) {
97101
fs.writeFileSync(outputDeclarationFile, result);
98102
}
99-
expect(result).toBe(expectedOutput.trim());
103+
expect(removeBlankLines(result)).toBe(removeBlankLines(expectedOutput.trim()));
100104
} else {
101105
console.log(logOutput.join('\n'));
102106
expect(logOutput).toEqual([]);
Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
declare module Unmapped {
22
class NotHidden {
33
hidden: unknown;
4-
54
notHidden: NotHidden;
6-
75
newClass: unknown;
8-
96
doStuff1<T extends NotHidden | OtherClass>(param: T): void;
10-
117
doStuff2<T extends unknown & NotHidden & OtherClass>(param: T): void;
128
}
139

@@ -16,48 +12,29 @@ declare module Unmapped {
1612
}
1713

1814
type Union1 = NotHidden;
19-
2015
type Intersection1 = unknown & NotHidden;
2116

2217
type Union2 = NotHidden | string;
23-
2418
type Intersection2 = unknown & NotHidden & object;
2519

2620
type IndexedAccess = unknown;
2721

2822
function doSomething1(): unknown;
29-
3023
function doSomething2(): unknown | undefined;
31-
3224
function doSomething3(param: unknown): void;
33-
3425
function doSomething4(param?: unknown): void;
35-
3626
function doSomething5(param: unknown | undefined): void;
37-
3827
function doSomething6(): unknown[];
39-
4028
function doSomething7(): Array<unknown>;
41-
4229
function doSomething8(): Array<NotHidden>;
43-
4430
function doSomething9(): Array<unknown | undefined>;
45-
4631
function doSomething10(): Array<unknown | null>;
47-
4832
function doSomething11(): Array<unknown & NotHidden>;
49-
5033
function doSomething12<T extends unknown>(): void;
51-
5234
function doSomething13<T extends unknown>(): void;
53-
5435
function doSomething14<T>(param: T): T extends unknown ? true : false;
55-
5636
function doSomething15(param: any): param is unknown;
57-
5837
function doSomething16(param: { [key: string]: unknown }): void;
59-
6038
function doSomething17(): [unknown | undefined, unknown];
61-
6239
function doSomething18(param: {}): [unknown | undefined, unknown];
6340
}

0 commit comments

Comments
 (0)