Skip to content

Commit 0ee3f3b

Browse files
zhiyuanzmjantfu
andauthored
feat(twoslash-vue): upgrade @vue/language-core to 2.2.4 (#65)
Co-authored-by: Anthony Fu <github@antfu.me>
1 parent 80d956e commit 0ee3f3b

File tree

6 files changed

+150
-130
lines changed

6 files changed

+150
-130
lines changed

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default defineConfig({
4747
await shiki.loadTheme(...Object.keys(bundledThemes) as any)
4848
},
4949
codeTransformers: [
50-
transformerTwoslash(),
50+
transformerTwoslash() as any,
5151
transformerTwoslash({
5252
errorRendering: 'hover',
5353
twoslasher: createTwoslasherESLint({

packages/twoslash-vue/test/query.test.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { describe, expect, it } from 'vitest'
22
import { createTwoslasher } from '../src/index'
33

4+
const isWindows = process.platform === 'win32'
5+
46
const code = await import('./fixtures/query-basic.vue?raw').then(m => m.default)
57

68
const twoslasher = createTwoslasher()
@@ -16,18 +18,25 @@ describe('basic', () => {
1618
})
1719

1820
it('has correct query', () => {
19-
expect(result.meta.positionQueries)
20-
.toMatchInlineSnapshot(`
21-
[
22-
93,
23-
161,
24-
863,
25-
1034,
26-
]
27-
`)
28-
2921
expect(result.nodes.find(n => n.type === 'query' && n.target === 'double'))
3022
.toHaveProperty('text', 'const double: ComputedRef<number>')
23+
expect(result.nodes.filter(n => n.type === 'query'))
24+
.toHaveLength(4)
25+
26+
// Windows have different paths, result in different positions
27+
// We skip the following position tests on Windows
28+
if (isWindows)
29+
return
30+
31+
expect(result.meta.positionQueries)
32+
.toMatchInlineSnapshot(`
33+
[
34+
93,
35+
161,
36+
863,
37+
1034,
38+
]
39+
`)
3140

3241
expect(result.nodes.find(n => n.type === 'query' && n.target === 'computed'))
3342
.toMatchInlineSnapshot(`
@@ -77,7 +86,5 @@ describe('basic', () => {
7786
"type": "query",
7887
}
7988
`)
80-
expect(result.nodes.filter(n => n.type === 'query'))
81-
.toHaveLength(4)
8289
})
8390
})

packages/twoslash-vue/test/shiki.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { createHighlighter } from 'shiki'
33
import { expect, it } from 'vitest'
44
import { createTwoslasher } from '../src'
55

6+
const isWindows = process.platform === 'win32'
7+
68
const code = await import('./fixtures/example.vue?raw').then(m => m.default)
79

810
const styleHeader = [
@@ -48,7 +50,7 @@ const twoslasherRaw = createTwoslasher({
4850
debugShowGeneratedCode: true,
4951
})
5052

51-
it('highlight raw', async () => {
53+
it.skipIf(isWindows)('highlight raw', async () => {
5254
const result = await shiki.codeToHtml(code, {
5355
lang: 'vue',
5456
theme: 'vitesse-dark',

0 commit comments

Comments
 (0)