Skip to content

Commit

Permalink
wptrunner: expose gc (nodejs#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored and crysmags committed Feb 27, 2024
1 parent 7ed308a commit 0f96f7d
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions test/wpt/runner/runner/worker.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import buffer from 'node:buffer'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { runInThisContext } from 'node:vm'
import { setFlagsFromString } from 'node:v8'
import { runInNewContext, runInThisContext } from 'node:vm'
import { parentPort, workerData } from 'node:worker_threads'
import { readFileSync } from 'node:fs'
import buffer from 'node:buffer'
import {
setGlobalOrigin,
Response,
Request,
fetch,
FormData,
File,
Headers,
FileReader
fetch, File, FileReader, FormData, Headers, Request, Response, setGlobalOrigin
} from '../../../../index.js'
import { WebSocket } from '../../../../lib/websocket/websocket.js'
import { CloseEvent } from '../../../../lib/websocket/events.js'
import { WebSocket } from '../../../../lib/websocket/websocket.js'

const { initScripts, meta, test, url, path } = workerData

Expand Down Expand Up @@ -142,5 +136,10 @@ for (const script of meta.scripts) {
runInThisContext(script)
}

// A few tests require gc, which can't be passed to a Worker.
// see https://github.com/nodejs/node/issues/16595#issuecomment-340288680
setFlagsFromString('--expose-gc')
globalThis.gc = runInNewContext('gc')

// Finally, run the test.
runInThisContext(test)

0 comments on commit 0f96f7d

Please sign in to comment.