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

Update dependencies #734

Merged
merged 5 commits into from
Mar 1, 2024
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: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
fail-fast: false
matrix:
node-version:
- 21
- 20
- 18
steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"exit-hook": "^4.0.0",
"github-url-from-git": "^1.5.0",
"hosted-git-info": "^7.0.1",
"ignore-walk": "^6.0.3",
"ignore-walk": "^6.0.4",
"import-local": "^3.1.0",
"inquirer": "^9.2.15",
"is-installed-globally": "^1.0.0",
Expand All @@ -52,7 +52,7 @@
"listr": "^0.14.3",
"listr-input": "^0.2.1",
"log-symbols": "^6.0.0",
"meow": "^13.1.0",
"meow": "^13.2.0",
"new-github-release-url": "^2.0.0",
"npm-name": "^8.0.0",
"onetime": "^7.0.0",
Expand All @@ -71,12 +71,12 @@
"update-notifier": "^7.0.0"
},
"devDependencies": {
"@sindresorhus/is": "^6.1.0",
"@sindresorhus/is": "^6.2.0",
"@types/semver": "^7.5.8",
"ava": "^5.3.1",
"ava": "^6.1.2",
"common-tags": "^1.8.2",
"esmock": "^2.6.3",
"fs-extra": "^11.1.1",
"esmock": "^2.6.4",
"fs-extra": "^11.2.0",
"map-obj": "^5.0.2",
"sinon": "^17.0.1",
"strip-ansi": "^7.1.0",
Expand Down
1 change: 0 additions & 1 deletion source/cli-implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export async function getOptions() {

const runPublish = !flags.releaseDraftOnly && flags.publish && !package_.private;

// TODO: does this need to run if `runPublish` is false?
const availability = runPublish ? await npm.isPackageNameAvailable(package_) : {
isAvailable: false,
isUnknown: false,
Expand Down
1 change: 0 additions & 1 deletion source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ const np = async (input = 'patch', options, {package_, rootDirectory}) => {
return '[Preview] GitHub Releases draft will not be opened in preview mode.';
}
},
// TODO: parse version outside of index
task: () => releaseTaskHelper(options, package_, packageManager),
}] : [],
], {
Expand Down
4 changes: 1 addition & 3 deletions test/git-util/verify-remote-history-is-clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ test('clean fetched remote history', createStubFixture, [
test('no remote', createIntegrationFixture, async () => {
//
}, async ({t, testedModule: {verifyRemoteHistoryIsClean}}) => {
const result = await t.notThrowsAsync(
await t.notThrowsAsync(
verifyRemoteHistoryIsClean(),
);

t.is(result, undefined);
});
114 changes: 49 additions & 65 deletions test/npm/util/collaborators.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,76 +13,60 @@ test('package.name not a string', async t => {
);
});

const npmVersionFixtures = [
{version: '9.0.0', accessCommand: 'npm access list collaborators np --json'},
];
const accessCommand = (name = 'np') => `npm access list collaborators ${name} --json`;

for (const {version, accessCommand} of npmVersionFixtures) {
const npmVersionCommand = {
command: 'npm --version',
stdout: version,
};
const collaboratorsStdout = stripIndent`
{
"sindresorhus": "read-write",
"samverschueren": "read-write",
"itaisteinherz": "read-write"
}
`;

const collaboratorsStdout = stripIndent`
{
"sindresorhus": "read-write",
"samverschueren": "read-write",
"itaisteinherz": "read-write"
}
`;
test('main', createFixture, [{
command: accessCommand(),
stdout: collaboratorsStdout,
}], async ({t, testedModule: {collaborators}}) => {
t.deepEqual(
await collaborators({name: 'np'}),
collaboratorsStdout,
);
});

test(`npm v${version}`, createFixture, [
npmVersionCommand,
{
command: accessCommand,
stdout: collaboratorsStdout,
// TODO: this is timing out, seemingly the command isn't matching for Sinon
// eslint-disable-next-line ava/no-skip-test
test.skip('external registry', createFixture, [{
command: `${accessCommand()} --registry http://my-internal-registry.local`,
stdout: collaboratorsStdout,
}], async ({t, testedModule: {collaborators}}) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test is behaving weirdly. It's passing, but afterwards it hangs and causes the test file to timeout.

Copy link
Owner

Choose a reason for hiding this comment

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

AVA 6 changed to no longer force exit the process at the end, which may be related.

const output = await collaborators({
name: 'np',
publishConfig: {
registry: 'http://my-internal-registry.local',
},
], async ({t, testedModule: {collaborators}}) => {
t.deepEqual(
await collaborators({name: 'np'}),
collaboratorsStdout,
);
});

test(`npm v${version} - external registry`, createFixture, [
npmVersionCommand,
{
command: `${accessCommand} --registry http://my-internal-registry.local`,
stdout: collaboratorsStdout,
},
], async ({t, testedModule: {collaborators}}) => {
t.deepEqual(
await collaborators({
name: 'np',
publishConfig: {
registry: 'http://my-internal-registry.local',
},
}),
collaboratorsStdout,
);
});
t.deepEqual(
JSON.parse(output),
JSON.parse(collaboratorsStdout),
);
});

test(`npm v${version} - non-existent`, createFixture, [
npmVersionCommand,
{
command: 'npm access list collaborators non-existent --json',
stderr: 'npm ERR! code E404\nnpm ERR! 404 Not Found',
},
], async ({t, testedModule: {collaborators}}) => {
t.is(
await collaborators({name: 'non-existent'}),
false,
);
});
test('non-existent', createFixture, [{
command: accessCommand('non-existent'),
stderr: 'npm ERR! code E404\nnpm ERR! 404 Not Found',
}], async ({t, testedModule: {collaborators}}) => {
t.is(
await collaborators({name: 'non-existent'}),
false,
);
});

test('error', createFixture, [{
command: accessCommand('@private/pkg'),
stderr: 'npm ERR! code E403\nnpm ERR! 403 403 Forbidden',
}], async ({t, testedModule: {collaborators}}) => {
const {stderr} = await t.throwsAsync(collaborators({name: '@private/pkg'}));
t.is(stderr, 'npm ERR! code E403\nnpm ERR! 403 403 Forbidden');
});

test(`npm v${version} - error`, createFixture, [
npmVersionCommand,
{
command: 'npm access list collaborators @private/pkg --json',
stderr: 'npm ERR! code E403\nnpm ERR! 403 403 Forbidden',
},
], async ({t, testedModule: {collaborators}}) => {
const {stderr} = await t.throwsAsync(collaborators({name: '@private/pkg'}));
t.is(stderr, 'npm ERR! code E403\nnpm ERR! 403 403 Forbidden');
});
}