Skip to content

Commit

Permalink
Require Node.js 14
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 29, 2022
1 parent 1f5d760 commit b83a409
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ jobs:
fail-fast: false
matrix:
node-version:
- 18
- 16
- 14
- 12
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface Options<ResolveValueType> {
console.log('Yay! The file now exists.');
```
*/
readonly timeout?: number | TimeoutOptions<ResolveValueType>;
readonly timeout?: number | TimeoutOptions<ResolveValueType>; // eslint-disable-line @typescript-eslint/no-redundant-type-constituents

/**
Whether to run the check immediately rather than starting by waiting `interval` milliseconds.
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default async function pWaitFor(condition, options = {}) {
const {
interval = 20,
timeout = Number.POSITIVE_INFINITY,
before = true
before = true,
} = options;

let retryTimeout;
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"p-timeout": "^6.0.0"
},
"devDependencies": {
"ava": "^3.15.0",
"ava": "^4.3.1",
"delay": "^5.0.0",
"time-span": "^4.0.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
"time-span": "^5.1.0",
"tsd": "^0.22.0",
"xo": "^0.51.0"
}
}
14 changes: 7 additions & 7 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('waits no longer than `timeout` milliseconds before rejecting', async t =>
return true;
}, {
interval: 20,
timeout: maxWait
timeout: maxWait,
}));

const timeTaken = end();
Expand All @@ -49,8 +49,8 @@ test('stops performing checks if a timeout occurs', async t => {
},
{
interval: 10,
timeout: 200
}
timeout: 200,
},
)
.catch(async _ => {
const checksAtTimeout = checksPerformed;
Expand All @@ -65,7 +65,7 @@ test('does not perform a leading check', async t => {

await pWaitFor(async () => true, {
interval: ms,
before: false
before: false,
});

t.true(end() > (ms - 20));
Expand All @@ -90,11 +90,11 @@ test('timeout option - object', async t => {
}, {
timeout: {
milliseconds: 100,
message: new CustomizedTimeoutError()
}
message: new CustomizedTimeoutError(),
},
}), {
name: 'MyError',
message: 'Time’s up!',
instanceOf: CustomizedTimeoutError
instanceOf: CustomizedTimeoutError,
});
});

0 comments on commit b83a409

Please sign in to comment.