Skip to content

Commit

Permalink
remove npm experiment refs
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerturdenpants committed Mar 25, 2017
1 parent c6c7199 commit fe5ebea
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 40 deletions.
1 change: 0 additions & 1 deletion lib/experiments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const getCallerFile = require('get-caller-file');
const deprecate = require('../utilities/deprecate');

let experiments = {
NPM_BLUEPRINTS: symbol('npm-blueprints'),
MODULE_UNIFICATION: symbol('module-unification'),
get INSTRUMENTATION() {
deprecate(`\`experiments.INSTRUMENTATION\` is deprecated now that the feature has landed, use \`instrumentation\` method on your addon instead. Required from: \n${getCallerFile()}`, true);
Expand Down
6 changes: 0 additions & 6 deletions lib/tasks/install-blueprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const execa = require('../utilities/execa');
const SilentError = require('silent-error');
const validateNpmPackageName = require('validate-npm-package-name');

const experiments = require('../experiments');

const logger = require('heimdalljs-logger')('ember-cli:tasks:install-blueprint');

const NOT_FOUND_REGEXP = /npm ERR! 404 {2}'(\S+)' is not in the npm registry/;
Expand Down Expand Up @@ -75,10 +73,6 @@ class InstallBlueprintTask extends Task {

_handleLookupFailure(name, error) {
logger.info(`Blueprint lookup for "${name}" failed`);
if (!experiments.NPM_BLUEPRINTS) {
logger.info(`"NPM_BLUEPRINTS experiment disabled -> rethrowing original error`);
throw error;
}

if (!validateNpmPackageName(name).validForNewPackages) {
logger.info(`"${name} is not a valid npm package name -> rethrowing original error`);
Expand Down
55 changes: 22 additions & 33 deletions tests/unit/tasks/install-blueprint-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const InstallBlueprintTask = require('../../../lib/tasks/install-blueprint');
const experiments = require('../../../lib/experiments');
const td = require('testdouble');
const SilentError = require('silent-error');
const expect = require('../../chai').expect;
Expand Down Expand Up @@ -33,46 +32,36 @@ describe('InstallBlueprintTask', function() {
.to.eventually.equal(foobarBlueprint);
});

if (!experiments.NPM_BLUEPRINTS) {
it('rejects if the "foobar" blueprint was not found locally', function() {
let error = new Error('foobar not found');
td.when(task._lookupBlueprint('foobar')).thenReject(error);

return expect(task._resolveBlueprint('foobar'))
.to.be.rejectedWith(error);
});
it('rejects invalid npm package name "foo:bar"', function() {
let error = new Error('foobar not found');
td.when(task._lookupBlueprint('foo:bar')).thenReject(error);

} else {
it('rejects invalid npm package name "foo:bar"', function() {
let error = new Error('foobar not found');
td.when(task._lookupBlueprint('foo:bar')).thenReject(error);

return expect(task._resolveBlueprint('foo:bar'))
.to.be.rejectedWith(error);
});
return expect(task._resolveBlueprint('foo:bar'))
.to.be.rejectedWith(error);
});

it('tries to resolve "foobar" as npm package as a fallback', function() {
let error = new Error('foobar not found');
td.when(task._lookupBlueprint('foobar')).thenReject(error);
it('tries to resolve "foobar" as npm package as a fallback', function() {
let error = new Error('foobar not found');
td.when(task._lookupBlueprint('foobar')).thenReject(error);

let foobarBlueprint = { name: 'foobar npm blueprint' };
td.when(task._tryNpmBlueprint('foobar')).thenResolve(foobarBlueprint);
let foobarBlueprint = { name: 'foobar npm blueprint' };
td.when(task._tryNpmBlueprint('foobar')).thenResolve(foobarBlueprint);

return expect(task._resolveBlueprint('foobar'))
.to.eventually.equal(foobarBlueprint);
});
return expect(task._resolveBlueprint('foobar'))
.to.eventually.equal(foobarBlueprint);
});

it('rejects if npm module resolution failed', function() {
let error = new Error('foobar not found');
td.when(task._lookupBlueprint('foobar')).thenReject(error);
it('rejects if npm module resolution failed', function() {
let error = new Error('foobar not found');
td.when(task._lookupBlueprint('foobar')).thenReject(error);

let npmError = new Error('npm failure');
td.when(task._tryNpmBlueprint('foobar')).thenReject(npmError);
let npmError = new Error('npm failure');
td.when(task._tryNpmBlueprint('foobar')).thenReject(npmError);

return expect(task._resolveBlueprint('foobar'))
.to.be.rejectedWith(npmError);
});
}
return expect(task._resolveBlueprint('foobar'))
.to.be.rejectedWith(npmError);
});

it('resolves "https://github.com/ember-cli/app-blueprint-test.git" blueprint by cloning, ' +
'installing dependencies and loading the blueprint', function() {
Expand Down

0 comments on commit fe5ebea

Please sign in to comment.