Skip to content

Commit

Permalink
Merge pull request #156 from ember-cli/hjdivad/bump-ember-try-config
Browse files Browse the repository at this point in the history
Bump ember-try-config
  • Loading branch information
rwjblue authored Nov 11, 2017
2 parents 6d9fe4b + 0a97fe1 commit a3c51cb
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 50 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install:
# Get the latest stable version of Node 0.STABLE.latest
- ps: Install-Product node $env:nodejs_version
# Install PhantomJS
- npm install phantomjs-prebuilt
- npm install -g phantomjs-prebuilt
- npm install mocha-appveyor-reporter
- npm install -g bower
# Typical npm stuff.
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
"author": "Katie Gengler",
"license": "MIT",
"devDependencies": {
"bower": "^1.8.2",
"broccoli-asset-rev": "^2.4.2",
"chai": "^3.5.0",
"codeclimate-test-reporter": "^0.3.1",
"ember-cli": "2.8.0",
"ember-cli": "2.12.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.3",
"ember-cli-dependency-checker": "^1.2.0",
Expand Down Expand Up @@ -61,7 +62,7 @@
"core-object": "^1.1.0",
"debug": "^2.2.0",
"ember-cli-version-checker": "^1.1.6",
"ember-try-config": "^2.0.1",
"ember-try-config": "^2.2.0",
"extend": "^3.0.0",
"fs-extra": "^0.26.0",
"promise-map-series": "^0.2.1",
Expand Down
168 changes: 121 additions & 47 deletions test/utils/config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,48 +96,88 @@ describe('utils/config', function() {

it('is used if there is no config file', function() {
return getConfig({ project: project }).then(function(config) {
expect(config).to.eql(
{
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{ name: 'ember-beta', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } } },
{ name: 'ember-canary', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } } },
{ name: 'ember-2.2.0', bower: { dependencies: { ember: '2.2.0' } } }
]
}
);
expect(config).to.eql({
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{
name: 'ember-beta',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } },
npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-canary',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } },
npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-2.2.0',
bower: { dependencies: { ember: '2.2.0' } },
npm: { devDependencies: { 'ember-source': null } },
},
],
});
});
});

it('is always used if passed in and behaves as if config file has "useVersionCompatibility: true"', function() {
generateConfigFile('module.exports = { scenarios: [ { foo: "bar" }] };');
return getConfig({ project: project, versionCompatibility: { ember: '1.13.0' } }).then(function(config) {
expect(config).to.eql(
{
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{ name: 'ember-beta', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } } },
{ name: 'ember-canary', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } } },
{ name: 'ember-1.13.0', bower: { dependencies: { ember: '1.13.0' } } },
{ foo: 'bar' }
]
}
);
expect(config).to.eql({
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{
name: 'ember-beta',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } },
npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-canary',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } },
npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-1.13.0',
bower: { dependencies: { ember: '1.13.0' } },

npm: { devDependencies: { 'ember-source': null } },
},
{ foo: 'bar' },
],
});
});
});

it('can be overridden by passed in versionCompatibility', function() {
return getConfig({ project: project, versionCompatibility: { ember: '1.13.0' } }).then(function(config) {
expect(config).to.eql(
{
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{ name: 'ember-beta', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } } },
{ name: 'ember-canary', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } } },
{ name: 'ember-1.13.0', bower: { dependencies: { ember: '1.13.0' } } }
]
}
);
expect(config).to.eql({
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{
name: 'ember-beta',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } },

npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-canary',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } },

npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-1.13.0',
bower: { dependencies: { ember: '1.13.0' } },

npm: { devDependencies: { 'ember-source': null } },
},
],
});
});
});

Expand All @@ -153,31 +193,65 @@ describe('utils/config', function() {
it('is merged with config if config does not have scenarios', function() {
generateConfigFile('module.exports = { bowerOptions: ["--allow-root=true"] };');
return getConfig({ project: project }).then(function(config) {
expect(config).to.eql(
{
bowerOptions: ['--allow-root=true'],
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{ name: 'ember-beta', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } } },
{ name: 'ember-canary', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } } },
{ name: 'ember-2.2.0', bower: { dependencies: { ember: '2.2.0' } } }
]
}
);
expect(config).to.eql({
bowerOptions: ['--allow-root=true'],
scenarios: [
{ name: 'default', bower: { dependencies: {} } },
{
name: 'ember-beta',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } },

npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-canary',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } },

npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-2.2.0',
bower: { dependencies: { ember: '2.2.0' } },

npm: { devDependencies: { 'ember-source': null } },
},
],
});
});
});

it('is merged with config if config has useVersionCompatibility', function() {
generateConfigFile('module.exports = { useVersionCompatibility: true, bowerOptions: ["--allow-root=true"], scenarios: [ { name: "bar" }, { name: "ember-beta", allowedToFail: false } ] };');
generateConfigFile(
'module.exports = { useVersionCompatibility: true, bowerOptions: ["--allow-root=true"], scenarios: [ { name: "bar" }, { name: "ember-beta", allowedToFail: false } ] };'
);
return getConfig({ project: project }).then(function(config) {
expect(config.useVersionCompatibility).to.equal(true);
expect(config.bowerOptions).to.eql(['--allow-root=true']);
expect(config.scenarios).to.eql([
{ name: 'default', bower: { dependencies: {} } },
{ name: 'ember-beta', allowedToFail: false, bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } } },
{ name: 'ember-canary', allowedToFail: true, bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } } },
{ name: 'ember-2.2.0', bower: { dependencies: { ember: '2.2.0' } } },
{ name: 'bar' }
{
name: 'ember-beta',
allowedToFail: false,
bower: { dependencies: { ember: 'components/ember#beta' }, resolutions: { ember: 'beta' } },

npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-canary',
allowedToFail: true,
bower: { dependencies: { ember: 'components/ember#canary' }, resolutions: { ember: 'canary' } },

npm: { devDependencies: { 'ember-source': null } },
},
{
name: 'ember-2.2.0',
bower: { dependencies: { ember: '2.2.0' } },

npm: { devDependencies: { 'ember-source': null } },
},
{ name: 'bar' },
]);
});
});
Expand Down

0 comments on commit a3c51cb

Please sign in to comment.