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 () => {
|
it("should prevent sandbox escape", async () => {
|
||||||
const output = await processJS(
|
await expect(
|
||||||
`return this.constructor.constructor("return process.env")()`
|
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", () => {
|
describe("helpers", () => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class UserScriptError extends Error {
|
||||||
code = "USER_SCRIPT_ERROR"
|
code = "USER_SCRIPT_ERROR"
|
||||||
constructor(readonly userScriptError: Error) {
|
constructor(readonly userScriptError: Error) {
|
||||||
super(
|
super(
|
||||||
`error while running user-supplied JavaScript: ${userScriptError.message}`,
|
`error while running user-supplied JavaScript: ${userScriptError.toString()}`,
|
||||||
{ cause: userScriptError }
|
{ cause: userScriptError }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ export class UserScriptError extends Error {
|
||||||
|
|
||||||
constructor(readonly userScriptError: Error) {
|
constructor(readonly userScriptError: Error) {
|
||||||
super(
|
super(
|
||||||
`error while running user-supplied JavaScript: ${userScriptError.message}`
|
`error while running user-supplied JavaScript: ${userScriptError.toString()}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue