Skip to content

Conversation

@stekovinbranturry
Copy link
Contributor

@stekovinbranturry stekovinbranturry commented Feb 21, 2024

Fixes #23

@tommy-mitchell
Copy link
Contributor

Can you add tests for the await removePackageDependencies({ dependencies: [ 'myDependency' ] }); style usage?

@stekovinbranturry
Copy link
Contributor Author

Can you add tests for the await removePackageDependencies({ dependencies: [ 'myDependency' ] }); style usage?

added

@sindresorhus
Copy link
Owner

It would be better to add a new test than modify existing tests.

@stekovinbranturry
Copy link
Contributor Author

It would be better to add a new test than modify existing tests.

test('async - multiple types') is literally for the case await removePackageDependencies(Record<DependencyKey, Dependency[]>), do we really need another case?

packageJson = await readPackage({cwd: temporary, normalize: false});

t.deepEqual(packageJson, omit(fixture, ['dependencies', 'devDependencies.bar']));
t.deepEqual(packageJson, pick(fixture, ['name']));
Copy link
Owner

Choose a reason for hiding this comment

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

Feels simpler to just do this:

Suggested change
t.deepEqual(packageJson, pick(fixture, ['name']));
t.deepEqual(packageJson, {name: fixture.name}));

@sindresorhus
Copy link
Owner

sindresorhus commented Feb 23, 2024

The test already does too much. Large tests often hide bugs since they do too much. Not a big issue in this case, but having smaller tests would make it clearer. I guess that could be done later though.

@stekovinbranturry
Copy link
Contributor Author

The test already does too much. Large tests often hide bugs since they do too much. Not a big issue in this case, but having smaller tests would make it clearer. I guess that could be done later though.

yes, it will be better, i've already add a new case

@sindresorhus sindresorhus merged commit 0a95c28 into sindresorhus:main Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

removePackageDependencies doesn't remove if there are multiple dependency types

3 participants