Comparing version 3.1.2 to 3.2.0
@@ -9,3 +9,3 @@ 'use strict'; | ||
const errorRe = /(.*?):(\d+): (([\w\d]+): (.*))[\w\W]*(\3((:?\s+at.*\r?\n)*)(\r?\n)+)?$/; | ||
const errorRe = /(.*?):(\d+): (([\w\d]+)(?:: (.*))?)[\w\W]*(\3((:?\s+at.*\r?\n)*)(\r?\n)+)?$/; | ||
@@ -12,0 +12,0 @@ const runtimeStr = inception( |
@@ -9,3 +9,3 @@ 'use strict'; | ||
const errorRe = /^(?:.*?): (\w+)(?:: (.*))$/m; | ||
const errorRe = /(?:.*?): (\w+)(?:: (.*))?(?:\r?\nat[^\n]*)?(\r?\n.*@(\[native code\]|(?:.*:\d+:\d+)))*\r?\n/; | ||
@@ -43,2 +43,3 @@ // JSC stack frame format: | ||
function parseStack(stackStr) { | ||
stackStr = stackStr || ''; | ||
const stack = []; | ||
@@ -133,5 +134,16 @@ | ||
message: match[2], | ||
stack: parseStack(str.slice(match[0].length)) | ||
stack: parseStack(match[3]) | ||
}; | ||
} | ||
normalizeResult(result) { | ||
const match = result.stdout.match(errorRe); | ||
if (match) { | ||
result.stdout = result.stdout.replace(errorRe, ''); | ||
result.stderr = match[0]; | ||
} | ||
return result; | ||
} | ||
} | ||
@@ -138,0 +150,0 @@ JSCAgent.runtime = runtimeStr; |
@@ -8,4 +8,4 @@ 'use strict'; | ||
const errorRe = /^(.*?)?:(\d+):(\d+)? ([\w\d]+): (.*)$/m; | ||
const customErrorRe = /^:([\w\d]+): (.*)$/m; | ||
const errorRe = /^(.*?)?:(\d+):(\d+)? ([\w\d]+): (.+)?$/m; | ||
const customErrorRe = /^:([\w\d]+): (.+)$/m; | ||
const runtimeStr = inception( | ||
@@ -12,0 +12,0 @@ fs.readFileSync(runtimePath.for('sm'), 'utf8') |
'use strict'; | ||
const errorRe = /^[\w\d]+(:.*)?\r?\n(\s+at.*\r?\n)*/m; | ||
const errorPropsRe = /^(\w+)(: (.*))?\r?\n/; | ||
const errorRe = /^[\w\d]+(:.*)?(?:(\r?\n\s+at.*)+|\r?\n$)/m; | ||
const errorPropsRe = /^([\w\d]+)(: (.*))?\r?\n/; | ||
const frameRe = /^\s+at(.*)\(?(.*):(\d+):(\d+)\)?/; | ||
@@ -6,0 +6,0 @@ |
{ | ||
"name": "eshost", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Invoke ECMAScript scripts in any command line JS engine.", | ||
@@ -5,0 +5,0 @@ "main": "lib/eshost.js", |
var fs = require('fs'); | ||
var esh = require('./'); | ||
var payload = fs.readFileSync('./test-promise.js', 'utf8'); | ||
var payload = fs.readFileSync('./test262.js', 'utf8'); | ||
var agent; | ||
esh.createAgent('chrome', { hostPath: 'C:/Users/brterlso/AppData/Local/Google/Chrome SxS/Application/chrome.exe'}).then(a => { | ||
esh.createAgent('node', { hostPath: 'c:/program files/nodejs/node.exe'}).then(a => { | ||
agent = a; | ||
@@ -7,0 +7,0 @@ return agent.evalScript(payload, { async: true }); |
@@ -11,6 +11,7 @@ 'use strict'; | ||
['../v8/build/Release/d8.exe', 'd8'], | ||
['../webkit/build/bin64/jsc.exe', 'jsc'], | ||
//['C:/Users/brterlso/AppData/Local/Google/Chrome SxS/Application/chrome.exe', 'chrome'], | ||
//[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'], | ||
]; | ||
@@ -93,2 +94,21 @@ | ||
it('runs thrown Errors without messages', function () { | ||
return agent.evalScript('throw new Error();').then(function (result) { | ||
assert.equal(result.stdout, '', 'stdout not present'); | ||
assert(result.error, 'error is present'); | ||
assert.equal(result.error.message, undefined); | ||
assert.equal(result.error.name, 'Error'); | ||
}); | ||
}); | ||
it('runs thrown errors from eval', function () { | ||
return agent.evalScript('eval("\'\\u000Astr\\u000Aing\\u000A\'") === "\\u000Astr\\u000Aing\\u000A"') | ||
.then(function (result) { | ||
assert.equal(result.stdout, '', 'stdout not present'); | ||
assert(result.error, 'error is present'); | ||
assert(result.error.message); // message should be present (but is implementation defined) | ||
assert.equal(result.error.name, 'SyntaxError'); | ||
}); | ||
}); | ||
it('gathers stdout', function () { | ||
@@ -95,0 +115,0 @@ return agent.evalScript('print("foo")').then(function(result) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66084519
129
1649