Skip to content

Commit a370485

Browse files
committed
use absolute paths
1 parent 459dd22 commit a370485

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

standalone-cli/tests/test.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const path = require('path')
12
const { execSync } = require('child_process')
23
const os = require('os')
34
const fs = require('fs-extra')
@@ -34,11 +35,16 @@ it('supports first-party plugins', () => {
3435

3536
it('supports postcss config files', async () => {
3637
// We have to run this test outside of any place with node_modules for it to properly test this situation
37-
let result = await inIsolatedContext(() => {
38+
let result = await inIsolatedContext((base) => {
3839
// Emulate the user adding their own postcss plugins
3940
execSync(`npm install postcss-will-change`)
4041

41-
return exec('--content tests/fixtures/basic.html --postcss tests/fixtures/postcss.config.js')
42+
return exec(
43+
`--content ${path.resolve(base, 'tests/fixtures/basic.html')} --postcss ${path.resolve(
44+
base,
45+
'tests/fixtures/postcss.config.js'
46+
)}`
47+
)
4248
})
4349

4450
expect(result).toContain('.uppercase')
@@ -51,7 +57,7 @@ it('supports postcss config files', async () => {
5157
/**
5258
* @template T
5359
* @param {() => T} fn
54-
* @returns {T}
60+
* @returns {Promise<T>}
5561
*/
5662
async function inIsolatedContext(fn) {
5763
// Create a new directory entirely outside of the package for the test
@@ -73,7 +79,7 @@ async function inIsolatedContext(fn) {
7379
process.chdir(dest)
7480

7581
try {
76-
return await fn()
82+
return await fn(dest)
7783
} finally {
7884
// Change back to the original working directory
7985
process.chdir(__dirname)

0 commit comments

Comments
 (0)