Skip to content

Commit 8a21d54

Browse files
authored
Update jest to v30 and verdaccio to v6 (#1227)
1 parent 123361c commit 8a21d54

18 files changed

Lines changed: 2119 additions & 1457 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Tests: update verdaccio to v6",
4+
"packageName": "beachball",
5+
"email": "elcraig@microsoft.com",
6+
"dependentChangeType": "none"
7+
}

package.json

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,50 +46,38 @@
4646
"devDependencies": {
4747
"@eslint/compat": "^2.0.0",
4848
"@eslint/js": "^9.0.0",
49-
"@jest/globals": "^29.0.0",
49+
"@jest/globals": "^30.0.0",
5050
"@types/node": "^22.0.0",
5151
"@types/yargs-parser": "^21.0.0",
5252
"@typescript-eslint/utils": "^8.52.0",
5353
"depcheck": "^1.4.7",
5454
"eslint": "^9.0.0",
5555
"eslint-config-prettier": "^10.1.8",
5656
"husky": "^9.0.0",
57-
"jest": "^29.0.0",
57+
"jest": "^30.0.0",
5858
"lage": "^2.15.0",
5959
"lint-staged": "^16.0.0",
6060
"prettier": "~3.8.3",
6161
"syncpack": "^9.0.0",
62-
"ts-jest": "29.2.6",
62+
"ts-jest": "^29.4.0",
6363
"typescript": "~6.0.0",
6464
"typescript-eslint": "^8.52.0"
6565
},
6666
"resolutions": {
6767
"@types/node": "^22.0.0",
6868
"lodash": "^4.18.1",
69-
"body-parser/qs@6.11.0": "^6.14.2",
7069
"express/qs@6.11.0": "^6.14.2",
7170
"@cypress/request/qs@6.10.4": "^6.14.2",
7271
"syncpack/minimatch@6.2.0": "^6.2.3",
7372
"syncpack/semver@7.5.0": "^7.7.4",
74-
"verdaccio/handlebars@4.7.8": "^4.7.9",
75-
"verdaccio/js-yaml@4.1.0": "^4.1.0",
76-
"verdaccio/validator@13.11.0": "^13.15.22",
77-
"@verdaccio/config/js-yaml@4.1.0": "^4.1.0",
78-
"@verdaccio/config/minimatch@7.4.6": "^7.4.9",
79-
"@verdaccio/core/ajv@8.12.0": "^8.18.0",
80-
"@verdaccio/url/validator@13.11.0": "^13.15.22",
81-
"@verdaccio/utils/minimatch@7.4.6": "^7.4.9"
73+
"@verdaccio/core/ajv@8.17.1": "^8.18.0",
74+
"@verdaccio/core/ajv@8.18.0": "^8.18.0"
8275
},
8376
"rationale": {
84-
"devDependencies": {
85-
"ts-jest@29.2.6": "29.3.0 introduces type-fest v4 which requires node 16+"
86-
},
8777
"resolutions": {
8878
"lodash": "Unpin due to security issue",
8979
"*/qs": "Unpin due to security issue",
9080
"*/semver": "Unpin due to security issues",
91-
"*/verdaccio/*": "Unpin due to security issues",
92-
"*/@verdaccio/*/*": "Unpin due to security issues",
9381
"*/minimatch": "Unpin minimatch due to security issues"
9482
}
9583
}

packages/beachball/.depcheckrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ ignores:
1111
- 'eslint-*'
1212
- '@types/node'
1313
- '@jest/globals'
14+
# needed for type references from verdaccio (not listed in deps)
15+
- '@verdaccio/types'
16+
# needed for type references from @verdaccio/types
17+
- '@types/jsonwebtoken'

packages/beachball/package.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,19 @@
4848
},
4949
"devDependencies": {
5050
"@microsoft/beachball-scripts": "1.0.0",
51+
"@types/jsonwebtoken": "^9.0.10",
5152
"@types/minimatch": "^3.0.0",
5253
"@types/prompts": "^2.4.2",
5354
"@types/semver": "^7.3.13",
5455
"@types/tmp": "^0.2.3",
5556
"@types/yargs-parser": "^21.0.0",
57+
"@verdaccio/types": "^13.0.0",
5658
"get-port": "^5.0.0",
5759
"normalized-tmpdir": "1.0.1",
5860
"strip-ansi": "^6.0.1",
5961
"tmp": "^0.2.1",
60-
"verdaccio": "5.29.2",
61-
"verdaccio-auth-memory": "10.2.2",
62-
"verdaccio-memory": "10.3.2"
63-
},
64-
"rationale": {
65-
"devDependencies": {
66-
"verdaccio-auth-memory@10.2.2": "node 18 required by newer version",
67-
"verdaccio-memory@10.3.2": "node 18 required by newer version"
68-
}
62+
"verdaccio": "^6.5.2",
63+
"verdaccio-auth-memory": "^13.0.0",
64+
"verdaccio-memory": "^10.4.3"
6965
}
7066
}

