Skip to content

Commit 3469ee0

Browse files
committed
test: fix test for semanticDiagnosticsSync
1 parent 3ae9a78 commit 3469ee0

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test('Semantic Diagnostics', async () => {
88
const iff = await createIFF({
99
'index.ts': dedent`
1010
import styles from './a.module.css';
11-
type Expected = { a_1: string, a_2: string, b_1: string, c_1: string, c_alias: string };
11+
type Expected = { a_1: string, a_2: string, b_1: string, c_1: string, c_alias: string, c_3: string };
1212
const t1: Expected = styles;
1313
const t2: typeof styles = t1;
1414
styles.unknown;
@@ -18,7 +18,6 @@ test('Semantic Diagnostics', async () => {
1818
@value c_1, c_2 as c_alias, c_3 from './c.module.css';
1919
.a_1 { color: red; }
2020
@value a_2: red;
21-
@import './d.module.css';
2221
.a-3 { color: red; }
2322
`,
2423
'b.module.css': dedent`
@@ -43,8 +42,23 @@ test('Semantic Diagnostics', async () => {
4342
const res1 = await tsserver.sendSemanticDiagnosticsSync({
4443
file: iff.paths['index.ts'],
4544
});
46-
// TODO: Report type errors
47-
expect(res1.body).toMatchInlineSnapshot(`[]`);
45+
expect(res1.body).toMatchInlineSnapshot(`
46+
[
47+
{
48+
"category": "error",
49+
"code": 2339,
50+
"end": {
51+
"line": 5,
52+
"offset": 15,
53+
},
54+
"start": {
55+
"line": 5,
56+
"offset": 8,
57+
},
58+
"text": "Property 'unknown' does not exist on type '{ c_1: string; c_alias: string; c_3: any; b_1: string; a_1: string; a_2: string; }'.",
59+
},
60+
]
61+
`);
4862

4963
const res2 = await tsserver.sendSemanticDiagnosticsSync({
5064
file: iff.paths['a.module.css'],
@@ -55,12 +69,12 @@ test('Semantic Diagnostics', async () => {
5569
"category": "error",
5670
"code": 0,
5771
"end": {
58-
"line": 6,
72+
"line": 5,
5973
"offset": 5,
6074
},
6175
"source": "css-modules-kit",
6276
"start": {
63-
"line": 6,
77+
"line": 5,
6478
"offset": 2,
6579
},
6680
"text": "css-modules-kit does not support invalid names as JavaScript identifiers.",
@@ -79,20 +93,6 @@ test('Semantic Diagnostics', async () => {
7993
},
8094
"text": "Module './c.module.css' has no exported token 'c_3'.",
8195
},
82-
{
83-
"category": "error",
84-
"code": 0,
85-
"end": {
86-
"line": 5,
87-
"offset": 24,
88-
},
89-
"source": "css-modules-kit",
90-
"start": {
91-
"line": 5,
92-
"offset": 10,
93-
},
94-
"text": "Cannot import module './d.module.css'",
95-
},
9696
]
9797
`);
9898
});

0 commit comments

Comments
 (0)