Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): use primordials in ext/node/polyfills/testing.ts #24310

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions ext/node/polyfills/testing.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials

import { primordials } from "ext:core/mod.js";
const { PromisePrototypeThen } = primordials;
import { notImplemented, warnNotImplemented } from "ext:deno_node/_utils.ts";

export function run() {
Expand Down Expand Up @@ -54,7 +53,7 @@ class NodeTestContext {

test(name, options, fn) {
const prepared = prepareOptions(name, options, fn, {});
return this.#denoContext.step({
return PromisePrototypeThen(this.#denoContext.step({
name: prepared.name,
fn: async (denoTestContext) => {
const newNodeTextContext = new NodeTestContext(denoTestContext);
Expand All @@ -64,7 +63,7 @@ class NodeTestContext {
sanitizeExit: false,
sanitizeOps: false,
sanitizeResources: false,
}).then(() => undefined);
}), () => undefined);
}

before(_fn, _options) {
Expand Down Expand Up @@ -127,6 +126,8 @@ function wrapTestFn(fn, resolve) {
function prepareDenoTest(name, options, fn, overrides) {
const prepared = prepareOptions(name, options, fn, overrides);

// TODO(iuioiua): Update once there's a primordial for `Promise.withResolvers()`.
iuioiua marked this conversation as resolved.
Show resolved Hide resolved
// deno-lint-ignore prefer-primordials
const { promise, resolve } = Promise.withResolvers();

const denoTestOptions = {
Expand Down
Loading