chore: migrate Node.js implementation for js-sandbox to isolated-vm (#3973)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
James George
2024-04-19 08:38:46 -07:00
committed by GitHub
parent a079e0f04b
commit 22c6eabd13
52 changed files with 1028 additions and 285 deletions

View File

@@ -1,8 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runPreRequestScript } from "~/pre-request/node-vm"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runPreRequestScript, runTestScript } from "~/node"
import { TestResponse, TestResult } from "~/types"
describe("Base64 helper functions", () => {

View File

@@ -1,8 +1,9 @@
import "@relmify/jest-fp-ts"
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse, TestResult } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,8 +1,9 @@
import "@relmify/jest-fp-ts"
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse, TestResult } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,7 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse, TestResult } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,7 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse, TestResult } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,7 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse, TestResult } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,8 +1,9 @@
import "@relmify/jest-fp-ts"
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse } from "~/types"
const fakeResponse: TestResponse = {
@@ -23,7 +24,7 @@ describe("toBe", () => {
return expect(
func(
`
pw.expect(2).toBe(2)
pw.expect(2).toBe(2)
`,
fakeResponse
)()

View File

@@ -1,8 +1,9 @@
import "@relmify/jest-fp-ts"
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,7 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,7 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,7 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse } from "~/types"
const fakeResponse: TestResponse = {

View File

@@ -1,6 +1,6 @@
import "@relmify/jest-fp-ts"
import { describe, expect, test } from "vitest"
import { runPreRequestScript } from "~/pre-request/node-vm"
import { runPreRequestScript } from "~/node"
describe("runPreRequestScript", () => {
test("returns the updated environment properly", () => {

View File

@@ -1,4 +1,6 @@
import { preventCyclicObjects } from "~/utils"
import { preventCyclicObjects } from "~/shared-utils"
import { describe, expect, test } from "vitest"
describe("preventCyclicObjects", () => {
test("succeeds with a simple object", () => {

View File

@@ -1,7 +1,9 @@
import * as TE from "fp-ts/TaskEither"
import { pipe } from "fp-ts/function"
import { runTestScript } from "~/test-runner/node-vm"
import { describe, expect, test } from "vitest"
import { runTestScript } from "~/node"
import { TestResponse } from "~/types"
const fakeResponse: TestResponse = {