Skip to content

Commit

Permalink
BREAKING: File not found is an Error, not a Warning (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanZim committed Nov 17, 2016
1 parent 0cf36ec commit 3352a37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
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

0 comments on commit 3352a37

Please sign in to comment.