Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Nov 5, 2023
1 parent e0a8295 commit 68b3c88
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/extractor/tests/watch/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ beforeAll(() => {
fs.writeFileSync(configFilepath, originConfigText)

child = spawnd('tsx ../../../css/src/bin extract -w', { shell: true, cwd: __dirname })
}, 30000)
}, 45000)

it('start watch process', async () => {
await waitForDataMatch(child, (data) => data.includes('Start watching source changes'))
Expand All @@ -73,23 +73,23 @@ it('start watch process', async () => {
expect(fileCSSText).toContain(cssEscape('font:48'))
expect(fileCSSText).toContain(cssEscape('bg:primary'))
expect(fileCSSText).toContain(cssEscape('btn'))
}, 30000)
}, 45000)

it('change options file `fixed` and reset process', async () => {
await waitForDataMatch(child, (data) => data.includes('Restart watching source changes'), async () => {
fs.writeFileSync(optionsFilepath, originOptionsText.replace('fixed: []', 'fixed: [\'fg:red\']'))
})
const fileCSSText = fs.readFileSync(virtualCSSFilepath, { encoding: 'utf8' })
expect(fileCSSText).toContain(cssEscape('fg:red'))
}, 30000)
}, 45000)

it('change config file `styles` and reset process', async () => {
await waitForDataMatch(child, (data) => data.includes('Restart watching source changes'), async () => {
fs.writeFileSync(configFilepath, originConfigText.replace('bg:red', 'bg:blue'))
})
const fileCSSText = fs.readFileSync(virtualCSSFilepath, { encoding: 'utf8' })
expect(fileCSSText).toContain(cssEscape('bg:blue'))
}, 30000)
}, 45000)

it('change html file class attr and update', async () => {
await waitForDataMatch(child, (data) => data.includes('exported'), async () => {
Expand All @@ -98,8 +98,8 @@ it('change html file class attr and update', async () => {
const fileCSSText = fs.readFileSync(virtualCSSFilepath, { encoding: 'utf8' })
/** There is no recycling mechanism during the development */
expect(fileCSSText).toContain(cssEscape('text:underline'))
}, 30000)
}, 45000)

afterAll(async () => {
await child.destroy()
}, 30000)
}, 45000)

0 comments on commit 68b3c88

Please sign in to comment.