Skip to content

Commit

Permalink
v3.3.2 - support yet another jsshell stderr format
Browse files Browse the repository at this point in the history
  • Loading branch information
bterlson committed Nov 3, 2016
1 parent dc2e0ac commit 633dac1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/agents/jsshell.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const runtimePath = require('../runtimePath');
const ConsoleAgent = require('../ConsoleAgent');

const errorRe = /^(.*?)?:(\d+):(\d+)? ([\w\d]+): (.+)?$/m;
const customErrorRe = /^:([\w\d]+): (.+)$/m;
const customErrorRe = /^(?:uncaught exception: |:)([\w\d]+): (.+)$/m;
const runtimeStr = inception(
fs.readFileSync(runtimePath.for('sm'), 'utf8')
.replace(/\r?\n/g, '')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eshost",
"version": "3.3.1",
"version": "3.3.2",
"description": "Invoke ECMAScript scripts in any command line JS engine.",
"main": "lib/eshost.js",
"scripts": {
Expand Down
23 changes: 21 additions & 2 deletions test/runify.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const hosts = [
['../v8/build/Release/d8.exe', 'd8'],
['../webkit/build/bin64/jsc.exe', 'jsc'],
/*[undefined, 'chrome'],*/
/*

['C:/Program Files (x86)/Mozilla Firefox/firefox.exe', 'firefox'],
['C:/Program Files (x86)/Nightly/firefox.exe', 'firefox'],
/*['C:/Program Files (x86)/Nightly/firefox.exe', 'firefox'],
['C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', 'chrome'],
*/
];
Expand Down Expand Up @@ -98,6 +98,25 @@ hosts.forEach(function (record) {
});
});

it('runs thrown custom Errors that don\'t have Error.prototype', function () {
return agent.evalScript(`
function Foo2Error(msg) {
this.message = msg;
}
Foo2Error.prototype.name = 'Foo2Error';
Foo2Error.prototype.toString = function () {
return 'Foo2Error: ' + this.message;
}
throw new Foo2Error('FAIL!');
`).then(result => {
assert.equal(result.stdout, '', 'stdout not present');
assert(result.error, 'error is present');
assert.equal(result.error.message, 'FAIL!');
assert.equal(result.error.name, 'Foo2Error');
});
})

it('runs thrown Errors without messages', function () {
return agent.evalScript('throw new Error();').then(function (result) {
assert.equal(result.stdout, '', 'stdout not present');
Expand Down

0 comments on commit 633dac1

Please sign in to comment.