Skip to content

Commit

Permalink
restructure test a little bit
Browse files Browse the repository at this point in the history
Instead of relying on a arbitrary setTimout value, let's wait for the
file to be created instead.
  • Loading branch information
RobinMalfait committed Jun 10, 2022
1 parent 4f2fe1c commit b8d05ef
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions integrations/tailwindcss-cli/tests/cli.test.js
Expand Up @@ -5,7 +5,14 @@ let resolveToolRoot = require('../../resolve-tool-root')

let version = require('../../../package.json').version

let { readOutputFile, writeInputFile, cleanupFile, fileExists, removeFile } = require('../../io')({
let {
cleanupFile,
fileExists,
readOutputFile,
removeFile,
waitForOutputFileCreation,
writeInputFile,
} = require('../../io')({
output: 'dist',
input: 'src',
})
Expand Down Expand Up @@ -388,11 +395,11 @@ describe('Build command', () => {
`
)

let proc = $(
let runningProcess = $(
`${EXECUTABLE} --watch --input ./src/test.css --content ./src/index.html --output ./dist/main.css`
)
await new Promise((r) => setTimeout(r, 500))
await proc.stop()

await waitForOutputFileCreation('main.css')

expect(await readOutputFile('main.css')).toIncludeCss(
css`
Expand All @@ -403,6 +410,8 @@ describe('Build command', () => {
}
`
)

return runningProcess.stop()
})

test('postcss-import is included when using a custom postcss configuration', async () => {
Expand Down

0 comments on commit b8d05ef

Please sign in to comment.