Skip to content

Commit a97b6f6

Browse files
authored
Update deps (#8)
* Make safe update * Update unsafe deps * Update CI * 5.0.0 * Fix coverage * Add Node 18
1 parent c981e6c commit a97b6f6

5 files changed

Lines changed: 1355 additions & 3793 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
node-version: [18.x, 20.x]
12+
node-version: [18, 20, 22]
1313
# See supported Node.js release schedule at https://nodejs.org/en/about/previous-releases
1414
steps:
1515
- uses: actions/checkout@v4
@@ -22,3 +22,5 @@ jobs:
2222
run: npm run cover
2323
- name: Coveralls
2424
uses: coverallsapp/github-action@v2
25+
with:
26+
file: .coverage/lcov.info

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ module.exports = (options, callback) => {
1616
return cb(null, file);
1717
}
1818
if (file.isStream()) {
19-
this.emit('error', new PluginError('gulp-cleaner-css', 'Streaming not supported!'));
20-
return cb(null, file);
19+
return cb(new PluginError('gulp-cleaner-css', 'Streaming not supported!'));
2120
}
2221

2322
if (file.sourceMap) {

index.spec.js

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -230,23 +230,46 @@ describe('gulp-cleaner-css: base functionality', () => {
230230

231231
it('should invoke a plugin error: streaming not supported', done => {
232232

233-
gulp.src('test/fixtures/test.css', {buffer: false})
234-
.pipe(cleanCSS()
235-
.on('error', err => {
236-
expect(err.message).to.equal('Streaming not supported!');
237-
done();
238-
}));
233+
const src = gulp.src('test/fixtures/test.css', { buffer: false });
234+
const plugin = cleanCSS();
235+
const out = src.pipe(plugin);
236+
237+
const checkErr = err => {
238+
expect(err.message).to.equal('Streaming not supported!');
239+
};
240+
241+
src.once('error', checkErr);
242+
plugin.once('error', checkErr);
243+
244+
out.once('error', (err) => {
245+
checkErr(err);
246+
src.destroy();
247+
plugin.destroy();
248+
done();
249+
});
250+
out.resume();
239251
});
240252

241253
it('should handle malformed CSS', done => {
242-
let i = 0;
243254

244-
gulp.src('test/fixtures/malformed.css')
245-
.pipe(cleanCSS())
246-
.on('error', e => {
247-
expect(e).to.exist;
248-
done();
249-
})
255+
const src = gulp.src('test/fixtures/malformed.css');
256+
const plugin = cleanCSS();
257+
const out = src.pipe(plugin);
258+
259+
const checkErr = err => {
260+
expect(err).to.be.equal('Ignoring local @import of "/some/fake/file" as resource is missing.');
261+
};
262+
263+
src.once('error', checkErr);
264+
plugin.once('error', checkErr);
265+
266+
out.once('error', (err) => {
267+
checkErr(err);
268+
src.destroy();
269+
plugin.destroy();
270+
done();
271+
});
272+
out.resume();
250273
});
251274

252275
it('should not process empty directories or files', done => {

0 commit comments

Comments
 (0)