Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ function resolveImportId(
}, [])
})
.catch(function(err) {
if (err.message.indexOf("Failed to find") !== -1) throw err
result.warn(err.message, { node: atRule })
})
}
Expand Down
12 changes: 4 additions & 8 deletions test/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ test("should not fail with absolute and local import", t => {
})
})

test("should output readable trace", t => {
test("should error when file not found", t => {
t.plan(1)
var file = "fixtures/imports/import-missing.css"
return postcss()
.use(atImport())
.process(readFileSync(file), { from: file })
.then(result => {
t.is(
result.warnings()[0].text,
/* eslint-disable max-len */
"Failed to find 'missing-file.css'\n in [ \n " + path.resolve("fixtures/imports") + "\n ]"
/* eslint-enabme max-len */
)
.catch(err => {
t.truthy(err)
})
})

Expand Down