Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit bbe09f7

Browse files
committed
Test #2479: Watcher should stay up even if files are broken
1 parent 8d0acca commit bbe09f7

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
h1 { }

test/watcher.js

+46
Original file line numberDiff line numberDiff line change
@@ -499,5 +499,51 @@ describe('watcher', function() {
499499
});
500500
});
501501
});
502+
describe('with syntax errors', function() {
503+
it('should produce a one-file graph', function() {
504+
fs.copySync(
505+
path.join(origin, 'crash', 'broken.scss'),
506+
path.join(main, 'one.scss')
507+
);
508+
var files = watcher.reset({
509+
src: path.join(main, 'one.scss'),
510+
includePath: [main]
511+
});
512+
assert.deepEqual(files.sort(), [
513+
path.join(main, 'one.scss'),
514+
].sort());
515+
fs.copySync(
516+
path.join(origin, 'main', 'one.scss'),
517+
path.join(main, 'one.scss')
518+
);
519+
files = watcher.changed(
520+
path.join(main, 'one.scss')
521+
);
522+
assert.deepEqual(files.changed.sort(), [
523+
path.join(main, 'one.scss'),
524+
]);
525+
});
526+
it('should keep the graph even if a file gets broken', function() {
527+
var files = watcher.reset({
528+
src: path.join(main, 'one.scss'),
529+
includePath: [main]
530+
});
531+
assert.deepEqual(files.sort(), [
532+
path.join(main, 'one.scss'),
533+
path.join(main, 'partials', '_one.scss'),
534+
path.join(main, 'partials', '_three.scss'),
535+
].sort());
536+
fs.copySync(
537+
path.join(origin, 'crash', 'broken.scss'),
538+
path.join(main, 'one.scss')
539+
);
540+
files = watcher.changed(
541+
path.join(main, 'one.scss')
542+
);
543+
assert.deepEqual(files.changed.sort(), [
544+
path.join(main, 'one.scss'),
545+
]);
546+
});
547+
});
502548
});
503549
});

0 commit comments

Comments
 (0)