Skip to content

Commit

Permalink
fix(lift): prevent error when no dependencies are provided in results…
Browse files Browse the repository at this point in the history
… passed to lifter
  • Loading branch information
travi committed Jan 16, 2025
1 parent f042029 commit cee8a20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lift/lift.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default async function ({projectRoot, vcs, results, pathWithinParent, enh
const {
scripts,
tags,
dependencies,
dependencies: {javascript: dependencies} = {},
packageManager: manager
} = results;

Expand Down Expand Up @@ -51,7 +51,7 @@ export default async function ({projectRoot, vcs, results, pathWithinParent, enh

await liftPackage(
deepmerge.all([
{projectRoot, scripts, tags, dependencies: dependencies.javascript, packageManager, vcs, pathWithinParent},
{projectRoot, scripts, tags, dependencies, packageManager, vcs, pathWithinParent},
enhancerResults
])
);
Expand Down
9 changes: 7 additions & 2 deletions src/lift/lift.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ describe('lift', () => {
const tags = any.listOf(any.word);
const javascriptDependencies = any.simpleObject();
const dependencies = {...any.simpleObject(), javascript: javascriptDependencies};
const devDependencies = any.listOf(any.word);
const packageManager = any.word();
const manager = any.word();
const enhancerResults = any.simpleObject();
const vcsDetails = any.simpleObject();
const results = {...any.simpleObject(), scripts, tags, dependencies, devDependencies, packageManager: manager};
const results = {...any.simpleObject(), scripts, tags, dependencies, packageManager: manager};
const pathWithinParent = any.string();
const packageDetails = any.simpleObject();
const internalEnhancers = {
Expand Down Expand Up @@ -106,4 +105,10 @@ describe('lift', () => {

expect(liftResults).toEqual(enhancerResults);
});

it('should not error when no dependencies are provided', async () => {
core.applyEnhancers.mockResolvedValue(enhancerResults);

await lift({projectRoot, vcs: vcsDetails, results: any.simpleObject(), pathWithinParent});
});
});

0 comments on commit cee8a20

Please sign in to comment.