Skip to content

Commit cd86efe

Browse files
authored
test: split syntaxes tests into individual specs with names (#519)
Names each syntaxes test case and runs each case in an individual spec rather than having all cases run as one spec. Provides more meaningful output on failures.
1 parent c679676 commit cd86efe

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

syntaxes/test/cases.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
[
22
{
3+
"name": "inline template",
34
"scopeName": "inline-template.ng",
45
"grammarFiles": ["syntaxes/inline-template.json", "syntaxes/template.json"],
56
"testFile": "syntaxes/test/data/inline-template.ts"
67
},
78
{
9+
"name": "inline styles",
810
"scopeName": "inline-styles.ng",
911
"grammarFiles": ["syntaxes/inline-styles.json"],
1012
"testFile": "syntaxes/test/data/inline-styles.ts"
1113
},
1214
{
15+
"name": "template syntax",
1316
"scopeName": "template.ng",
1417
"grammarFiles": ["syntaxes/template.json"],
1518
"testFile": "syntaxes/test/data/template.html"

syntaxes/test/driver.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as util from 'util';
1414
import * as SNAPSHOT_TEST_CASES from './cases.json';
1515

1616
interface TestCase {
17+
name: string;
1718
scopeName: string;
1819
grammarFiles: string[];
1920
testFile: string;
@@ -48,10 +49,10 @@ async function snapshotTest({scopeName, grammarFiles, testFile}: TestCase): Prom
4849
}
4950

5051
describe('snapshot tests', async () => {
51-
it('should pass all cases', async () => {
52-
for (let tc of SNAPSHOT_TEST_CASES) {
52+
for (let tc of SNAPSHOT_TEST_CASES) {
53+
it(`should work for ${tc.name}`, async () => {
5354
const ec = await snapshotTest(tc);
5455
expect(ec).toBe(0);
55-
}
56-
});
56+
});
57+
}
5758
});

0 commit comments

Comments
 (0)