Skip to content

Commit e80cc22

Browse files
alan-agius4dherges
authored andcommitted
fix: no elements in sequence error (#1029)
Sometimes this error is appearing `EmptyError: no elements in sequence`, add `defaultIfEmpty` so that it can complete
1 parent 3ba995e commit e80cc22

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

integration/watch/basic.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ describe('basic', () => {
5353
expect(error.message).to.match(/is not assignable to type 'boolean'/);
5454
});
5555
});
56+
57+
it('should emit complete when a file changes outside of the compilation', done => {
58+
harness.copyTestCase('new-file');
59+
60+
harness.onComplete(() => {
61+
done();
62+
});
63+
});
5664
});
5765
});
5866

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export interface Foo {}

src/lib/ng-v5/package.transform.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
startWith,
1111
debounceTime,
1212
filter,
13-
last
13+
takeLast,
14+
defaultIfEmpty
1415
} from 'rxjs/operators';
1516
import { BuildGraph } from '../brocc/build-graph';
1617
import { DepthBuilder } from '../brocc/depth';
@@ -224,7 +225,8 @@ const scheduleEntryPoints = (epTransform: Transform): Transform =>
224225
epTransform
225226
)
226227
),
227-
last()
228+
takeLast(1), // don't use last as sometimes it this will cause 'no elements in sequence',
229+
defaultIfEmpty(graph)
228230
);
229231
})
230232
);

0 commit comments

Comments
 (0)