Skip to content

Commit

Permalink
fix #1779, prioritize custom-resolve settings (done on bit-javascript)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfirst committed Jul 15, 2019
1 parent b087476 commit d4e67b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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
17 changes: 17 additions & 0 deletions e2e/flows/custom-module-resolutions.e2e.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,23 @@ 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.tagAllComponents();
Expand Down

0 comments on commit d4e67b8

Please sign in to comment.