Skip to content

Commit

Permalink
add test & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Jan 17, 2024
1 parent 7f1725b commit 5e48352
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -178,6 +178,7 @@ function rc(ctx, path, cliConfigPath) {
return rc
})
.catch((err) => {
// if a config path is passed explicitly in CLI do not ignore the error
if (!err.message.includes('No PostCSS Config found') || cliConfigPath) throw err
})
}
Expand Down
17 changes: 17 additions & 0 deletions test/cli.js
Expand Up @@ -18,3 +18,20 @@ test('works with defaults', async (t) => {

t.is(await read(output), await read('test/fixtures/a.css'))
})

test('fails on invalid explicit config', async (t) => {
const output = tmp('output-ignore.css')

const { error, stderr } = await cli([

Check failure on line 25 in test/cli.js

View workflow job for this annotation

GitHub Actions / test (18, ubuntu-latest)

'error' is assigned a value but never used

Check failure on line 25 in test/cli.js

View workflow job for this annotation

GitHub Actions / test (20, ubuntu-latest)

'error' is assigned a value but never used
'test/fixtures/a.css',
'-o',
output,
'--config',
'/foo/bar',
])

t.regex(
stderr,
/No PostCSS Config found/,
)
})

0 comments on commit 5e48352

Please sign in to comment.