diff --git a/test/autocomplete.test.ts b/test/autocomplete.test.ts index a8b2b21..3171a45 100644 --- a/test/autocomplete.test.ts +++ b/test/autocomplete.test.ts @@ -4,10 +4,10 @@ import { describe, expect, it } from 'vitest' import presetWeapp from '../src/index' import { extractorAttributify } from '../src/transformer' -describe('autocomplete', () => { +describe('autocomplete', async () => { const { presetWeappAttributify } = extractorAttributify() - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), presetWeappAttributify(), @@ -120,7 +120,7 @@ describe('autocomplete', () => { }) it('should not suggest blocked rules', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -167,10 +167,10 @@ describe('autocomplete', () => { it('should support extractors', async () => { const res = await ac.suggestInFile(fixture, 40) - expect(res.suggestions.every(i => i[0].startsWith('border-'))).toBeTruthy() - expect(res.suggestions.some(i => i[1].startsWith('border-'))).toBeFalsy() + expect(res?.suggestions.every(i => i[0].startsWith('border-'))).toBeTruthy() + expect(res?.suggestions.some(i => i[1].startsWith('border-'))).toBeFalsy() - const replacement = res.resolveReplacement(res.suggestions[0][0]) + const replacement = res?.resolveReplacement(res?.suggestions[0][0]) expect(replacement).toMatchInlineSnapshot(` { "end": 40, @@ -179,7 +179,7 @@ describe('autocomplete', () => { } `) - expect(fixture.slice(0, replacement.start) + replacement.replacement + fixture.slice(replacement.end)) + expect(fixture.slice(0, replacement?.start) + replacement?.replacement + fixture.slice(replacement?.end)) .toMatchInlineSnapshot(` "
@@ -215,8 +215,8 @@ describe('autocomplete', () => { }) }) -describe('use uno cache', () => { - const uno = createGenerator({ +describe('use uno cache', async () => { + const uno = await createGenerator({ presets: [ presetWeapp(), ], diff --git a/test/color.test.ts b/test/color.test.ts index 663324b..9bad633 100644 --- a/test/color.test.ts +++ b/test/color.test.ts @@ -1,5 +1,5 @@ import type { RuleContext } from '@unocss/core' -import { createGenerator } from '@unocss/core' +import { createGenerator, symbols } from '@unocss/core' import { colorToString, hex2rgba, parseCssColor } from '@unocss/rule-utils' import { describe, expect, it } from 'vitest' import { colorableShadows, colorResolver } from '../src/utils' @@ -137,7 +137,7 @@ describe('color utils', () => { // invalid }) - it('parses color token', () => { + it('parses color token', async () => { const context: RuleContext = { theme: { colors: { @@ -148,10 +148,11 @@ describe('color utils', () => { }, rawSelector: '', currentSelector: '', - generator: createGenerator(), + generator: await createGenerator(), variantHandlers: [], variantMatch: ['', '', [], new Set()], constructCSS: () => '', + symbols, } const fn = (body: string) => colorResolver('prop', 'v')(['', body], context) diff --git a/test/debug.test.ts b/test/debug.test.ts index 506ce35..0dc7c30 100644 --- a/test/debug.test.ts +++ b/test/debug.test.ts @@ -3,7 +3,7 @@ import { expect, it } from 'vitest' import presetWeapp from '../src/index' it('debug', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], diff --git a/test/parser.test.ts b/test/parser.test.ts index f21dc38..430824f 100644 --- a/test/parser.test.ts +++ b/test/parser.test.ts @@ -3,7 +3,7 @@ import { expect, it } from 'vitest' import presetWeapp from '../src/index' it('split string with custom separator', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -22,7 +22,7 @@ it('split string with custom separator', async () => { }) it('unable to generate token variant with explicit separator without dash', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], diff --git a/test/preflights.test.ts b/test/preflights.test.ts index 7209543..38a13df 100644 --- a/test/preflights.test.ts +++ b/test/preflights.test.ts @@ -4,7 +4,7 @@ import presetWeapp from '../src' describe('preflights', () => { it('original preflight', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -14,7 +14,7 @@ describe('preflights', () => { }) it('preflight root can be customized with string', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -27,7 +27,7 @@ describe('preflights', () => { }) it('preflight root can be customized with array', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -40,7 +40,7 @@ describe('preflights', () => { }) it('preflight root can be disabled using empty array', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], diff --git a/test/preset-mini.test.ts b/test/preset-mini.test.ts index 0520c22..21d69ed 100644 --- a/test/preset-mini.test.ts +++ b/test/preset-mini.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest' import presetWeapp from '../src/index' import { presetMiniNonTargets, presetMiniTargets, targets2 } from './assets/preset-mini-targets' -const uno = createGenerator({ +const uno = await createGenerator({ presets: [ presetWeapp({ dark: 'media', @@ -40,7 +40,7 @@ const uno = createGenerator({ describe('preset-mini', () => { it('dark customizing selector', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp({ dark: { @@ -91,7 +91,7 @@ describe('preset-mini', () => { }) it('custom var prefix', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp({ variablePrefix: 'hi-', @@ -109,7 +109,7 @@ describe('preset-mini', () => { }) it('empty prefix', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp({ variablePrefix: '', @@ -157,7 +157,7 @@ describe('preset-mini', () => { }) it('fontSize theme', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -184,7 +184,7 @@ describe('preset-mini', () => { }) it('fontWeight theme', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -207,7 +207,7 @@ describe('preset-mini', () => { }) it('dark class', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -224,7 +224,7 @@ describe('preset-mini', () => { }) it('the :active pseudo is sorted and separated after other pseudo', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -242,7 +242,7 @@ describe('preset-mini', () => { }) it('css variable with `{` `}` will not generate css ', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -259,7 +259,7 @@ describe('preset-mini', () => { }) it('define breakpoints with other unit', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -297,7 +297,7 @@ describe('preset-mini', () => { }) it('theme for zIndex', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -315,7 +315,7 @@ describe('preset-mini', () => { }) it('theme font-size with letter-space', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -343,7 +343,7 @@ describe('preset-mini', () => { }) it('override colors differently', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -370,7 +370,7 @@ describe('preset-mini', () => { }) it('account custom color for shadow theme', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -401,7 +401,7 @@ describe('preset-mini', () => { }) it('support new color notation using css variables for compatibility', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -440,7 +440,7 @@ describe('preset-mini', () => { }) it('`containers` key of theme', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp(), ], diff --git a/test/preset-weapp.test.ts b/test/preset-weapp.test.ts index 9c0090f..830a15d 100644 --- a/test/preset-weapp.test.ts +++ b/test/preset-weapp.test.ts @@ -5,7 +5,7 @@ import { defaultRules } from '../src/transformer' import { presetMiniTargets, targets2 } from './assets/preset-mini-targets' import { presetWeappTargets } from './assets/preset-weapp-targets' -const uno = createGenerator({ +const uno = await createGenerator({ presets: [ presetWeapp(), ], @@ -36,7 +36,7 @@ describe('preset-weapp', () => { }) it('rules targets', async () => { - const uno = createGenerator({ + const uno = await createGenerator({ presets: [ presetWeapp({ transformRules: { diff --git a/test/rpx.test.ts b/test/rpx.test.ts index fb40d49..795c652 100644 --- a/test/rpx.test.ts +++ b/test/rpx.test.ts @@ -2,7 +2,7 @@ import { createGenerator } from '@unocss/core' import { describe, expect, it } from 'vitest' import presetWeapp from '../src' -const taroH5_750_W4 = createGenerator({ +const taroH5_750_W4 = await createGenerator({ presets: [ presetWeapp({ isH5: true, @@ -11,7 +11,7 @@ const taroH5_750_W4 = createGenerator({ ], }) -const taroWe_750_W4 = createGenerator({ +const taroWe_750_W4 = await createGenerator({ presets: [ presetWeapp({ isH5: false, @@ -20,7 +20,7 @@ const taroWe_750_W4 = createGenerator({ ], }) -const taroH5_375_W4 = createGenerator({ +const taroH5_375_W4 = await createGenerator({ presets: [ presetWeapp({ isH5: true, @@ -33,7 +33,7 @@ const taroH5_375_W4 = createGenerator({ ], }) -const taroWe_750_W5 = createGenerator({ +const taroWe_750_W5 = await createGenerator({ presets: [ presetWeapp({ isH5: false, @@ -43,7 +43,7 @@ const taroWe_750_W5 = createGenerator({ ], }) -const taroH5_375_W5 = createGenerator({ +const taroH5_375_W5 = await createGenerator({ presets: [ presetWeapp({ isH5: true, @@ -57,7 +57,7 @@ const taroH5_375_W5 = createGenerator({ ], }) -const taroWe_375_W4 = createGenerator({ +const taroWe_375_W4 = await createGenerator({ presets: [ presetWeapp({ isH5: false, @@ -70,7 +70,7 @@ const taroWe_375_W4 = createGenerator({ ], }) -const uniapp_750 = createGenerator({ +const uniapp_750 = await createGenerator({ presets: [ presetWeapp({ isH5: true, diff --git a/test/wh-rpx.test.ts b/test/wh-rpx.test.ts index dacbe97..0e54da8 100644 --- a/test/wh-rpx.test.ts +++ b/test/wh-rpx.test.ts @@ -2,7 +2,7 @@ import { createGenerator } from '@unocss/core' import { describe, expect, it } from 'vitest' import { presetWeapp } from '../src' -const whRemToRpx = createGenerator({ +const whRemToRpx = await createGenerator({ presets: [ presetWeapp({ whRpx: false, @@ -10,7 +10,7 @@ const whRemToRpx = createGenerator({ ], }) -const whRpx = createGenerator({ +const whRpx = await createGenerator({ presets: [ presetWeapp(), ],