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

ref: update jest #468

Merged
merged 1 commit into from
Jul 5, 2023
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 builder.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12-buster-slim as builder
FROM node:14-buster-slim as builder

WORKDIR /usr/local/lib

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@types/cli-table": "^0.3.0",
"@types/git-url-parse": "^9.0.0",
"@types/is-ci": "^2.0.0",
"@types/jest": "^26.0.14",
"@types/jest": "^29.5.2",
"@types/js-yaml": "^4.0.5",
"@types/mkdirp": "^1.0.0",
"@types/node": "^12.11.1",
Expand Down Expand Up @@ -62,7 +62,7 @@
"fast-xml-parser": "^4.2.4",
"git-url-parse": "^11.4.4",
"is-ci": "^2.0.0",
"jest": "^26.5.3",
"jest": "^29.6.0",
"js-yaml": "4.1.0",
"json-schema-to-typescript": "5.7.0",
"mkdirp": "^1.0.4",
Expand All @@ -81,8 +81,8 @@
"string-length": "3.1.0",
"tar": "4.4.18",
"tmp": "0.1.0",
"ts-jest": "^26.5.5",
"typescript": "^4.1.3",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6",
"unzipper": "0.10.11",
"yargs": "15.4.1"
},
Expand Down
12 changes: 6 additions & 6 deletions src/artifact_providers/__tests__/github.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('GitHub Artifact Provider', () => {
'1b843f2cbb20fdda99ef749e29e75e43e6e43b38'
)
).resolves.toMatchInlineSnapshot(`
Object {
{
"archive_download_url": "https://api.github.com/repos/getsentry/craft/actions/artifacts/60233710/zip",
"created_at": "2021-05-12T21:50:35Z",
"expired": false,
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('GitHub Artifact Provider', () => {
'1b843f2cbb20fdda99ef749e29e75e43e6e43b38'
)
).resolves.toMatchInlineSnapshot(`
Object {
{
"archive_download_url": "https://api.github.com/repos/getsentry/craft/actions/artifacts/60233710/zip",
"created_at": "2021-05-12T21:50:35Z",
"expired": false,
Expand Down Expand Up @@ -224,7 +224,7 @@ describe('GitHub Artifact Provider', () => {
'1b843f2cbb20fdda99ef749e29e75e43e6e43b38'
)
).resolves.toMatchInlineSnapshot(`
Object {
{
"archive_download_url": "https://api.github.com/repos/getsentry/craft/actions/artifacts/60233710/zip",
"created_at": "2021-05-12T21:50:35Z",
"expired": false,
Expand Down Expand Up @@ -253,7 +253,7 @@ describe('GitHub Artifact Provider', () => {
'1b843f2cbb20fdda99ef749e29e75e43e6e43b38'
)
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Can't find any artifacts for revision \\"1b843f2cbb20fdda99ef749e29e75e43e6e43b38\\" (tries: 3)"`
`"Can't find any artifacts for revision "1b843f2cbb20fdda99ef749e29e75e43e6e43b38" (tries: 3)"`
);

expect(mockClient.actions.listArtifactsForRepo).toBeCalledTimes(3);
Expand Down Expand Up @@ -302,7 +302,7 @@ describe('GitHub Artifact Provider', () => {
'3c2e87573d3bd16f61cf08fece0638cc47a4fc22'
)
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Can't find any artifacts for revision \\"3c2e87573d3bd16f61cf08fece0638cc47a4fc22\\" (tries: 3)"`
`"Can't find any artifacts for revision "3c2e87573d3bd16f61cf08fece0638cc47a4fc22" (tries: 3)"`
);
expect(sleep).toBeCalledTimes(2);
});
Expand Down Expand Up @@ -365,7 +365,7 @@ describe('GitHub Artifact Provider', () => {
})
)
).resolves.toMatchInlineSnapshot(`
Object {
{
"archive_download_url": "https://api.github.com/repos/getsentry/craft/actions/artifacts/60233710/zip",
"created_at": "2021-05-12T21:50:35Z",
"expired": false,
Expand Down
2 changes: 1 addition & 1 deletion src/artifact_providers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export abstract class BaseArtifactProvider {
): Promise<RemoteArtifact[]> {
this.logger.debug(`Fetching artifact list for revision \`${revision}\`.`);
// check the cache first
if (this.fileListCache[revision]) {
if (revision in this.fileListCache) {
this.logger.debug(`Found list in cache.`);
} else {
// Cache the promise immediately to cause any subsequent calls during the
Expand Down
2 changes: 1 addition & 1 deletion src/targets/__tests__/pubDev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ describe('createCredentialsFile', () => {
`/usr/Library/Application Support/dart/pub-credentials.json`
);
expect(content).toMatchInlineSnapshot(
`"{\\"accessToken\\":\\"my_default_value\\",\\"refreshToken\\":\\"my_default_value\\",\\"tokenEndpoint\\":\\"https://accounts.google.com/o/oauth2/token\\",\\"scopes\\":[\\"openid\\",\\"https://www.googleapis.com/auth/userinfo.email\\"],\\"expiration\\":1645564942000}"`
`"{"accessToken":"my_default_value","refreshToken":"my_default_value","tokenEndpoint":"https://accounts.google.com/o/oauth2/token","scopes":["openid","https://www.googleapis.com/auth/userinfo.email"],"expiration":1645564942000}"`
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/targets/__tests__/symbolCollector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('publish', () => {
>).mock.calls[0] as string[];
expect(cmd).toBe(SYM_COLLECTOR_BIN_NAME);
expect(args).toMatchInlineSnapshot(`
Array [
[
"--upload",
"directory",
"--path",
Expand Down
4 changes: 3 additions & 1 deletion src/utils/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ export async function withRetry<T>(
}
}
}
if (tries >= maxRetries) {
if (typeof error === 'undefined') {
throw new Error(`maxRetries must be >= 1: ${maxRetries}`);
} else if (tries >= maxRetries) {
throw new RetryError(`Max retries reached: ${maxRetries}`, error);
} else {
throw new RetryError('Cancelled retry', error);
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"noImplicitThis": false,
"esModuleInterop": true,
"importHelpers": true,
"noEmitHelpers": false
"noEmitHelpers": false,
"useUnknownInCatchVariables": false
Copy link
Member Author

Choose a reason for hiding this comment

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

there's a bunch of (admittedly correct) errors about not narrowing error in catch blocks -- going to leave those for another day

},
"include": ["src/**/*.ts"],
"exclude": ["dist/**/*", "**/__mocks__/**", "**/__tests__/**"]
Expand Down
Loading
Loading