ember-cli-blueprint-test-helpers
Advanced tools
Comparing version 0.18.1 to 0.18.2
@@ -5,2 +5,3 @@ module.exports = { | ||
'chai-expect', | ||
'mocha', | ||
], | ||
@@ -45,5 +46,9 @@ extends: 'eslint:recommended', | ||
'no-unused-expressions': 0, | ||
'prefer-template': 2, | ||
'prefer-arrow-callback': 2, | ||
'chai-expect/missing-assertion': 2, | ||
'mocha/no-exclusive-tests': 2, | ||
}, | ||
}; |
module.exports = { | ||
fileMapTokens: function() { | ||
fileMapTokens() { | ||
return { | ||
__root__: function(/* options */) { | ||
__root__(/* options */) { | ||
return 'node-tests/blueprints'; | ||
}, | ||
__name__: function(options) { | ||
__name__(options) { | ||
return options.locals.blueprintName; | ||
@@ -13,3 +13,3 @@ } | ||
locals: function(options) { | ||
locals(options) { | ||
return { | ||
@@ -16,0 +16,0 @@ blueprintName: options.entity.name |
@@ -1,15 +0,17 @@ | ||
var fs = require('fs-extra'); | ||
var path = require('path'); | ||
var EOL = require('os').EOL; | ||
'use strict'; | ||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
const EOL = require('os').EOL; | ||
module.exports = { | ||
description: 'Installs dependencies for ember-cli-blueprint-test-helpers', | ||
normalizeEntityName: function() {}, | ||
normalizeEntityName() {}, | ||
afterInstall: function(options) { | ||
afterInstall(options) { | ||
this.insertTestCallToPackage(options); | ||
return Promise.all([ | ||
this.insertIntoFile('./.npmignore', '/node-tests' + EOL), | ||
this.insertIntoFile('./.npmignore', `/node-tests${EOL}`), | ||
this.addMochaToPackage(), | ||
@@ -19,4 +21,4 @@ ]); | ||
addMochaToPackage: function() { | ||
var pkg = fs.readJsonSync(path.join(__dirname, '../../package.json')); | ||
addMochaToPackage() { | ||
let pkg = fs.readJsonSync(path.join(__dirname, '../../package.json')); | ||
@@ -26,7 +28,7 @@ return this.addPackageToProject('mocha', pkg.devDependencies['mocha']); | ||
insertTestCallToPackage: function() { | ||
var insert = false; | ||
var fullPath = path.join(this.project.root, 'package.json'); | ||
var scriptContents = 'mocha node-tests --recursive'; | ||
var packageContents = fs.readJsonSync(fullPath, { throws: false }); | ||
insertTestCallToPackage() { | ||
let insert = false; | ||
let fullPath = path.join(this.project.root, 'package.json'); | ||
let scriptContents = 'mocha node-tests --recursive'; | ||
let packageContents = fs.readJsonSync(fullPath, { throws: false }); | ||
if (!('nodetest' in packageContents.scripts)) { | ||
@@ -36,4 +38,3 @@ packageContents.scripts.nodetest = scriptContents; | ||
} else { | ||
this.ui.writeLine('Could not update "nodetest" script in package.json. Please add "' + scriptContents + | ||
'" to your nodetest script.'); | ||
this.ui.writeLine(`Could not update "nodetest" script in package.json. Please add "${scriptContents}" to your nodetest script.`); | ||
} | ||
@@ -40,0 +41,0 @@ |
@@ -1,5 +0,7 @@ | ||
var chai = require('chai'); | ||
var chaiAsPromised = require('chai-as-promised'); | ||
var chaiFiles = require('chai-files'); | ||
'use strict'; | ||
const chai = require('chai'); | ||
const chaiAsPromised = require('chai-as-promised'); | ||
const chaiFiles = require('chai-files'); | ||
chai.use(chaiAsPromised); | ||
@@ -6,0 +8,0 @@ chai.use(chaiFiles); |
@@ -1,4 +0,6 @@ | ||
var ember = require('./helpers/ember'); | ||
var rethrowFromErrorLog = require('./rethrow-from-error-log'); | ||
'use strict'; | ||
const ember = require('./helpers/ember'); | ||
const rethrowFromErrorLog = require('./rethrow-from-error-log'); | ||
/** | ||
@@ -11,5 +13,5 @@ * Run a blueprint destructor. | ||
module.exports = function(args) { | ||
var commandArgs = ['destroy'].concat(args); | ||
let commandArgs = ['destroy'].concat(args); | ||
var cliOptions = { | ||
let cliOptions = { | ||
disableDependencyChecker: true, | ||
@@ -16,0 +18,0 @@ }; |
@@ -1,8 +0,10 @@ | ||
var chai = require('../chai'); | ||
var emberGenerate = require('./ember-generate'); | ||
var emberDestroy = require('./ember-destroy'); | ||
'use strict'; | ||
var expect = chai.expect; | ||
var file = chai.file; | ||
const chai = require('../chai'); | ||
const emberGenerate = require('./ember-generate'); | ||
const emberDestroy = require('./ember-destroy'); | ||
const expect = chai.expect; | ||
const file = chai.file; | ||
/** | ||
@@ -22,5 +24,5 @@ * @callback assertionCallback | ||
module.exports = function(args, assertionCallback) { | ||
var paths = []; | ||
let paths = []; | ||
var _file = function(path) { | ||
let _file = function(path) { | ||
paths.push(path); | ||
@@ -31,5 +33,5 @@ return file(path); | ||
return emberGenerate(args) | ||
.then(function() { assertionCallback(_file); }) | ||
.then(function() { return emberDestroy(args); }) | ||
.then(function() { | ||
.then(() => assertionCallback(_file)) | ||
.then(() => emberDestroy(args)) | ||
.then(() => { | ||
if (paths.length === 0) { | ||
@@ -39,3 +41,3 @@ throw new Error('The file() parameter of the emberGenerateDestroy() callback function was never used.'); | ||
paths.forEach(function(path) { | ||
paths.forEach((path) => { | ||
expect(file(path)).to.not.exist; | ||
@@ -42,0 +44,0 @@ }) |
@@ -1,4 +0,6 @@ | ||
var ember = require('./helpers/ember'); | ||
var rethrowFromErrorLog = require('./rethrow-from-error-log'); | ||
'use strict'; | ||
const ember = require('./helpers/ember'); | ||
const rethrowFromErrorLog = require('./rethrow-from-error-log'); | ||
/** | ||
@@ -11,5 +13,5 @@ * Run a blueprint generator. | ||
module.exports = function(args) { | ||
var commandArgs = ['generate'].concat(args); | ||
let commandArgs = ['generate'].concat(args); | ||
var cliOptions = { | ||
let cliOptions = { | ||
disableDependencyChecker: true, | ||
@@ -16,0 +18,0 @@ }; |
@@ -1,9 +0,10 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var existsSync = require('exists-sync'); | ||
'use strict'; | ||
var ember = require('./helpers/ember'); | ||
var modifyPackages = require('./modify-packages'); | ||
var rethrowFromErrorLog = require('./rethrow-from-error-log'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const ember = require('./helpers/ember'); | ||
const modifyPackages = require('./modify-packages'); | ||
const rethrowFromErrorLog = require('./rethrow-from-error-log'); | ||
/** | ||
@@ -19,9 +20,9 @@ * Create a new Ember.js app or addon in the current working directory. | ||
var target = options.target || 'app'; | ||
var isAddon = (target === 'addon'); | ||
let target = options.target || 'app'; | ||
let isAddon = (target === 'addon'); | ||
var projectName = isAddon ? 'my-addon' : 'my-app'; | ||
var command = isAddon ? 'addon' : 'new'; | ||
let projectName = isAddon ? 'my-addon' : 'my-app'; | ||
let command = isAddon ? 'addon' : 'new'; | ||
var cliOptions = { | ||
let cliOptions = { | ||
disableDependencyChecker: true | ||
@@ -45,12 +46,12 @@ }; | ||
function linkAddon() { | ||
var projectPath = path.resolve(process.cwd(), '../../..'); | ||
var projectName = require(path.resolve(projectPath, 'package.json')).name; | ||
let projectPath = path.resolve(process.cwd(), '../../..'); | ||
let projectName = require(path.resolve(projectPath, 'package.json')).name; | ||
var symlinkPath = path.resolve(projectPath, 'node_modules', projectName); | ||
let symlinkPath = path.resolve(projectPath, 'node_modules', projectName); | ||
if (!existsSync(path.resolve(symlinkPath, '..'))) { | ||
if (!fs.existsSync(path.resolve(symlinkPath, '..'))) { | ||
fs.mkdirSync(path.resolve(symlinkPath, '..')); | ||
} | ||
if (!existsSync(path.resolve(symlinkPath, 'package.json'))) { | ||
if (!fs.existsSync(path.resolve(symlinkPath, 'package.json'))) { | ||
fs.symlinkSync(projectPath, symlinkPath, 'dir'); | ||
@@ -57,0 +58,0 @@ } |
'use strict'; | ||
var requireFromCLI = require('./require-from-cli'); | ||
const requireFromCLI = require('./require-from-cli'); | ||
@@ -5,0 +5,0 @@ function ember() { |
'use strict'; | ||
var basePath = 'ember-cli'; | ||
let basePath = 'ember-cli'; | ||
function requireFromCLI(path) { | ||
return require(basePath + '/' + path); | ||
return require(`${basePath}/${path}`); | ||
} | ||
@@ -8,0 +8,0 @@ |
'use strict'; | ||
var path = require('path'); | ||
var MockBlueprintTaskFor = require('ember-cli-internal-test-helpers/lib/helpers/mock-blueprint-task-for'); | ||
var fs = require('fs-extra'); | ||
var tmpenv = require('./tmp-env'); | ||
var debug = require('debug')('ember-cli:testing'); | ||
var requireFromCLI = require('./require-from-cli'); | ||
const path = require('path'); | ||
const MockBlueprintTaskFor = require('ember-cli-internal-test-helpers/lib/helpers/mock-blueprint-task-for'); | ||
const fs = require('fs-extra'); | ||
const tmpenv = require('./tmp-env'); | ||
const debug = require('debug')('ember-cli:testing'); | ||
const requireFromCLI = require('./require-from-cli'); | ||
@@ -23,5 +23,5 @@ /** | ||
options = options || {}; | ||
var timeout = options.timeout || 20000; | ||
var tmp = options.tmpenv || scope.tmpenv || tmpenv; | ||
var disabledTasks = options.disabledTasks || ['addon-install', 'bower-install', 'npm-install']; | ||
let timeout = options.timeout || 20000; | ||
let tmp = options.tmpenv || scope.tmpenv || tmpenv; | ||
let disabledTasks = options.disabledTasks || ['addon-install', 'bower-install', 'npm-install']; | ||
@@ -35,9 +35,9 @@ scope.timeout(timeout); | ||
if (disabledTasks.length) { | ||
var Blueprint = requireFromCLI('lib/models/blueprint'); | ||
let Blueprint = requireFromCLI('lib/models/blueprint'); | ||
before(function () { | ||
before(() => { | ||
MockBlueprintTaskFor.disableTasks(Blueprint, disabledTasks); | ||
}); | ||
after(function() { | ||
after(() => { | ||
MockBlueprintTaskFor.restoreTasks(Blueprint); | ||
@@ -47,14 +47,14 @@ }); | ||
beforeEach(function() { | ||
beforeEach(() => { | ||
tmp.freshDir(); | ||
process.chdir(tmp.tmpdir); | ||
debug("beforeEach cwd: " + process.cwd()); | ||
debug(`beforeEach cwd: ${process.cwd()}`); | ||
}); | ||
afterEach(function() { | ||
afterEach(() => { | ||
process.chdir(tmp.root); | ||
return fs.remove(tmp.tmproot) | ||
.then(function() { | ||
.then(() => { | ||
// remove symlinked addon added by emberNew | ||
var projectName = require(path.resolve(process.cwd(), 'package.json')).name; | ||
let projectName = require(path.resolve(process.cwd(), 'package.json')).name; | ||
return fs.remove(path.join('node_modules', projectName)); | ||
@@ -61,0 +61,0 @@ }) |
'use strict'; | ||
var tmp = require('tmp-sync'); | ||
var path = require('path'); | ||
var root = process.cwd(); | ||
var tmproot = path.resolve(root, 'tmp'); | ||
const tmp = require('tmp-sync'); | ||
const path = require('path'); | ||
const root = process.cwd(); | ||
const tmproot = path.resolve(root, 'tmp'); | ||
/** | ||
Return tmp environment | ||
*/ | ||
var tmpenv = { | ||
let tmpenv = { | ||
root: root, | ||
@@ -12,0 +12,0 @@ tmproot: tmproot, |
@@ -1,4 +0,6 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
/** | ||
@@ -11,9 +13,9 @@ * Modify the dependencies in the `package.json` file of the test project. | ||
module.exports = function(packages) { | ||
var packagePath = path.resolve(process.cwd(), 'package.json'); | ||
let packagePath = path.resolve(process.cwd(), 'package.json'); | ||
var contents = JSON.parse(fs.readFileSync(packagePath, { encoding: 'utf8' })); | ||
let contents = JSON.parse(fs.readFileSync(packagePath, { encoding: 'utf8' })); | ||
contents.dependencies = contents.dependencies || {}; | ||
contents.devDependencies = contents.devDependencies || {}; | ||
packages.forEach(function(pkg) { | ||
packages.forEach((pkg) => { | ||
if (pkg.delete) { | ||
@@ -23,3 +25,3 @@ delete contents.dependencies[pkg.name]; | ||
} else { | ||
var dependencies = pkg.dev ? contents.devDependencies : contents.dependencies; | ||
let dependencies = pkg.dev ? contents.devDependencies : contents.dependencies; | ||
dependencies[pkg.name] = pkg.version || '*'; | ||
@@ -26,0 +28,0 @@ } |
@@ -1,3 +0,5 @@ | ||
var replaceFile = require('ember-cli-internal-test-helpers/lib/helpers/file-utils').replaceFile; | ||
'use strict'; | ||
const replaceFile = require('ember-cli-internal-test-helpers/lib/helpers/file-utils').replaceFile; | ||
/** | ||
@@ -4,0 +6,0 @@ * Setup `usePods` in `.ember-cli` and/or `podModulePrefix` in `environment.js`. |
'use strict'; | ||
var blueprintHelpers = require('../../helpers'); | ||
var setupTestHooks = blueprintHelpers.setupTestHooks; | ||
var emberNew = blueprintHelpers.emberNew; | ||
var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; | ||
const blueprintHelpers = require('../../helpers'); | ||
const setupTestHooks = blueprintHelpers.setupTestHooks; | ||
const emberNew = blueprintHelpers.emberNew; | ||
const emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; | ||
var expect = require('../../chai').expect; | ||
const expect = require('../../chai').expect; | ||
@@ -13,4 +13,4 @@ describe('Acceptance: ember generate and destroy blueprint-test', function() { | ||
it('blueprint-test foo', function() { | ||
var args = ['blueprint-test', 'foo']; | ||
it('blueprint-test foo', () => { | ||
let args = ['blueprint-test', 'foo']; | ||
@@ -17,0 +17,0 @@ // pass any additional command line options in the arguments array |
'use strict'; | ||
var blueprintHelpers = require('../../helpers'); | ||
var setupTestHooks = blueprintHelpers.setupTestHooks; | ||
var emberNew = blueprintHelpers.emberNew; | ||
var emberGenerate = blueprintHelpers.emberGenerate; | ||
const blueprintHelpers = require('../../helpers'); | ||
const setupTestHooks = blueprintHelpers.setupTestHooks; | ||
const emberNew = blueprintHelpers.emberNew; | ||
const emberGenerate = blueprintHelpers.emberGenerate; | ||
var fs = require('fs-extra'); | ||
var stripAnsi = require('strip-ansi'); | ||
var expect = require('../../chai').expect; | ||
var file = require('../../chai').file; | ||
var EOL = require('os').EOL; | ||
const fs = require('fs-extra'); | ||
const stripAnsi = require('strip-ansi'); | ||
const expect = require('../../chai').expect; | ||
const file = require('../../chai').file; | ||
const EOL = require('os').EOL; | ||
@@ -19,8 +19,8 @@ function getDevDependencies() { | ||
describe('Acceptance: ember generate ember-cli-blueprint-test-helpers', function() { | ||
describe('Acceptance: ember generate ember-cli-blueprint-test-helpers', () => { | ||
describe('with mocking', function() { | ||
setupTestHooks(this); | ||
it('ember-cli-blueprint-test-helpers', function() { | ||
var args = ['ember-cli-blueprint-test-helpers']; | ||
it('ember-cli-blueprint-test-helpers', () => { | ||
let args = ['ember-cli-blueprint-test-helpers']; | ||
@@ -34,8 +34,8 @@ // pass any additional command line options in the arguments array | ||
.to.contain('install package mocha'); | ||
expect(file('.npmignore')).to.contain('/node-tests' + EOL); | ||
expect(file('.npmignore')).to.contain(`/node-tests${EOL}`); | ||
}); | ||
}); | ||
it('doesn\'t write to existing nodetest scripts', function() { | ||
var args = ['ember-cli-blueprint-test-helpers']; | ||
it('doesn\'t write to existing nodetest scripts', () => { | ||
let args = ['ember-cli-blueprint-test-helpers']; | ||
@@ -65,4 +65,4 @@ // pass any additional command line options in the arguments array | ||
it('adds mocha as a dependency', function() { | ||
var args = ['ember-cli-blueprint-test-helpers']; | ||
it('adds mocha as a dependency', () => { | ||
let args = ['ember-cli-blueprint-test-helpers']; | ||
@@ -69,0 +69,0 @@ return emberNew() |
{ | ||
"name": "ember-cli-blueprint-test-helpers", | ||
"version": "0.18.1", | ||
"version": "0.18.2", | ||
"description": "Blueprint test helpers for ember-cli. Mocks ember-cli for generate and destroy commands.", | ||
@@ -29,6 +29,3 @@ "main": "index.js", | ||
"ember-cli-internal-test-helpers": "^0.9.1", | ||
"exists-sync": "0.0.3", | ||
"findup": "^0.1.5", | ||
"fs-extra": "^4.0.0", | ||
"lodash.merge": "^4.4.0", | ||
"testdouble": "^3.2.6", | ||
@@ -41,8 +38,7 @@ "tmp-sync": "^1.0.0" | ||
"eslint-plugin-chai-expect": "^1.0.0", | ||
"eslint-plugin-mocha": "^4.11.0", | ||
"mocha": "^3.5.3", | ||
"mocha-eslint": "^4.0.0", | ||
"mocha-only-detector": "^0.1.0", | ||
"rimraf": "^2.4.3", | ||
"strip-ansi": "^4.0.0" | ||
} | ||
} |
@@ -1,16 +0,17 @@ | ||
var setupTestHooks = require('../../lib/helpers/setup'); | ||
'use strict'; | ||
const setupTestHooks = require('../../lib/helpers/setup'); | ||
var blueprintHelpers = require('../../helpers'); | ||
var emberNew = blueprintHelpers.emberNew; | ||
var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; | ||
var path = require('path'); | ||
const blueprintHelpers = require('../../helpers'); | ||
const emberNew = blueprintHelpers.emberNew; | ||
const emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; | ||
const path = require('path'); | ||
var chai = require('../../chai'); | ||
var expect = chai.expect; | ||
var dir = chai.dir; | ||
const chai = require('../../chai'); | ||
const expect = chai.expect; | ||
const dir = chai.dir; | ||
describe('Acceptance: helpers', function() { | ||
setupTestHooks(this); | ||
describe('emberGenerateDestroy', function() { | ||
it('blueprint-test foo', function() { | ||
describe('emberGenerateDestroy', () => { | ||
it('blueprint-test foo', () => { | ||
return emberNew() | ||
@@ -25,10 +26,10 @@ .then(() => emberGenerateDestroy(['blueprint-test', 'foo'], (file) => { | ||
describe('setupTestHooks', function() { | ||
describe('setupTestHooks', () => { | ||
var symlink = path.resolve(__dirname, '..', '..', 'node_modules', 'ember-cli-blueprint-test-helpers'); | ||
after(function() { | ||
after(() => { | ||
expect(dir(symlink)).to.not.exist; | ||
}); | ||
it('cleans up symlinked addon', function() { | ||
it('cleans up symlinked addon', () => { | ||
return emberNew() | ||
@@ -35,0 +36,0 @@ .then(() => { |
'use strict'; | ||
var lint = require('mocha-eslint'); | ||
const lint = require('mocha-eslint'); | ||
var paths = [ | ||
let paths = [ | ||
'blueprints', | ||
@@ -7,0 +7,0 @@ 'lib', |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
8
7
521
198805
- Removedexists-sync@0.0.3
- Removedfindup@^0.1.5
- Removedlodash.merge@^4.4.0
- Removedcolors@0.6.2(transitive)
- Removedcommander@2.1.0(transitive)
- Removedfindup@0.1.5(transitive)
- Removedlodash.merge@4.6.2(transitive)