|
| 1 | +import process from 'node:process' |
1 | 2 | import fs from 'fs-extra' |
2 | 3 | import { resolve } from 'pathe' |
3 | 4 | import { afterAll, beforeAll, describe, expect, it } from 'vitest' |
@@ -38,6 +39,17 @@ describe('cli', () => { |
38 | 39 | expect(output).toMatchSnapshot() |
39 | 40 | }) |
40 | 41 |
|
| 42 | + it('use default preset via cli option', async () => { |
| 43 | + const { output } = await runCli({ |
| 44 | + 'views/index.html': `<div class="bg-blue"></div>`, |
| 45 | + 'views/index.css': `.btn { @apply p-2 bg-red; }`, |
| 46 | + }, { |
| 47 | + args: ['--preset', 'wind4'], |
| 48 | + }) |
| 49 | + |
| 50 | + expect(output).toMatchSnapshot() |
| 51 | + }) |
| 52 | + |
41 | 53 | it('supports unocss.config.js', async () => { |
42 | 54 | const { output } = await runCli({ |
43 | 55 | 'views/index.html': '<div class="box"></div>', |
@@ -86,7 +98,7 @@ describe('cli', () => { |
86 | 98 | expect(transform).toMatchSnapshot() |
87 | 99 | }) |
88 | 100 |
|
89 | | - it('uno.css exclude initialized class after changing file', async () => { |
| 101 | + it.skipIf(process.version.startsWith('v20'))('uno.css exclude initialized class after changing file', async () => { |
90 | 102 | const { output, testDir } = await runCli({ |
91 | 103 | 'views/index.html': '<div class="bg-blue"></div>', |
92 | 104 | }, { args: ['--preset', 'wind3', '-w'] }) |
@@ -161,7 +173,7 @@ describe('cli', () => { |
161 | 173 | expect(output2).toContain('.bg-red') |
162 | 174 | }) |
163 | 175 |
|
164 | | - it('supports uno.config.ts changed rebuild', async () => { |
| 176 | + it.skipIf(process.version.startsWith('v20'))('supports uno.config.ts changed rebuild', async () => { |
165 | 177 | const { output, testDir } = await runCli({ |
166 | 178 | 'views/index.html': '<div class="bg-foo"></div>', |
167 | 179 | 'uno.config.ts': ` |
@@ -240,17 +252,4 @@ describe('cli', () => { |
240 | 252 | expect(output).not.toContain('.bg-red') |
241 | 253 | expect(output).not.toContain('.text-white') |
242 | 254 | }) |
243 | | - |
244 | | - it('use default preset via cli option', async () => { |
245 | | - const { output } = await runCli({ |
246 | | - 'views/index.html': `<div class="bg-blue"></div>`, |
247 | | - 'views/index.css': `.btn { @apply p-2 bg-red; }`, |
248 | | - }, { |
249 | | - args: ['--preset', 'wind4'], |
250 | | - }) |
251 | | - |
252 | | - await sleep(1000) |
253 | | - |
254 | | - expect(output).toMatchSnapshot() |
255 | | - }) |
256 | 255 | }) |
0 commit comments