Skip to content

Commit

Permalink
Merge c7f45a2 into b087476
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfirst authored Jul 16, 2019
2 parents b087476 + c7f45a2 commit 42ad387
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

- [#1779](https://github.com/teambit/bit/issues/1779) update bit-javascript to prioritize custom-resolve settings
- [#1808](https://github.com/teambit/bit/issues/1808) support adding dist-path-template as a package-json value, which gets replaced with the calculated dist path upon import
- update execa to v2.0.3
- [#1792](https://github.com/teambit/bit/issues/1792) don't generate entry-point files for nested dependencies when their `package.json` is written
Expand Down
20 changes: 20 additions & 0 deletions e2e/flows/custom-module-resolutions.e2e.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ describe('custom module resolutions', function () {
});
});
describe('using alias', () => {
let scopeAfterAdding;
before(() => {
helper.setNewLocalAndRemoteScopes();
const bitJson = helper.readBitJson();
Expand All @@ -451,6 +452,7 @@ describe('custom module resolutions', function () {
helper.addComponent('src/utils/is-type.js', { i: 'utils/is-type' });
helper.addComponent('src/utils/is-string.js', { i: 'utils/is-string' });
helper.addComponent('src/bar/foo.js', { i: 'bar/foo' });
scopeAfterAdding = helper.cloneLocalScope();
});
it('bit status should not warn about missing packages', () => {
const output = helper.runCmd('bit status');
Expand All @@ -466,8 +468,26 @@ describe('custom module resolutions', function () {
expect(dependency.relativePaths[0].importSource).to.equal('@/utils/is-string');
expect(dependency.relativePaths[0].isCustomResolveUsed).to.be.true;
});
describe('when there is already a package with the same name of the alias and is possible to resolve to the package', () => {
before(() => {
helper.addNpmPackage('@'); // makes sure the package is there
helper.outputFile('node_modules/@/utils/is-string.js', ''); // makes sure it's possible to resolve to the package
});
// @see https://github.com/teambit/bit/issues/1779
it('should still resolve to the custom-resolve and not to the package', () => {
const output = helper.showComponentParsed('bar/foo');
expect(output.dependencies).to.have.lengthOf(1);
const dependency = output.dependencies[0];
expect(dependency.id).to.equal('utils/is-string');
expect(dependency.relativePaths[0].sourceRelativePath).to.equal('src/utils/is-string.js');
expect(dependency.relativePaths[0].destinationRelativePath).to.equal('src/utils/is-string.js');
expect(dependency.relativePaths[0].importSource).to.equal('@/utils/is-string');
expect(dependency.relativePaths[0].isCustomResolveUsed).to.be.true;
});
});
describe('importing the component', () => {
before(() => {
helper.getClonedLocalScope(scopeAfterAdding);
helper.tagAllComponents();
helper.exportAllComponents();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"array-difference": "^0.0.1",
"async-exit-hook": "^2.0.1",
"babel-runtime": "^6.23.0",
"bit-javascript": "^2.0.12-angular.3",
"bit-javascript": "^2.0.12-dev.1",
"bluebird": "^3.5.3",
"chalk": "^2.4.1",
"chokidar": "^2.0.3",
Expand Down

0 comments on commit 42ad387

Please sign in to comment.