refactor: leverage native async setTimeout rather than delay

This commit is contained in:
Matt Travi 2023-05-22 22:25:22 -05:00
parent 42385d0f96
commit ab4fe4c3d4
No known key found for this signature in database
GPG Key ID: 8C173646C24FED70
4 changed files with 5 additions and 25 deletions

19
package-lock.json generated
View File

@ -46,7 +46,6 @@
"c8": "7.13.0",
"clear-module": "4.1.2",
"codecov": "3.8.3",
"delay": "6.0.0",
"dockerode": "3.3.5",
"file-url": "4.0.0",
"fs-extra": "11.1.1",
@ -2000,18 +1999,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/delay": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/delay/-/delay-6.0.0.tgz",
"integrity": "sha512-2NJozoOHQ4NuZuVIr5CWd0iiLVIRSDepakaovIN+9eIDHEhdCAEvSy2cuf1DCrPPQLvHmbqTHODlhHg8UCy4zw==",
"dev": true,
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
@ -10838,12 +10825,6 @@
}
}
},
"delay": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/delay/-/delay-6.0.0.tgz",
"integrity": "sha512-2NJozoOHQ4NuZuVIr5CWd0iiLVIRSDepakaovIN+9eIDHEhdCAEvSy2cuf1DCrPPQLvHmbqTHODlhHg8UCy4zw==",
"dev": true
},
"deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",

View File

@ -60,7 +60,6 @@
"c8": "7.13.0",
"clear-module": "4.1.2",
"codecov": "3.8.3",
"delay": "6.0.0",
"dockerode": "3.3.5",
"file-url": "4.0.0",
"fs-extra": "11.1.1",

View File

@ -1,9 +1,9 @@
import path, { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { setTimeout } from "node:timers/promises";
import Docker from "dockerode";
import getStream from "get-stream";
import got from "got";
import delay from "delay";
import pRetry from "p-retry";
const IMAGE = "verdaccio/verdaccio:5";
@ -33,7 +33,7 @@ export async function start() {
});
await container.start();
await delay(4000);
await setTimeout(4000);
try {
// Wait for the registry to be ready

View File

@ -1,11 +1,11 @@
import path from "path";
import path from "node:path";
import { setTimeout } from "node:timers/promises";
import test from "ava";
import * as td from "testdouble";
import { escapeRegExp } from "lodash-es";
import fsExtra from "fs-extra";
import { execa } from "execa";
import { WritableStreamBuffer } from "stream-buffers";
import delay from "delay";
import getAuthUrl from "../lib/get-git-auth-url.js";
import { SECRET_REPLACEMENT } from "../lib/definitions/constants.js";
@ -295,7 +295,7 @@ test("Release patch, minor and major versions", async (t) => {
t.is(exitCode, 0);
// Wait for 3s as the change of dist-tag takes time to be reflected in the registry
await delay(3000);
await setTimeout(3000);
// Retrieve the published package from the registry and check version and gitHead
({
"dist-tags": { latest: releasedVersion },