-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update main (7.x) * Update e2e-ci.yml * Update e2e-ci.yml * Update e2e-ci.yml
- Loading branch information
1 parent
33c158a
commit ead64af
Showing
204 changed files
with
3,290 additions
and
4,721 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20 | ||
23 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { afterAll, beforeAll, describe, expect, test } from 'vitest'; | ||
|
||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons'; | ||
|
||
export function runAudit(npm) { | ||
describe('audit a package', () => { | ||
let registry; | ||
|
||
beforeAll(async () => { | ||
const setup = await initialSetup(); | ||
registry = setup.registry; | ||
await registry.init(); | ||
}); | ||
|
||
test.each([['verdaccio-memory', '@verdaccio/cli']])( | ||
'should audit a package %s', | ||
async (pkgName) => { | ||
const { tempFolder } = await prepareGenericEmptyProject( | ||
pkgName, | ||
'1.0.0-patch', | ||
registry.port, | ||
registry.getToken(), | ||
registry.getRegistryUrl(), | ||
{ jquery: '3.6.1' } | ||
); | ||
// install is required to create package lock file | ||
await npm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl())); | ||
const resp = await npm( | ||
{ cwd: tempFolder }, | ||
'audit', | ||
'--json', | ||
...addRegistry(registry.getRegistryUrl()) | ||
); | ||
const parsedBody = JSON.parse(resp.stdout as string); | ||
expect(parsedBody.metadata).toBeDefined(); | ||
expect(parsedBody.auditReportVersion).toBeDefined(); | ||
expect(parsedBody.vulnerabilities).toBeDefined(); | ||
} | ||
); | ||
|
||
afterAll(async () => { | ||
registry.stop(); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import { afterAll, beforeAll, describe, expect, test } from 'vitest'; | ||
|
||
import { | ||
addRegistry, | ||
initialSetup, | ||
npmUtils, | ||
prepareGenericEmptyProject, | ||
} from '@verdaccio/test-cli-commons'; | ||
|
||
export function runDeprecate(npm) { | ||
describe('deprecate a package', () => { | ||
let registry; | ||
|
||
async function deprecate(tempFolder, packageVersion, registry, message) { | ||
await npm( | ||
{ cwd: tempFolder }, | ||
'deprecate', | ||
packageVersion, | ||
message, | ||
'--json', | ||
...addRegistry(registry.getRegistryUrl()) | ||
); | ||
} | ||
|
||
beforeAll(async () => { | ||
const setup = await initialSetup(); | ||
registry = setup.registry; | ||
await registry.init(); | ||
}); | ||
|
||
test.each([['@verdaccio/deprecated-1']])( | ||
'should deprecate a single package %s', | ||
async (pkgName) => { | ||
const message = 'some message'; | ||
const { tempFolder } = await prepareGenericEmptyProject( | ||
pkgName, | ||
'1.0.0', | ||
registry.port, | ||
registry.getToken(), | ||
registry.getRegistryUrl() | ||
); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
// deprecate one version | ||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message); | ||
// verify is deprecated | ||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry); | ||
expect(infoBody.name).toEqual(pkgName); | ||
expect(infoBody.deprecated).toEqual(message); | ||
} | ||
); | ||
|
||
test.each([['@verdaccio/deprecated-2']])( | ||
'should un-deprecate a package %s', | ||
async (pkgName) => { | ||
const message = 'some message'; | ||
const { tempFolder } = await prepareGenericEmptyProject( | ||
pkgName, | ||
'1.0.0', | ||
registry.port, | ||
registry.getToken(), | ||
registry.getRegistryUrl() | ||
); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
// deprecate one version | ||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message); | ||
// verify is deprecated | ||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry); | ||
expect(infoBody.deprecated).toEqual(message); | ||
// empty string is same as undeprecate | ||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, ''); | ||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry); | ||
expect(infoBody2.deprecated).toBeUndefined(); | ||
} | ||
); | ||
|
||
test.each([['@verdaccio/deprecated-3']])( | ||
'should deprecate a multiple packages %s', | ||
async (pkgName) => { | ||
const message = 'some message'; | ||
const { tempFolder } = await prepareGenericEmptyProject( | ||
pkgName, | ||
'1.0.0', | ||
registry.port, | ||
registry.getToken(), | ||
registry.getRegistryUrl() | ||
); | ||
// publish 1.0.0 | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
// publish 1.1.0 | ||
await npmUtils.bumbUp(npm, tempFolder, registry); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
// publish 1.2.0 | ||
await npmUtils.bumbUp(npm, tempFolder, registry); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
// publish 1.3.0 | ||
await npmUtils.bumbUp(npm, tempFolder, registry); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
// // deprecate all version | ||
await deprecate(tempFolder, pkgName, registry, message); | ||
// verify is deprecated | ||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) { | ||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry); | ||
expect(infoResp.deprecated).toEqual(message); | ||
} | ||
// publish normal version | ||
// publish 1.4.0 | ||
await npmUtils.bumbUp(npm, tempFolder, registry); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@1.4.0`, registry); | ||
// must be not deprecated | ||
expect(infoResp.deprecated).toBeUndefined(); | ||
} | ||
); | ||
|
||
afterAll(async () => { | ||
registry.stop(); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { afterAll, beforeAll, describe, expect, test } from 'vitest'; | ||
|
||
import { | ||
addRegistry, | ||
initialSetup, | ||
npmUtils, | ||
prepareGenericEmptyProject, | ||
} from '@verdaccio/test-cli-commons'; | ||
|
||
export function runDistTag(npm) { | ||
describe('dist-tag a package', () => { | ||
let registry; | ||
|
||
beforeAll(async () => { | ||
const setup = await initialSetup(); | ||
registry = setup.registry; | ||
await registry.init(); | ||
}); | ||
|
||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => { | ||
const { tempFolder } = await prepareGenericEmptyProject( | ||
pkgName, | ||
'1.0.0', | ||
registry.port, | ||
registry.getToken(), | ||
registry.getRegistryUrl() | ||
); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
await npmUtils.bumbUp(npm, tempFolder, registry); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']); | ||
const resp2 = await npm( | ||
{ cwd: tempFolder }, | ||
'dist-tag', | ||
'ls', | ||
'--json', | ||
...addRegistry(registry.getRegistryUrl()) | ||
); | ||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0'); | ||
}); | ||
|
||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => { | ||
const { tempFolder } = await prepareGenericEmptyProject( | ||
pkgName, | ||
'1.0.0', | ||
registry.port, | ||
registry.getToken(), | ||
registry.getRegistryUrl() | ||
); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
await npmUtils.bumbUp(npm, tempFolder, registry); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']); | ||
const resp2 = await npm( | ||
{ cwd: tempFolder }, | ||
'dist-tag', | ||
'rm', | ||
`${pkgName}@1.1.0`, | ||
'beta', | ||
...addRegistry(registry.getRegistryUrl()) | ||
); | ||
expect(resp2.stdout).toEqual('-beta: @verdaccio/[email protected]'); | ||
}); | ||
|
||
test.each([['@verdaccio/five']])( | ||
'should add tag to package and version with dist-tags for %s', | ||
async (pkgName) => { | ||
const { tempFolder } = await prepareGenericEmptyProject( | ||
pkgName, | ||
'1.0.0', | ||
registry.port, | ||
registry.getToken(), | ||
registry.getRegistryUrl() | ||
); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
await npmUtils.bumbUp(npm, tempFolder, registry); | ||
await npmUtils.publish(npm, tempFolder, pkgName, registry); | ||
const resp2 = await npm( | ||
{ cwd: tempFolder }, | ||
'dist-tag', | ||
'add', | ||
`${pkgName}@1.1.0`, | ||
'alfa', | ||
...addRegistry(registry.getRegistryUrl()) | ||
); | ||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`); | ||
} | ||
); | ||
|
||
afterAll(async () => { | ||
registry.stop(); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export { runAudit } from './audit'; | ||
export { runDeprecate } from './deprecate'; | ||
export { runInstall } from './install'; | ||
export { runInfo } from './info'; | ||
export { runPing } from './ping'; | ||
export { runPublish } from './publish'; | ||
export { runSearch } from './search'; | ||
export { runStar } from './star'; | ||
export { runUnpublish } from './unpublish'; | ||
export { runDistTag } from './dist-tags'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { afterAll, beforeAll, describe, expect, test } from 'vitest'; | ||
|
||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons'; | ||
|
||
export function runInfo(npm) { | ||
describe('install a package', () => { | ||
let registry; | ||
|
||
beforeAll(async () => { | ||
const setup = await initialSetup(); | ||
registry = setup.registry; | ||
await registry.init(); | ||
}); | ||
|
||
test('should run npm info json body', async () => { | ||
const resp = await npm( | ||
{}, | ||
'info', | ||
'verdaccio', | ||
'--json', | ||
...addRegistry(registry.getRegistryUrl()) | ||
); | ||
const parsedBody = JSON.parse(resp.stdout as string); | ||
expect(parsedBody.name).toEqual('verdaccio'); | ||
expect(parsedBody.dependencies).toBeDefined(); | ||
}); | ||
|
||
afterAll(async () => { | ||
registry.stop(); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.