1
0
Fork 0
mirror of synced 2024-10-03 02:27:06 +13:00

Fix test.

This commit is contained in:
Sam Rose 2023-12-15 16:50:36 +00:00
parent 92a230667f
commit b963e7081e
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View file

@ -56,6 +56,7 @@ module.exports.processJS = (handlebars, context) => {
const res = { data: runJS(js, sandboxContext) }
return `{{${LITERAL_MARKER} js_result-${JSON.stringify(res)}}}`
} catch (error) {
console.log(`JS error: ${typeof error} ${JSON.stringify(error)}`)
if (error.code === "ERR_SCRIPT_EXECUTION_TIMEOUT") {
return "Timed out while executing JS"
}

View file

@ -114,7 +114,7 @@ describe("Test the JavaScript helper", () => {
it("should timeout after one second", () => {
const output = processJS(`while (true) {}`)
expect(output).toBe("Error while executing JS")
expect(output).toBe("Timed out while executing JS")
})
it("should prevent access to the process global", () => {