packages/beachball/src/__fixtures__/mockNpm.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
_mockNpmPublish,
1515
_mockNpmShow,
1616
type MockNpmResult,
17+
type MockNpmCommand,
1718
} from './mockNpm';
1819
import * as readJsonModule from '../object/readJson';
1920

@@ -505,15 +506,15 @@ describe('mockNpm', () => {
505506
const fakePublishResult = 'hi';
506507

507508
it('respects mocked command override', async () => {
508-
const mockPublish = jest.fn(() => Promise.resolve(fakePublishResult as unknown as MockNpmResult));
509+
const mockPublish = jest.fn<MockNpmCommand>(() => Promise.resolve(fakePublishResult as unknown as MockNpmResult));
509510
npmMock.setCommandOverride('publish', mockPublish);
510511
const result = await npm(['publish', 'foo'], { cwd: '' });
511512
expect(result).toEqual(fakePublishResult);
512513
expect(mockPublish).toHaveBeenCalledWith(expect.any(Object), ['foo'], { cwd: '' });
513514
});
514515

515516
it("respects extra mocked command that's not normally supported", async () => {
516-
const mockFoo = jest.fn(() => Promise.resolve('hi' as unknown as MockNpmResult));
517+
const mockFoo = jest.fn<MockNpmCommand>(() => Promise.resolve('hi' as unknown as MockNpmResult));
517518
npmMock.setCommandOverride('foo', mockFoo);
518519
const result = await npm(['foo'], { cwd: '' });
519520
expect(result).toEqual('hi');

packages/beachball/src/__fixtures__/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export class Registry {
270270
configBuilder.addLogger({
271271
type: 'file',
272272
level: 'trace',
273-
format: 'file',
273+
format: 'pretty',
274274
path: path.join(process.cwd(), `verdaccio-${Date.now()}.log`),
275275
});
276276
}

packages/beachball/src/__functional__/changelog/__snapshots__/writeChangelog.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`writeChangelog generates basic changelog: changelog md 1`] = `
44
"# Change Log - foo

packages/beachball/src/__functional__/commands/__snapshots__/publish.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`publish command logs expected output for a standard publish flow 1`] = `
44
"[log]

packages/beachball/src/__functional__/packageManager/packagePublish.test.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ const testPackage = { name: testName, version: testVersion };
2424
// The rest mock npm calls for efficiency (but could potentially be updated to use real npm if
2525
// a bug is found that would have been caught that way).
2626
//
27-
// TODO: re-enable when jest and verdaccio are updated
28-
// eslint-disable-next-line no-restricted-properties
29-
describe.skip('packagePublish', () => {
27+
describe('packagePublish', () => {
3028
let npmSpy: jest.SpiedFunction<typeof npm>;
31-
let npmVersion: string;
3229
let tempRoot: string;
3330
let tempPackageJsonPath: string;
3431
/**
@@ -91,8 +88,6 @@ describe.skip('packagePublish', () => {
9188
tempRoot = tmpdir();
9289
tempPackageJsonPath = path.join(tempRoot, 'package.json');
9390
writeJson(tempPackageJsonPath, testPackage);
94-
95-
npmVersion = (await npmModule.npm(['--version'], { cwd: tempRoot })).stdout.trim() || '';
9691
});
9792

9893
beforeEach(async () => {
@@ -188,12 +183,6 @@ describe.skip('packagePublish', () => {
188183
});
189184

190185
it('handles auth error and does not retry', async () => {
191-
// TODO: remove condition once node version is upgraded (this test doesn't work with npm 6 because
192-
// that version seems to allow truly anonymous publishing with verdaccio)
193-
if (npmVersion.startsWith('6.')) {
194-
console.warn('Skipping auth error test on npm 6');
195-
return;
196-
}
197186
await registry.logout();
198187

199188
const testPackageInfo = getTestPackageInfo();

packages/beachball/src/__functional__/publish/__snapshots__/publishToRegistry.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`publishToRegistry includes new packages not modified 1`] = `
44
"[log] Validating new package versions...

0 commit comments

Comments
 (0)