diff --git a/.github/workflows/nodejs-14.yml b/.github/workflows/nodejs-14.yml new file mode 100644 index 0000000..25ed7a8 --- /dev/null +++ b/.github/workflows/nodejs-14.yml @@ -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' + - 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 diff --git a/src/wait-port.ts b/src/wait-port.ts index 82809a9..093b31a 100644 --- a/src/wait-port.ts +++ b/src/wait-port.ts @@ -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;