Skip to content

Commit

Permalink
fix tests again
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Nov 22, 2024
1 parent 6fe2ff5 commit da8ba14
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/basics/test/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ describe('test', () => {
res.push(chunk);
})
.on('end', () => {
console.log(res);
assert.equal(3, res.length);
assert.equal('"a";"b";"c"\r\n', res[0]);
assert.equal('"1";"2";"3"\r\n', res[1]);
Expand Down
4 changes: 4 additions & 0 deletions packages/basics/test/url-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ httpbin
.post('/status/400')
.reply(400);

httpbin
.get('/status/400')
.reply(400);

httpbin
.post('/status/503')
.reply(503);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ ezs.createPipeline = (input, commands, trap) => {
}
return output
.pipe(ezs.catch((e) => {
trap.write(e.toJSON()); // see engine.js createErrorWith
trap.write(JSON.parse(ezs.serializeError(e))); // see engine.js createErrorWith
return false; // do not catch the error
}))
.once('error', (e) => {
trap.write(e.toJSON()); // see engine.js createErrorWith
trap.write(JSON.parse(ezs.serializeError(e))); // see engine.js createErrorWith
trap.end();
})
.once('end', () => {
Expand Down
8 changes: 7 additions & 1 deletion packages/core/test/expand.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs';
import debug from 'debug';
import from from 'from';
import { PassThrough } from 'stream';
import ezs from '../src';
Expand Down Expand Up @@ -513,7 +514,12 @@ test('with a buggy script', (done) => {
output.push(chunk);
})
.on('error', (e) => {
expect(e.message).toEqual(expect.stringContaining('BADVAL is not defined'));
try {
expect(e.message).toEqual(expect.stringContaining('Lodash'));
}
catch (ee) {
done(ee);
}
expect(output.length).toEqual(0);
done();
})
Expand Down
8 changes: 6 additions & 2 deletions packages/core/test/overturn.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,12 @@ test('with a buggy script', (done) => {
output.push(chunk);
})
.on('error', (e) => {
expect(e.message).toEqual(expect.stringContaining('BADVAL is not defined'));
expect(output.length).toEqual(0);
try {
expect(e.message).toEqual(expect.stringContaining('Lodash'));
expect(output.length).toEqual(0);
} catch (ee) {
done(ee);
}
done();
})
.on('end', () => {
Expand Down

0 comments on commit da8ba14

Please sign in to comment.