refactor(scripting-revamp): migrate js-sandbox to web worker/Node vm based implementation (#3619)

This commit is contained in:
James George
2023-12-07 16:10:42 +05:30
committed by GitHub
parent 0a61ec2bfe
commit bdfa14fa54
43 changed files with 2805 additions and 3285 deletions

View File

@@ -1,10 +1,10 @@
import { execPreRequestScript } from "../preRequest"
import { runPreRequestScript } from "~/pre-request/node-vm"
import "@relmify/jest-fp-ts"
describe("execPreRequestScript", () => {
test("returns the updated envirionment properly", () => {
return expect(
execPreRequestScript(
runPreRequestScript(
`
pw.env.set("bob", "newbob")
`,
@@ -27,7 +27,7 @@ describe("execPreRequestScript", () => {
test("fails if the key is not a string", () => {
return expect(
execPreRequestScript(
runPreRequestScript(
`
pw.env.set(10, "newbob")
`,
@@ -44,7 +44,7 @@ describe("execPreRequestScript", () => {
test("fails if the value is not a string", () => {
return expect(
execPreRequestScript(
runPreRequestScript(
`
pw.env.set("bob", 10)
`,
@@ -61,7 +61,7 @@ describe("execPreRequestScript", () => {
test("fails for invalid syntax", () => {
return expect(
execPreRequestScript(
runPreRequestScript(
`
pw.env.set("bob",
`,
@@ -78,7 +78,7 @@ describe("execPreRequestScript", () => {
test("creates new env variable if doesn't exist", () => {
return expect(
execPreRequestScript(
runPreRequestScript(
`
pw.env.set("foo", "bar")
`,