mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 13:51:31 +01:00
Add a missing _ignoreErrors() call in StylesheetGraph (#377)
We weren't ignoring errors when reloading a file, which meant that syntax errors would get surfaced in the wrong place and cause a crash. Closes #359
This commit is contained in:
parent
e95d57ce25
commit
39eeeb51ef
@ -9,6 +9,10 @@
|
||||
* Fix a bug where `@-moz-document` functions with string arguments weren't being
|
||||
parsed.
|
||||
|
||||
### Command-Line Interface
|
||||
|
||||
* Don't crash when a syntax error is added to a watched file.
|
||||
|
||||
## 1.7.1
|
||||
|
||||
* Fix crashes in released binaries.
|
||||
|
@ -122,7 +122,8 @@ class StylesheetGraph {
|
||||
_transitiveModificationTimes.clear();
|
||||
|
||||
importCache.clearImport(canonicalUrl);
|
||||
var stylesheet = importCache.importCanonical(node.importer, canonicalUrl);
|
||||
var stylesheet = _ignoreErrors(
|
||||
() => importCache.importCanonical(node.importer, canonicalUrl));
|
||||
if (stylesheet == null) {
|
||||
remove(canonicalUrl);
|
||||
return null;
|
||||
|
@ -118,6 +118,21 @@ void sharedTests(Future<TestProcess> runSass(Iterable<String> arguments)) {
|
||||
.validate();
|
||||
});
|
||||
|
||||
test("when it gets a parse error", () async {
|
||||
await d.file("test.scss", "a {b: c}").create();
|
||||
|
||||
var sass = await watch(["test.scss:out.css"]);
|
||||
await expectLater(sass.stdout, emits('Compiled test.scss to out.css.'));
|
||||
await expectLater(sass.stdout, _watchingForChanges);
|
||||
|
||||
await d.file("test.scss", "a {b: }").create();
|
||||
await expectLater(sass.stderr, emits('Error: Expected expression.'));
|
||||
await expectLater(sass.stderr, emitsThrough(contains('test.scss 1:7')));
|
||||
await sass.kill();
|
||||
|
||||
await d.nothing("out.css").validate();
|
||||
});
|
||||
|
||||
group("when its dependency is deleted", () {
|
||||
test("and removes the output", () async {
|
||||
await d.file("_other.scss", "a {b: c}").create();
|
||||
|
Loading…
x
Reference in New Issue
Block a user