Skip to content

Commit 3352a37

Browse files
authored
BREAKING: File not found is an Error, not a Warning (#247)
1 parent 0cf36ec commit 3352a37

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ function resolveImportId(
261261
}, [])
262262
})
263263
.catch(function(err) {
264+
if (err.message.indexOf("Failed to find") !== -1) throw err
264265
result.warn(err.message, { node: atRule })
265266
})
266267
}

test/import.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,14 @@ test("should not fail with absolute and local import", t => {
4747
})
4848
})
4949

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

0 commit comments

Comments
 (0)