Fix jsRunner.spec.ts.
This commit is contained in:
parent
df242cc2ad
commit
f9ccbbe081
|
@ -41,10 +41,11 @@ describe("jsRunner (using isolated-vm)", () => {
|
|||
})
|
||||
|
||||
it("should prevent sandbox escape", async () => {
|
||||
const output = await processJS(
|
||||
`return this.constructor.constructor("return process.env")()`
|
||||
await expect(
|
||||
processJS(`return this.constructor.constructor("return process.env")()`)
|
||||
).rejects.toThrow(
|
||||
"error while running user-supplied JavaScript: ReferenceError: process is not defined"
|
||||
)
|
||||
expect(output).toBe("ReferenceError: process is not defined")
|
||||
})
|
||||
|
||||
describe("helpers", () => {
|
||||
|
|
|
@ -22,7 +22,7 @@ class UserScriptError extends Error {
|
|||
code = "USER_SCRIPT_ERROR"
|
||||
constructor(readonly userScriptError: Error) {
|
||||
super(
|
||||
`error while running user-supplied JavaScript: ${userScriptError.message}`,
|
||||
`error while running user-supplied JavaScript: ${userScriptError.toString()}`,
|
||||
{ cause: userScriptError }
|
||||
)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ export class UserScriptError extends Error {
|
|||
|
||||
constructor(readonly userScriptError: Error) {
|
||||
super(
|
||||
`error while running user-supplied JavaScript: ${userScriptError.message}`
|
||||
`error while running user-supplied JavaScript: ${userScriptError.toString()}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue