Skip to content

Commit 0cd35ac

Browse files
committed
test: use using in tests
1 parent 5ddea95 commit 0cd35ac

File tree

7 files changed

+31
-28
lines changed

7 files changed

+31
-28
lines changed

packages/colorized-brackets/test/dual-themes.test.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ describe('dual themes', async () => {
9292
})
9393

9494
it('light-dark() throws error if light and dark themes are not provided', () => {
95-
expect(() => highlighter.codeToHtml('{}', {
96-
lang,
97-
themes: { light: 'light-plus' },
98-
defaultColor: 'light-dark()',
99-
transformers: [
100-
transformerColorizedBrackets(),
101-
],
102-
})).throws('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes')
95+
expect(
96+
() => highlighter.codeToHtml('{}', {
97+
lang,
98+
themes: { light: 'light-plus' },
99+
defaultColor: 'light-dark()',
100+
transformers: [
101+
transformerColorizedBrackets(),
102+
],
103+
}),
104+
).throws('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes')
103105
})
104106

105107
it('no default', () => {

packages/colorized-brackets/test/explicit-trigger.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('explicitTrigger', async () => {
1616
['foo colorize-brackets bar'],
1717
['colorize-brackets bar'],
1818
]
19+
1920
it.each(validMetaStrings)('should colorize brackets for meta string "%s"', (meta) => {
2021
const code = 'let values: number[] = [1, 2, 3];'
2122
expect(

packages/core/test/alias.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createHighlighter } from 'shiki'
33
import { it } from 'vitest'
44

55
it('langAlias', async () => {
6-
const highlighter = await createHighlighter({
6+
using highlighter = await createHighlighter({
77
langs: ['javascript'],
88
langAlias: {
99
mylang: 'javascript',

packages/core/test/injections.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const count = ref(0)
2828
})
2929

3030
it('injections-side-effects vue', async () => {
31-
const highlighter = await createHighlighterCore({
31+
using highlighter = await createHighlighterCore({
3232
themes: [
3333
vl,
3434
],
@@ -54,7 +54,7 @@ it('injections-side-effects vue', async () => {
5454
})
5555

5656
it('injections-side-effects angular-html', async () => {
57-
const highlighter = await createHighlighterCore({
57+
using highlighter = await createHighlighterCore({
5858
themes: [
5959
vl,
6060
],
@@ -125,7 +125,7 @@ it('injections-side-effects angular-html', async () => {
125125
})
126126

127127
it('injections-side-effects angular-ts', async () => {
128-
const highlighter = await createHighlighterCore({
128+
using highlighter = await createHighlighterCore({
129129
themes: [
130130
vl,
131131
],

packages/rehype/test/core.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { transformerMetaHighlight } from '../../transformers/src'
1313
import rehypeShikiFromHighlighter from '../src/core'
1414

1515
it('run', async () => {
16-
const highlighter = await createHighlighter({
16+
using highlighter = await createHighlighter({
1717
themes: [
1818
'vitesse-light',
1919
],
@@ -39,7 +39,7 @@ it('run', async () => {
3939
})
4040

4141
it('run with lazy', async () => {
42-
const highlighter = await createHighlighter({
42+
using highlighter = await createHighlighter({
4343
themes: [
4444
'vitesse-light',
4545
],
@@ -64,7 +64,7 @@ it('run with lazy', async () => {
6464
})
6565

6666
it('run with rehype-raw', async () => {
67-
const highlighter = await createHighlighter({
67+
using highlighter = await createHighlighter({
6868
themes: [
6969
'vitesse-light',
7070
],
@@ -101,7 +101,7 @@ it('run with rehype-raw', async () => {
101101
})
102102

103103
it('run with lazy + fallback language', async () => {
104-
const highlighter = await createHighlighter({
104+
using highlighter = await createHighlighter({
105105
themes: [
106106
'vitesse-light',
107107
],

packages/shiki/test/astro.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'
33

44
describe('should', async () => {
55
it('astro syntax highlighting', async () => {
6-
const highlighter = await createHighlighter({
6+
using highlighter = await createHighlighter({
77
langs: ['astro'],
88
themes: ['vitesse-dark'],
99
})

packages/transformers/test/notation-diff-rose-pine.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { transformerNotationDiff, transformerNotationFocus, transformerNotationH
44

55
describe('multi-token comment support', () => {
66
it('transformerNotationDiff works with rose-pine theme (multi-token comments)', async () => {
7-
const highlighter = await createHighlighter({
7+
using highlighter = await createHighlighter({
88
themes: ['rose-pine'],
99
langs: ['javascript'],
1010
})
@@ -25,7 +25,7 @@ describe('multi-token comment support', () => {
2525
})
2626

2727
it('transformerNotationDiff still works with dracula theme (single-token comments)', async () => {
28-
const highlighter = await createHighlighter({
28+
using highlighter = await createHighlighter({
2929
themes: ['dracula'],
3030
langs: ['javascript'],
3131
})
@@ -46,7 +46,7 @@ describe('multi-token comment support', () => {
4646
})
4747

4848
it('transformerNotationDiff works with rose-pine theme for add notation', async () => {
49-
const highlighter = await createHighlighter({
49+
using highlighter = await createHighlighter({
5050
themes: ['rose-pine'],
5151
langs: ['javascript'],
5252
})
@@ -65,7 +65,7 @@ describe('multi-token comment support', () => {
6565
})
6666

6767
it('transformerNotationHighlight works with rose-pine theme', async () => {
68-
const highlighter = await createHighlighter({
68+
using highlighter = await createHighlighter({
6969
themes: ['rose-pine'],
7070
langs: ['javascript'],
7171
})
@@ -83,7 +83,7 @@ describe('multi-token comment support', () => {
8383
})
8484

8585
it('transformerNotationFocus works with rose-pine theme', async () => {
86-
const highlighter = await createHighlighter({
86+
using highlighter = await createHighlighter({
8787
themes: ['rose-pine'],
8888
langs: ['javascript'],
8989
})
@@ -101,7 +101,7 @@ describe('multi-token comment support', () => {
101101
})
102102

103103
it('handles multi-line code with mixed single and multi-token comments', async () => {
104-
const highlighter = await createHighlighter({
104+
using highlighter = await createHighlighter({
105105
themes: ['rose-pine'],
106106
langs: ['javascript'],
107107
})
@@ -124,7 +124,7 @@ const c = 3 // [!code highlight]`
124124
})
125125

126126
it('handles edge case where comment does not match pattern', async () => {
127-
const highlighter = await createHighlighter({
127+
using highlighter = await createHighlighter({
128128
themes: ['rose-pine'],
129129
langs: ['javascript'],
130130
})
@@ -145,7 +145,7 @@ const c = 3 // [!code highlight]`
145145
})
146146

147147
it('handles single token without multi-token fallback', async () => {
148-
const highlighter = await createHighlighter({
148+
using highlighter = await createHighlighter({
149149
themes: ['rose-pine'],
150150
langs: ['javascript'],
151151
})
@@ -163,7 +163,7 @@ const c = 3 // [!code highlight]`
163163
})
164164

165165
it('handles JSX parsing without notation', async () => {
166-
const highlighter = await createHighlighter({
166+
using highlighter = await createHighlighter({
167167
themes: ['rose-pine'],
168168
langs: ['jsx'],
169169
})
@@ -181,7 +181,7 @@ const c = 3 // [!code highlight]`
181181
})
182182

183183
it('handles v1 match algorithm', async () => {
184-
const highlighter = await createHighlighter({
184+
using highlighter = await createHighlighter({
185185
themes: ['rose-pine'],
186186
langs: ['javascript'],
187187
})
@@ -200,7 +200,7 @@ const c = 3 // [!code highlight]`
200200
})
201201

202202
it('handles actual multi-token comment scenario from rose-pine theme', async () => {
203-
const highlighter = await createHighlighter({
203+
using highlighter = await createHighlighter({
204204
themes: ['rose-pine'],
205205
langs: ['javascript'],
206206
})

0 commit comments

Comments
 (0)