diff --git a/package-lock.json b/package-lock.json index 2b54d1ba..ec1fb483 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "delay": "^5.0.0", "node-gyp-build": "<4.0", "p-limit": "^3.1.0", "pprof-format": "^2.2.1", @@ -2151,18 +2150,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delay": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", - "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/diff": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", diff --git a/package.json b/package.json index b9216d27..e6b20b21 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ }, "license": "Apache-2.0", "dependencies": { - "delay": "^5.0.0", "node-gyp-build": "<4.0", "p-limit": "^3.1.0", "pprof-format": "^2.2.1", diff --git a/ts/src/time-profiler.ts b/ts/src/time-profiler.ts index a265364b..acd242e1 100644 --- a/ts/src/time-profiler.ts +++ b/ts/src/time-profiler.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import delay from 'delay'; +import {setTimeout} from 'timers/promises'; import { serializeTimeProfile, @@ -84,7 +84,7 @@ const DEFAULT_OPTIONS: TimeProfilerOptions = { export async function profile(options: TimeProfilerOptions = {}) { options = {...DEFAULT_OPTIONS, ...options}; start(options); - await delay(options.durationMillis!); + await setTimeout(options.durationMillis!); return stop(); } diff --git a/ts/test/test-time-profiler.ts b/ts/test/test-time-profiler.ts index d7359578..d3b7924f 100644 --- a/ts/test/test-time-profiler.ts +++ b/ts/test/test-time-profiler.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import delay from 'delay'; import * as sinon from 'sinon'; import {time, getNativeThreadId} from '../src'; import * as v8TimeProfiler from '../src/time-profiler-bindings'; @@ -25,6 +24,7 @@ import {AssertionError} from 'assert'; import {GenerateTimeLabelsArgs, LabelSet} from '../src/v8-types'; import {AsyncLocalStorage} from 'async_hooks'; import {satisfies} from 'semver'; +import {setTimeout as setTimeoutPromise} from 'timers/promises'; import assert from 'assert'; @@ -470,7 +470,7 @@ describe('Time Profiler', () => { time.profile(PROFILE_OPTIONS).then(() => { isProfiling = false; }); - await delay(2 * PROFILE_OPTIONS.durationMillis); + await setTimeoutPromise(2 * PROFILE_OPTIONS.durationMillis); assert.strictEqual(false, isProfiling, 'profiler is still running'); });