Skip to content
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
2 changes: 1 addition & 1 deletion packages/web-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"mocha": "^11",
"mocha-junit-reporter": "^2.2.1",
"mocha-multi-reporters": "^1.5.1",
"nock": "^13",
"nock": "^14",
"shx": "^0.4.0",
"sinon": "^20",
"source-map-support": "^0.5.21",
Expand Down
9 changes: 5 additions & 4 deletions packages/web-api/src/WebClient.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import axios, { type InternalAxiosRequestConfig } from 'axios';
import { assert, expect } from 'chai';
import nock from 'nock';
import nock, { type ReplyHeaders } from 'nock';
import sinon from 'sinon';
import {
type RequestConfig,
Expand Down Expand Up @@ -801,7 +801,7 @@ describe('WebClient', () => {

describe('has an option to set request concurrency', () => {
// TODO: factor out common logic into test helpers
const responseDelay = 100; // ms
const responseDelay = 500; // ms
Copy link
Contributor

Choose a reason for hiding this comment

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

On windows I think the delay is too short and the tests assertions are failing, bumping this value seems to make the test stable

Copy link
Member

Choose a reason for hiding this comment

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

This makes sense to me but I'm open to revisitng this in #2221 👀

let testStart: number;
let scope: nock.Scope;

Expand Down Expand Up @@ -1102,14 +1102,15 @@ describe('WebClient', () => {
});

it('should throw an error if the response has no retry info', async () => {
// @ts-expect-error header values cannot be undefined
const scope = nock('https://slack.com').post(/api/).reply(429, {}, { 'retry-after': undefined });
const emptyHeaders: ReplyHeaders & { 'retry-after'?: never } = {}; // Ensure that 'retry-after' is not in the headers
const scope = nock('https://slack.com').post(/api/).reply(429, {}, emptyHeaders);
const client = new WebClient(token);
try {
await client.apiCall('method');
assert.fail('expected error to be thrown');
} catch (err) {
assert.instanceOf(err, Error);
} finally {
scope.done();
}
});
Expand Down