-
Notifications
You must be signed in to change notification settings - Fork 936
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into aspects-loading-fixes
- Loading branch information
Showing
54 changed files
with
649 additions
and
514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,13 +20,17 @@ import NpmCiRegistry, { supportNpmCiRegistryTesting } from '../npm-ci-registry'; | |
npmCiRegistry.configureCiInPackageJsonHarmony(); | ||
helper.fixtures.populateComponents(3); | ||
scope = `@${helper.scopes.remote.replace('.', '/')}.`; | ||
helper.fs.outputFile(`comp1/index.js`, `const comp3 = require("${scope}comp3");`); | ||
helper.fs.outputFile(`comp2/index.js`, `const comp3 = require("${scope}comp3");`); | ||
helper.command.install(); | ||
const code = `const comp3 = require("${scope}comp3"); | ||
const isPositive = require('is-positive'); | ||
`; | ||
helper.fs.outputFile(`comp1/index.js`, code); | ||
helper.fs.outputFile(`comp2/index.js`, code); | ||
helper.command.install('[email protected]'); | ||
helper.command.compile(); | ||
helper.command.tagComponent('comp3 comp1'); | ||
helper.command.export(); | ||
helper.command.removeComponent('comp1'); | ||
helper.command.install('[email protected] --update-existing'); | ||
helper.command.tagComponent('comp3 comp2', undefined, '--unmodified'); | ||
helper.command.export(); | ||
|
||
|
@@ -37,14 +41,22 @@ import NpmCiRegistry, { supportNpmCiRegistryTesting } from '../npm-ci-registry'; | |
helper.command.import(`${helper.scopes.remote}/comp1`); | ||
helper.command.import(`${helper.scopes.remote}/comp2`); | ||
}); | ||
it('should install dependencies from their respective models to the imported components', () => { | ||
it('should install component dependencies from their respective models to the imported components', () => { | ||
expect(helper.fs.readJsonFile(`node_modules/${scope}comp3/package.json`).version).to.eq('0.0.1'); | ||
expect( | ||
helper.fs.readJsonFile( | ||
path.join(helper.scopes.remoteWithoutOwner, `comp2/node_modules/${scope}comp3/package.json`) | ||
).version | ||
).to.eq('0.0.2'); | ||
}); | ||
it('should install package dependencies from their respective models to the imported components', () => { | ||
expect(helper.fs.readJsonFile(`node_modules/is-positive/package.json`).version).to.eq('1.0.0'); | ||
expect( | ||
helper.fs.readJsonFile( | ||
path.join(helper.scopes.remoteWithoutOwner, `comp2/node_modules/is-positive/package.json`) | ||
).version | ||
).to.eq('2.0.0'); | ||
}); | ||
after(() => { | ||
npmCiRegistry.destroy(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect } from 'chai'; | ||
import path from 'path'; | ||
import Helper from '../../src/e2e-helper/e2e-helper'; | ||
import NpmCiRegistry, { supportNpmCiRegistryTesting } from '../npm-ci-registry'; | ||
|
||
(supportNpmCiRegistryTesting ? describe : describe.skip)('installing a component dependency', function () { | ||
this.timeout(0); | ||
let scope: string; | ||
let helper: Helper; | ||
let npmCiRegistry: NpmCiRegistry; | ||
before(async () => { | ||
helper = new Helper({ scopesOptions: { remoteScopeWithDot: true } }); | ||
helper.scopeHelper.setNewLocalAndRemoteScopesHarmony(); | ||
helper.bitJsonc.setupDefault(); | ||
helper.bitJsonc.setPackageManager(`teambit.dependencies/pnpm`); | ||
npmCiRegistry = new NpmCiRegistry(helper); | ||
await npmCiRegistry.init(); | ||
npmCiRegistry.configureCiInPackageJsonHarmony(); | ||
helper.fixtures.populateComponents(2); | ||
scope = `@${helper.scopes.remote.replace('.', '/')}.`; | ||
helper.fs.outputFile(`comp1/index.js`, `const comp2 = require("${scope}comp2");`); | ||
helper.command.install(); | ||
helper.command.compile(); | ||
helper.command.tagComponent('comp2 comp1'); | ||
helper.command.export(); | ||
helper.command.removeComponent('comp1'); | ||
helper.command.tagComponent('comp2', undefined, '--unmodified'); | ||
helper.command.export(); | ||
|
||
helper.scopeHelper.reInitLocalScopeHarmony(); | ||
helper.extensions.bitJsonc.setPackageManager(`teambit.dependencies/pnpm`); | ||
helper.scopeHelper.addRemoteScope(); | ||
helper.bitJsonc.setupDefault(); | ||
helper.command.import(`${helper.scopes.remote}/comp1`); | ||
}); | ||
it('should install the version of the component dependency from the model, when it is not in the workspace policies', () => { | ||
expect(helper.fs.readJsonFile(`node_modules/${scope}comp2/package.json`).version).to.eq('0.0.1'); | ||
}); | ||
it('should not install the version of the component dependency from the model, when the component dependency is in the workspace policies', () => { | ||
helper.command.install(`${scope}[email protected]`); | ||
expect(helper.fs.readJsonFile(`node_modules/${scope}comp2/package.json`).version).to.eq('0.0.2'); | ||
expect( | ||
helper.fs.exists(path.join(helper.scopes.remoteWithoutOwner, `comp1/node_modules/${scope}comp2/package.json`)) | ||
).to.eq(false); | ||
}); | ||
after(() => { | ||
npmCiRegistry.destroy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.