Skip to content

Commit ff4dcfb

Browse files
authored
fix: add ignored status for crash details (#149)
* fix: add ignored status for crash details * chore: fix tests * chore: pin to 22.12 for now because of tsconfig-paths issue * fix: add stack key ignored event * chore: remove tsx
1 parent 020678a commit ff4dcfb

File tree

10 files changed

+39
-36
lines changed

10 files changed

+39
-36
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ jobs:
1414
with:
1515
persist-credentials: false
1616

17+
# Pin to Node.js 22.12 as 22.18+ breaks tsconfig-paths/register functionality
1718
- uses: actions/setup-node@v4
1819
with:
19-
node-version: "22.x"
20+
node-version: "22.12"
2021

2122
- name: Install
2223
run: npm install

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dist"
99
],
1010
"engines": {
11-
"node": ">=18.0.0"
11+
"node": ">=18.0.0 <22.13.0"
1212
},
1313
"scripts": {
1414
"prepare": "husky install",

src/common/client/bugsplat-api-client/bugsplat-api-client.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('BugSplatApiClient', () => {
4646
});
4747

4848
it('should call fetch with correct route', () => {
49-
expect((<any>client)._fetch).toHaveBeenCalledWith(`${fakeBugSplatHost}${route}`, jasmine.anything());
49+
expect((client as any)._fetch).toHaveBeenCalledWith(`${fakeBugSplatHost}${route}`, jasmine.anything());
5050
});
5151

5252
describe('when environment is Browser', () => {
@@ -59,7 +59,7 @@ describe('BugSplatApiClient', () => {
5959

6060
await client.fetch(route, init);
6161

62-
expect((<any>client)._fetch).toHaveBeenCalledWith(
62+
expect((client as any)._fetch).toHaveBeenCalledWith(
6363
jasmine.any(String),
6464
jasmine.objectContaining({
6565
body,
@@ -71,7 +71,7 @@ describe('BugSplatApiClient', () => {
7171

7272
describe('when environment is Node', () => {
7373
it('should call fetch with cookie and xsrf-token headers in request init', () => {
74-
expect((<any>client)._fetch).toHaveBeenCalledWith(
74+
expect((client as any)._fetch).toHaveBeenCalledWith(
7575
jasmine.any(String),
7676
jasmine.objectContaining({
7777
body,
@@ -98,7 +98,7 @@ describe('BugSplatApiClient', () => {
9898
beforeEach(async () => result = await client.login(email, password));
9999

100100
it('should call fetch with correct url', () => {
101-
expect((<any>client)._fetch).toHaveBeenCalledWith(`${fakeBugSplatHost}/api/authenticatev3`, jasmine.anything());
101+
expect((client as any)._fetch).toHaveBeenCalledWith(`${fakeBugSplatHost}/api/authenticatev3`, jasmine.anything());
102102
});
103103

104104
it('should append email, password and Login properties to formData', () => {
@@ -108,7 +108,7 @@ describe('BugSplatApiClient', () => {
108108
});
109109

110110
it('should call fetch with formData', () => {
111-
expect((<any>client)._fetch).toHaveBeenCalledWith(
111+
expect((client as any)._fetch).toHaveBeenCalledWith(
112112
jasmine.any(String),
113113
jasmine.objectContaining({
114114
method: 'POST',
@@ -125,7 +125,7 @@ describe('BugSplatApiClient', () => {
125125

126126
describe('error', () => {
127127
it('should throw if response status is 401', async () => {
128-
(<any>client)._fetch.and.returnValue({ status: 401 });
128+
(client as any)._fetch.and.returnValue({ status: 401 });
129129

130130
await expectAsync(client.login(email, password)).toBeRejectedWithError(
131131
Error,
@@ -142,8 +142,8 @@ function createFakeBugSplatApiClient(
142142
formData
143143
): BugSplatApiClient {
144144
const client = new BugSplatApiClient(fakeBugSplatHost, environment);
145-
(<any>client)._fetch = jasmine.createSpy();
146-
(<any>client)._fetch.and.returnValue(responseBody);
147-
(<any>client)._createFormData = () => formData;
145+
(client as any)._fetch = jasmine.createSpy();
146+
(client as any)._fetch.and.returnValue(responseBody);
147+
(client as any)._createFormData = () => formData;
148148
return client;
149149
}

src/common/client/oauth-client-credentials-api-client/oauth-client-credentials-api-client.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('OAuthClientCredentialsClient', () => {
3333
fakeAuthorizeResponseBody,
3434
fakeFormData
3535
);
36-
(<any>sut)._fetch.and.returnValues(
36+
(sut as any)._fetch.and.returnValues(
3737
Promise.resolve(fakeAuthorizeResponseBody),
3838
Promise.resolve(fakeFetchResponseBody)
3939
);
@@ -45,7 +45,7 @@ describe('OAuthClientCredentialsClient', () => {
4545
beforeEach(async () => result = await sut.login());
4646

4747
it('should call fetch with correct url', () => {
48-
expect((<any>sut)._fetch).toHaveBeenCalledWith(
48+
expect((sut as any)._fetch).toHaveBeenCalledWith(
4949
`${host}/oauth2/authorize`,
5050
jasmine.anything()
5151
);
@@ -56,7 +56,7 @@ describe('OAuthClientCredentialsClient', () => {
5656
expect(fakeFormData.append).toHaveBeenCalledWith('client_id', clientId);
5757
expect(fakeFormData.append).toHaveBeenCalledWith('client_secret', clientSecret);
5858
expect(fakeFormData.append).toHaveBeenCalledWith('scope', 'restricted');
59-
expect((<any>sut)._fetch).toHaveBeenCalledWith(
59+
expect((sut as any)._fetch).toHaveBeenCalledWith(
6060
jasmine.anything(),
6161
jasmine.objectContaining({
6262
method: 'POST',
@@ -104,14 +104,14 @@ describe('OAuthClientCredentialsClient', () => {
104104
});
105105

106106
it('should call fetch with correct url', () => {
107-
expect((<any>sut)._fetch).toHaveBeenCalledWith(
107+
expect((sut as any)._fetch).toHaveBeenCalledWith(
108108
`${host}${route}`,
109109
jasmine.anything()
110110
);
111111
});
112112

113113
it('should call fetch with init containing Authorization header', () => {
114-
const mostRecentCallArgs = (<any>sut)._fetch.calls.mostRecent().args;
114+
const mostRecentCallArgs = (sut as any)._fetch.calls.mostRecent().args;
115115
const headers = mostRecentCallArgs[1].headers;
116116
expect(headers).toEqual(jasmine.objectContaining({
117117
...headers,
@@ -120,11 +120,11 @@ describe('OAuthClientCredentialsClient', () => {
120120
});
121121

122122
it('should call fetch with new init if init is not provided', async () => {
123-
(<any>sut)._fetch.and.returnValue(Promise.resolve(fakeAuthorizeResponseBody));
123+
(sut as any)._fetch.and.returnValue(Promise.resolve(fakeAuthorizeResponseBody));
124124

125125
await sut.fetch(route);
126126

127-
const mostRecentCallArgs = (<any>sut)._fetch.calls.mostRecent().args;
127+
const mostRecentCallArgs = (sut as any)._fetch.calls.mostRecent().args;
128128
const headers = mostRecentCallArgs[1].headers;
129129
expect(headers).toEqual(jasmine.objectContaining({
130130
Authorization: `${fakeAuthorizeResult.token_type} ${fakeAuthorizeResult.access_token}`
@@ -139,7 +139,7 @@ describe('OAuthClientCredentialsClient', () => {
139139

140140
describe('error', () => {
141141
it('should throw error with useful message if fetch returns 401', async () => {
142-
(<any>sut)._fetch.and.resolveTo(createFakeResponseBody(401));
142+
(sut as any)._fetch.and.resolveTo(createFakeResponseBody(401));
143143

144144
await expectAsync(sut.fetch(route)).toBeRejectedWithError(
145145
Error,
@@ -158,9 +158,9 @@ function createFakeOAuthClientCredentialsClient(
158158
formData
159159
): OAuthClientCredentialsClient {
160160
const client = new OAuthClientCredentialsClient(clientId, clientSecret, host);
161-
(<any>client)._fetch = jasmine.createSpy();
162-
(<any>client)._fetch.and.returnValue(responseBody);
163-
(<any>client)._createFormData = () => formData;
161+
(client as any)._fetch = jasmine.createSpy();
162+
(client as any)._fetch.and.returnValue(responseBody);
163+
(client as any)._createFormData = () => formData;
164164
return client;
165165
}
166166

src/crash/crash-details/crash-details.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ describe('createCrashDetails', () => {
4545
processor: 'OBAN-10.0.7.144',
4646
comments: null,
4747
processed: ProcessingStatus.Complete,
48-
thread: (<any>{ stackFrames: [], stackKeyId: 0 }),
48+
thread: ({ stackFrames: [], stackKeyId: 0 } as any),
4949
status: CrashStatus.Open,
5050
};
5151

52-
const result = createCrashDetails(<any>options);
52+
const result = createCrashDetails(options as any);
5353

5454
expect(result.comments).toEqual('');
5555
expect(result.description).toEqual('');

src/crash/crash-details/crash-details.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export enum CrashStatus {
2828
Open = 0,
2929
Closed = 1,
3030
Regression = 2,
31+
Ignored = 3,
3132
}
3233

3334
export interface CrashDetails {

src/crash/stack-frame/stack-frame.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ describe('stackFrame', () => {
44

55
describe('constructor', () => {
66
it('should throw if fileName is not a string', () => {
7-
expect(() => new StackFrame(<any>{ fileName: {} })).toThrow();
7+
expect(() => new StackFrame({ fileName: {} } as any)).toThrow();
88
});
99

1010
it('should throw if functionName is not a string', () => {
11-
expect(() => new StackFrame(<any>{ fileName: 'string', functionName: {} })).toThrow();
11+
expect(() => new StackFrame({ fileName: 'string', functionName: {} } as any)).toThrow();
1212
});
1313

1414
it('should throw if lineNumber is not a number', () => {
15-
expect(() => new StackFrame(<any>{ fileName: 'string', functionName: 'another string', lineNumber: 'string' })).toThrow();
15+
expect(() => new StackFrame({ fileName: 'string', functionName: 'another string', lineNumber: 'string' } as any)).toThrow();
1616
});
1717

1818
it('should throw if stackFrameLevel is not a number', () => {
19-
expect(() => new StackFrame(<any>{ fileName: 'string', functionName: 'another string', lineNumber: 0, stackFrameLevel: 'another string' })).toThrow();
19+
expect(() => new StackFrame({ fileName: 'string', functionName: 'another string', lineNumber: 0, stackFrameLevel: 'another string' } as any)).toThrow();
2020
});
2121

2222
it('should convert arguments to an array if it is an object', () => {
@@ -174,7 +174,7 @@ describe('stackFrame', () => {
174174
});
175175

176176
it('should return empty string if fileName and lineNumber are falsy', () => {
177-
const result = (new StackFrame(<any>{ fileName: '', lineNumber: null })).getLocation();
177+
const result = (new StackFrame({ fileName: '', lineNumber: null } as any)).getLocation();
178178

179179
expect(result).toEqual('');
180180
});
@@ -184,23 +184,23 @@ describe('stackFrame', () => {
184184
it('should split on / and return last item', () => {
185185
const expectedFileName = 'drill.ts';
186186

187-
const result = new StackFrame(<any>{ fileName: `./this/is/not/a/${expectedFileName}`, lineNumber: null }).getLocation();
187+
const result = new StackFrame({ fileName: `./this/is/not/a/${expectedFileName}`, lineNumber: null } as any).getLocation();
188188

189189
expect(result).toEqual(expectedFileName);
190190
});
191191

192192
it('should split on \\ and return last item', () => {
193193
const expectedFileName = 'black.ts';
194194

195-
const result = new StackFrame(<any>{ fileName: `.\\this\\suit\\is\\not\\${expectedFileName}`, lineNumber: null }).getLocation();
195+
const result = new StackFrame({ fileName: `.\\this\\suit\\is\\not\\${expectedFileName}`, lineNumber: null } as any).getLocation();
196196

197197
expect(result).toEqual(expectedFileName);
198198
});
199199

200200
it('should return correct file name if neither \\ or / exist in string', () => {
201201
const expectedFileName = 'lettuce turnip the beat.ts';
202202

203-
const result = new StackFrame(<any>{ fileName: expectedFileName, lineNumber: null }).getLocation();
203+
const result = new StackFrame({ fileName: expectedFileName, lineNumber: null } as any).getLocation();
204204

205205
expect(result).toEqual(expectedFileName);
206206
});

src/events/events-api-client/event.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export enum EventType {
2323
RemoveStackKeyDefect = 'RemoveStackKeyDefect',
2424
StackKeyDefectStatusOpen = 'StackKeyDefectStatusOpen',
2525
StackKeyDefectStatusClosed = 'StackKeyDefectStatusClosed',
26-
StackKeyDefectStatusRegression = 'StackKeyDefectStatusRegression'
26+
StackKeyDefectStatusRegression = 'StackKeyDefectStatusRegression',
27+
StackKeyDefectStatusIgnored = 'StackKeyDefectStatusIgnored'
2728
}
2829

2930
export function createEvents(events: Array<EventResponseObject>): Array<Event> {

src/versions/versions-api-client/versions-api-client.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ describe('VersionsApiClient', () => {
232232
}];
233233
timer = jasmine.createSpy();
234234
timer.and.resolveTo(0);
235-
(<any>versionsApiClient)._timer = timer;
235+
(versionsApiClient as any)._timer = timer;
236236

237237
result = await versionsApiClient.postSymbols(
238238
database,
@@ -273,7 +273,7 @@ describe('VersionsApiClient', () => {
273273
});
274274

275275
it('should sleep between requests', () => {
276-
expect((<any>versionsApiClient)._timer).toHaveBeenCalledWith(1000);
276+
expect((versionsApiClient as any)._timer).toHaveBeenCalledWith(1000);
277277
});
278278

279279
it('should return response', () => {

0 commit comments

Comments
 (0)