Skip to content

Commit

Permalink
fix(js): resolve shallow dependencies when building package.json (#10600
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mckramer committed Jun 6, 2022
1 parent 5c9abff commit a0bf1f0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
43 changes: 43 additions & 0 deletions packages/js/src/utils/check-dependencies.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { calculateProjectDependencies } from '@nrwl/workspace/src/utilities/buildable-libs-utils';
import { checkDependencies } from './check-dependencies';

jest.mock('@nrwl/workspace/src/utilities/buildable-libs-utils');

describe('checkDependencies', () => {
test('collects shallow dependencies', () => {
const mockedCalculateProjectDependencies = jest.mocked(
calculateProjectDependencies
);
mockedCalculateProjectDependencies.mockReturnValueOnce({
target: {
name: 'example',
type: 'lib',
data: {},
},
dependencies: [],
nonBuildableDependencies: [],
topLevelDependencies: [],
});

checkDependencies(
{
root: 'root',
projectName: 'example',
targetName: 'build',
cwd: '?',
workspace: null,
isVerbose: false,
},
'pathToTsConfig.json'
);

expect(calculateProjectDependencies).toBeCalledWith(
expect.anything(),
'root',
'example',
'build',
undefined,
true
);
});
});
3 changes: 2 additions & 1 deletion packages/js/src/utils/check-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export function checkDependencies(
context.root,
context.projectName,
context.targetName,
context.configurationName
context.configurationName,
true
);
const projectRoot = target.data.root;

Expand Down

0 comments on commit a0bf1f0

Please sign in to comment.