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: use setTimeout Promise #58

Merged
merged 5 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 22 additions & 0 deletions .github/workflows/nodejs-14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Node.js 14 CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: irby/setup-node-nvm@master
with:
node-version: '16.x'
Comment on lines +16 to +18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using the official Node.js setup action

The workflow uses irby/setup-node-nvm@master which is a third-party action. For better security and reliability, consider using the official actions/setup-node action which also supports multiple Node.js versions.

-        uses: irby/setup-node-nvm@master
+        uses: actions/setup-node@v4
         with:
-          node-version: '16.x'
+          node-version: ['14.x', '16.x']

Committable suggestion skipped: line range outside the PR's diff.

- run: npm install
- run: npm run prepublishOnly
- run: node -v
- run: . /home/runner/mynvm/nvm.sh && nvm install 14 && nvm use 14 && node -v && node dist/commonjs/bin/detect-port.js
7 changes: 6 additions & 1 deletion src/wait-port.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { debuglog } from 'node:util';
import { setTimeout as sleep } from 'node:timers/promises';
import detectPort from './detect-port.js';

const debug = debuglog('detect-port:wait-port');

function sleep(ms: number) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}

export class WaitPortRetryError extends Error {
retries: number;
count: number;
Expand Down
Loading