diff --git a/index.js b/index.js index 0b91163c..694be538 100755 --- a/index.js +++ b/index.js @@ -210,10 +210,6 @@ function resolveImportId(result, stmt, options, state) { return statements ? result.concat(statements) : result }, []) }) - .catch(err => { - if (err.message.indexOf("Failed to find") !== -1) throw err - result.warn(err.message, { node: atRule }) - }) } function loadImportContent(result, stmt, filename, options, state) { diff --git a/test/fixtures/imports/syntax-error.css b/test/fixtures/imports/syntax-error.css new file mode 100644 index 00000000..8751d52d --- /dev/null +++ b/test/fixtures/imports/syntax-error.css @@ -0,0 +1,7 @@ +body { + bar: bar; + qux: qux; + +a { + foo: foo; +} diff --git a/test/fixtures/syntax-error.css b/test/fixtures/syntax-error.css new file mode 100644 index 00000000..c5a8220f --- /dev/null +++ b/test/fixtures/syntax-error.css @@ -0,0 +1,6 @@ +@import "syntax-error.css"; + +syntax.error { + /* Error isn't here, it's in the imported file */ + color: green; +} diff --git a/test/syntax-error.js b/test/syntax-error.js new file mode 100644 index 00000000..72a25cc1 --- /dev/null +++ b/test/syntax-error.js @@ -0,0 +1,16 @@ +// builtin tooling +import fs from "fs" + +// external tooling +import test from "ava" +import postcss from "postcss" + +// plugin +import atImport from ".." + +test("SyntaxError in imported file throws", t => { + return postcss(atImport({ path: "test/fixtures/imports" })) + .process(fs.readFileSync("test/fixtures/syntax-error.css", "utf8")) + .then(() => t.fail("should error out")) + .catch(err => t.truthy(err)) +})