diff --git a/blueprints/addon/index.js b/blueprints/addon/index.js index 2f29b686ec..ac0d889d40 100644 --- a/blueprints/addon/index.js +++ b/blueprints/addon/index.js @@ -121,7 +121,7 @@ module.exports = { let packagePath = path.join(this.path, 'files', 'package.json'); let bowerPath = path.join(this.path, 'files', 'bower.json'); - [packagePath, bowerPath].forEach(filePath => { + [packagePath, bowerPath].forEach((filePath) => { fs.removeSync(filePath); }); }, diff --git a/blueprints/blueprint/index.js b/blueprints/blueprint/index.js index e0a37bef05..d21affb601 100644 --- a/blueprints/blueprint/index.js +++ b/blueprints/blueprint/index.js @@ -7,7 +7,7 @@ module.exports = { let files = this._super.files.apply(this, arguments); if (!this.hasJSHint()) { - files = files.filter(file => file !== 'blueprints/.jshintrc'); + files = files.filter((file) => file !== 'blueprints/.jshintrc'); } return files; diff --git a/blueprints/in-repo-addon/index.js b/blueprints/in-repo-addon/index.js index c7fad43eb3..134dbf6497 100755 --- a/blueprints/in-repo-addon/index.js +++ b/blueprints/in-repo-addon/index.js @@ -37,8 +37,8 @@ module.exports = { fileMapTokens() { return { - __root__: options => this._processTokens(options.dasherizedModuleName).root, - __name__: options => this._processTokens(options.dasherizedModuleName).name, + __root__: (options) => this._processTokens(options.dasherizedModuleName).root, + __name__: (options) => this._processTokens(options.dasherizedModuleName).name, }; }, diff --git a/docs/project_version_preprocessor.js b/docs/project_version_preprocessor.js index 03d7b7aafb..2a50955da4 100644 --- a/docs/project_version_preprocessor.js +++ b/docs/project_version_preprocessor.js @@ -3,6 +3,6 @@ let versionUtils = require('../lib/utilities/version-utils'); let emberCLIVersion = versionUtils.emberCLIVersion; -module.exports = function(data, options) { +module.exports = function (data, options) { options.project.version = emberCLIVersion(); }; diff --git a/lib/broccoli/default-packager.js b/lib/broccoli/default-packager.js index 6f0abdad7a..cfa1814940 100644 --- a/lib/broccoli/default-packager.js +++ b/lib/broccoli/default-packager.js @@ -274,7 +274,7 @@ module.exports = class DefaultPackager { */ importAdditionalAssets(tree) { if (this._cachedProcessedAdditionalAssets === null) { - let otherAssetTrees = funnelReducer(this.additionalAssetPaths).map(options => { + let otherAssetTrees = funnelReducer(this.additionalAssetPaths).map((options) => { let files = options.include.join(','); options.annotation = `${options.srcDir}/{${files}} => ${options.destDir}/{${files}}`; @@ -1303,7 +1303,7 @@ module.exports = class DefaultPackager { // iterate over the keys and concat files // to support scenarios like // app.import('vendor/foobar.js', { outputFile: 'assets/baz.js' }); - let vendorTrees = importPaths.map(importPath => { + let vendorTrees = importPaths.map((importPath) => { let files = this.scriptOutputFiles[importPath]; let isMainVendorFile = importPath === this.distPaths.vendorJsFile; diff --git a/lib/broccoli/ember-app.js b/lib/broccoli/ember-app.js index 8ede0ff605..df9ce9cb89 100644 --- a/lib/broccoli/ember-app.js +++ b/lib/broccoli/ember-app.js @@ -132,7 +132,7 @@ class EmberApp { this.populateLegacyFiles(); this.initializeAddons(); - this.project.addons.forEach(addon => (addon.app = this)); + this.project.addons.forEach((addon) => (addon.app = this)); p.setupRegistry(this); this._importAddonTransforms(); this._notifyAddonIncluded(); @@ -205,7 +205,7 @@ class EmberApp { this.project = options.project || Project.closestSync(process.cwd()); if (options.configPath) { - this.project.configPath = function() { + this.project.configPath = function () { return app._resolveLocal(options.configPath); }; } @@ -565,7 +565,7 @@ class EmberApp { result = result || false; roots = roots || {}; - let babelInstance = addons.find(addon => addon.name === 'ember-cli-babel'); + let babelInstance = addons.find((addon) => addon.name === 'ember-cli-babel'); if (babelInstance) { let version = babelInstance.pkg.version; if (semver.lt(version, '6.6.0')) { @@ -579,7 +579,7 @@ class EmberApp { } } - return addons.some(addon => this._checkEmberCliBabel(addon.addons, result, roots)) || result; + return addons.some((addon) => this._checkEmberCliBabel(addon.addons, result, roots)) || result; } /** @@ -605,10 +605,10 @@ class EmberApp { @method _notifyAddonIncluded */ _notifyAddonIncluded() { - let addonNames = this.project.addons.map(addon => addon.name); + let addonNames = this.project.addons.map((addon) => addon.name); if (this.options.addons.blacklist) { - this.options.addons.blacklist.forEach(addonName => { + this.options.addons.blacklist.forEach((addonName) => { if (addonNames.indexOf(addonName) === -1) { throw new Error(`Addon "${addonName}" defined in blacklist is not found`); } @@ -616,7 +616,7 @@ class EmberApp { } if (this.options.addons.whitelist) { - this.options.addons.whitelist.forEach(addonName => { + this.options.addons.whitelist.forEach((addonName) => { if (addonNames.indexOf(addonName) === -1) { throw new Error(`Addon "${addonName}" defined in whitelist is not found`); } @@ -625,9 +625,9 @@ class EmberApp { // the addons must be filtered before the `included` hook is called // in case an addon caches the project.addons list - this.project.addons = this.project.addons.filter(addon => this.shouldIncludeAddon(addon)); + this.project.addons = this.project.addons.filter((addon) => this.shouldIncludeAddon(addon)); - this.project.addons.forEach(addon => { + this.project.addons.forEach((addon) => { if (addon.included) { addon.included(this); } @@ -641,7 +641,7 @@ class EmberApp { @method _importAddonTransforms */ _importAddonTransforms() { - this.project.addons.forEach(addon => { + this.project.addons.forEach((addon) => { if (this.shouldIncludeAddon(addon)) { if (addon.importTransforms) { let transforms = addon.importTransforms(); @@ -650,7 +650,7 @@ class EmberApp { throw new Error(`Addon "${addon.name}" did not return a transform map from importTransforms function`); } - Object.keys(transforms).forEach(transformName => { + Object.keys(transforms).forEach((transformName) => { let transformConfig = { files: [], options: {}, @@ -719,17 +719,17 @@ class EmberApp { @return {Array} List of trees */ addonTreesFor(type) { - return this._addonTreesFor(type).map(addonBundle => addonBundle.tree); + return this._addonTreesFor(type).map((addonBundle) => addonBundle.tree); } _getDefaultPluginForType(type) { let plugins = this.registry.load(type); - let defaultsForType = plugins.filter(plugin => plugin.isDefaultForType); + let defaultsForType = plugins.filter((plugin) => plugin.isDefaultForType); if (defaultsForType.length > 1) { throw new Error( `There are multiple preprocessor plugins marked as default for '${type}': ${defaultsForType - .map(p => p.name) + .map((p) => p.name) .join(', ')}` ); } @@ -1087,14 +1087,14 @@ class EmberApp { @return {Array} An array of regular expressions. */ _podTemplatePatterns() { - return this.registry.extensionsForType('template').map(extension => `**/*/template.${extension}`); + return this.registry.extensionsForType('template').map((extension) => `**/*/template.${extension}`); } _nodeModuleTrees() { if (!this._cachedNodeModuleTrees) { this._cachedNodeModuleTrees = Array.from( this._nodeModules.values(), - module => + (module) => new Funnel(module.path, { srcDir: '/', destDir: `node_modules/${module.name}/`, @@ -1419,7 +1419,7 @@ class EmberApp { if (!Array.isArray(options.using)) { throw new Error('You must pass an array of transformations for `using` option'); } - options.using.forEach(entry => { + options.using.forEach((entry) => { if (!entry.transformation) { throw new Error( `while importing ${assetPath}: each entry in the \`using\` list must have a \`transformation\` name` @@ -1557,7 +1557,7 @@ class EmberApp { let addonBundles = this._cachedAddonBundles[type]; - let addonTrees = addonBundles.map(addonBundle => { + let addonTrees = addonBundles.map((addonBundle) => { let { name, tree, root } = addonBundle; let precompiledSource = tree; @@ -1581,8 +1581,8 @@ class EmberApp { return [tree, precompiledSource]; }); - let precompiledSource = addonTrees.map(pair => pair[1]); - addonTrees = addonTrees.map(pair => pair[0]); + let precompiledSource = addonTrees.map((pair) => pair[1]); + addonTrees = addonTrees.map((pair) => pair[0]); precompiledSource = mergeTrees(precompiledSource, { overwrite: true, diff --git a/lib/broccoli/merge-trees.js b/lib/broccoli/merge-trees.js index 301bb5cb28..3e5116a9aa 100644 --- a/lib/broccoli/merge-trees.js +++ b/lib/broccoli/merge-trees.js @@ -20,7 +20,7 @@ function getEmptyTree() { }); let originalCleanup = EMPTY_MERGE_TREE.cleanup; - EMPTY_MERGE_TREE.cleanup = function() { + EMPTY_MERGE_TREE.cleanup = function () { // this tree is being cleaned up, we must // ensure that our shared EMPTY_MERGE_TREE is // reset (otherwise it will not have a valid diff --git a/lib/cli/cli.js b/lib/cli/cli.js index 914caedfee..bbd1dbf7d2 100644 --- a/lib/cli/cli.js +++ b/lib/cli/cli.js @@ -145,7 +145,7 @@ class CLI { commandLookupCreationToken.stop(); - getOptionArgs('--verbose', commandArgs).forEach(arg => { + getOptionArgs('--verbose', commandArgs).forEach((arg) => { process.env[`EMBER_VERBOSE_${arg.toUpperCase()}`] = 'true'; }); @@ -209,7 +209,7 @@ class CLI { } } finally { instrumentation.start('shutdown'); - shutdownOnExit = function() { + shutdownOnExit = function () { instrumentation.stopAndReport('shutdown'); }; } @@ -234,7 +234,7 @@ class CLI { // This ensures that stdout is flushed so acceptance tests get full output if (process.platform === 'win32') { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(resolve, 250, exitCode); }); } else { diff --git a/lib/cli/index.js b/lib/cli/index.js index d54517873e..61bb79407c 100644 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -51,9 +51,7 @@ function clientId() { if (id) { return id; } else { - id = require('uuid') - .v4() - .toString(); + id = require('uuid').v4().toString(); configStore.set('client-id', id); return id; } @@ -68,7 +66,7 @@ function configureLogger(env) { } // Options: Array cliArgs, Stream inputStream, Stream outputStream, EventEmitter process -module.exports = async function(options) { +module.exports = async function (options) { // `process` should be captured before we require any libraries which // may use `process.exit` work arounds for async cleanup. willInterruptProcess.capture(options.process || process); diff --git a/lib/cli/lookup-command.js b/lib/cli/lookup-command.js index 5e8f1d1915..1ddaae044a 100644 --- a/lib/cli/lookup-command.js +++ b/lib/cli/lookup-command.js @@ -2,7 +2,7 @@ const UnknownCommand = require('../commands/unknown'); -module.exports = function(commands, commandName, commandArgs, optionHash) { +module.exports = function (commands, commandName, commandArgs, optionHash) { let options = optionHash || {}; let project = options.project; let ui = options.ui; diff --git a/lib/commands/generate.js b/lib/commands/generate.js index dd6d0a2e49..6d488abe52 100644 --- a/lib/commands/generate.js +++ b/lib/commands/generate.js @@ -103,7 +103,7 @@ module.exports = Command.extend({ let collectionsJson = []; - blueprintList.forEach(function(collection) { + blueprintList.forEach(function (collection) { let result = this.getPackageBlueprints(collection, options, singleBlueprintName); if (options.json) { let collectionJson = {}; @@ -141,7 +141,7 @@ module.exports = Command.extend({ let blueprintsJson = []; - blueprints.forEach(function(blueprint) { + blueprints.forEach(function (blueprint) { let singleMatch = singleBlueprintName === blueprint.name; if (singleMatch) { verbose = true; diff --git a/lib/commands/help.js b/lib/commands/help.js index 03b4a321e7..e1fd4e1878 100644 --- a/lib/commands/help.js +++ b/lib/commands/help.js @@ -42,7 +42,7 @@ module.exports = Command.extend({ this.ui.writeLine('Available commands in ember-cli:'); this.ui.writeLine(''); - Object.keys(this.commands).forEach(function(commandName) { + Object.keys(this.commands).forEach(function (commandName) { this._printHelpForCommand(commandName, false, commandOptions); }, this); @@ -53,7 +53,7 @@ module.exports = Command.extend({ this.ui.writeLine(''); this.ui.writeLine(`Available commands from ${addonName}:`); - Object.keys(this.commands).forEach(function(commandName) { + Object.keys(this.commands).forEach(function (commandName) { this._printHelpForCommand(commandName, false, commandOptions); }, this); }); @@ -82,7 +82,7 @@ module.exports = Command.extend({ // Iterate through each arg beyond the initial 'help' command, // and try to display usage instructions. - rawArgs.forEach(function(commandName) { + rawArgs.forEach(function (commandName) { this._printHelpForCommand(commandName, true, commandOptions); }, this); } diff --git a/lib/commands/new.js b/lib/commands/new.js index bcd8fd735d..fbc3d1335e 100644 --- a/lib/commands/new.js +++ b/lib/commands/new.js @@ -79,10 +79,10 @@ module.exports = Command.extend({ projectName, directoryName: commandOptions.directory, dryRun: commandOptions.dryRun, - }).then(opts => { + }).then((opts) => { initCommand.project.root = process.cwd(); - return initCommand.run(commandOptions, rawArgs).catch(err => { + return initCommand.run(commandOptions, rawArgs).catch((err) => { let { initialDirectory, projectDirectory } = opts; process.chdir(initialDirectory); diff --git a/lib/commands/serve.js b/lib/commands/serve.js index 367c79b139..3609931797 100644 --- a/lib/commands/serve.js +++ b/lib/commands/serve.js @@ -93,7 +93,7 @@ module.exports = Command.extend({ run(commandOptions) { commandOptions.liveReloadHost = commandOptions.liveReloadHost || commandOptions.host; - return this._checkExpressPort(commandOptions).then(commandOptions => { + return this._checkExpressPort(commandOptions).then((commandOptions) => { if (commandOptions.proxy) { if (!/^(http:|https:)/.test(commandOptions.proxy)) { let message = `You need to include a protocol with the proxy URL.${EOL}Try --proxy http://${commandOptions.proxy}`; @@ -107,7 +107,7 @@ module.exports = Command.extend({ }, _checkExpressPort(commandOptions) { - return getPort({ port: commandOptions.port, host: commandOptions.host }).then(foundPort => { + return getPort({ port: commandOptions.port, host: commandOptions.host }).then((foundPort) => { if (commandOptions.port !== foundPort && commandOptions.port !== 0) { let message = `Port ${commandOptions.port} is already in use.`; return Promise.reject(new SilentError(message)); diff --git a/lib/models/addon.js b/lib/models/addon.js index 772f70ee57..07c1d40809 100644 --- a/lib/models/addon.js +++ b/lib/models/addon.js @@ -361,7 +361,7 @@ let addonProto = { * @method findOwnAddonByName */ findOwnAddonByName(name) { - return this.addons.find(addon => addon.name === name); + return this.addons.find((addon) => addon.name === name); }, /** @@ -450,7 +450,7 @@ let addonProto = { let addonPackageList = pkgInfo.discoverAddonAddons(); this.addonPackages = pkgInfo.generateAddonPackages( addonPackageList, - addonInfo => this.shouldIncludeChildAddon && !this.shouldIncludeChildAddon(addonInfo) + (addonInfo) => this.shouldIncludeChildAddon && !this.shouldIncludeChildAddon(addonInfo) ); // in case any child addons are invalid, dump to the console about them. @@ -475,7 +475,7 @@ let addonProto = { this.discoverAddons(); this.addons = instantiateAddons(this, this.project, this.addonPackages); - this.addons.forEach(addon => logger.info('addon: %s', addon.name)); + this.addons.forEach((addon) => logger.info('addon: %s', addon.name)); }, /** @@ -692,7 +692,7 @@ let addonProto = { let cacheKeyStats = heimdall.statsFor('cache-key-for-tree'); // determine if treeFor* (or other methods for tree type) overrides for the given tree - let modifiedMethods = methodsToValidate.filter(methodName => this[methodName] !== addonProto[methodName]); + let modifiedMethods = methodsToValidate.filter((methodName) => this[methodName] !== addonProto[methodName]); if (modifiedMethods.length) { cacheKeyStats.modifiedMethods++; @@ -1024,7 +1024,7 @@ let addonProto = { let addonTemplatesRelativeToAddonPath = addonTemplatesTreeInAddonTree && addonTemplatesTreePath.replace(`${addonTreePath}/`, ''); let podTemplateMatcher = new RegExp(`template.(${templateExtensions.join('|')})$`); - let hasPodTemplates = files.some(file => { + let hasPodTemplates = files.some((file) => { // short circuit if this is actually a `addon/templates` file if (addonTemplatesTreeInAddonTree && file.indexOf(addonTemplatesRelativeToAddonPath) === 0) { return false; @@ -1034,14 +1034,14 @@ let addonProto = { }); let jsMatcher = new RegExp(`(${jsExtensions.join('|')})$`); - let hasJSFiles = files.some(file => jsMatcher.test(file)); + let hasJSFiles = files.some((file) => jsMatcher.test(file)); if (!addonTemplatesTreeInAddonTree) { files = files.concat(this._getAddonTemplatesTreeFiles()); } let extensionMatcher = new RegExp(`(${templateExtensions.join('|')})$`); - let hasTemplates = files.some(file => extensionMatcher.test(file)); + let hasTemplates = files.some((file) => extensionMatcher.test(file)); this._cachedFileSystemInfo = { hasJSFiles, @@ -1092,7 +1092,9 @@ let addonProto = { } if (this._shouldCompilePodTemplates()) { - let includePatterns = this.registry.extensionsForType('template').map(extension => `**/*/template.${extension}`); + let includePatterns = this.registry + .extensionsForType('template') + .map((extension) => `**/*/template.${extension}`); let podTemplates = new Funnel(addonTree, { include: includePatterns, @@ -1742,7 +1744,7 @@ function methodsForTreeType(treeType) { let Addon = CoreObject.extend(addonProto); -Addon.prototype[BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS] = function() { +Addon.prototype[BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS] = function () { let emberCLIBabelInstance = findAddonByName(this.addons, 'ember-cli-babel'); let version; if (emberCLIBabelInstance) { diff --git a/lib/models/asset-size-printer.js b/lib/models/asset-size-printer.js index 7cb41cd03a..045f9cd93d 100644 --- a/lib/models/asset-size-printer.js +++ b/lib/models/asset-size-printer.js @@ -14,10 +14,10 @@ module.exports = class AssetPrinterSize { const filesize = require('filesize'); let ui = this.ui; - return this.makeAssetSizesObject().then(files => { + return this.makeAssetSizesObject().then((files) => { if (files.length !== 0) { ui.writeLine(chalk.green('File sizes:')); - return files.forEach(file => { + return files.forEach((file) => { let sizeOutput = filesize(file.size); if (file.showGzipped) { sizeOutput += ` (${filesize(file.gzipSize)} gzipped)`; @@ -33,9 +33,9 @@ module.exports = class AssetPrinterSize { printJSON() { let ui = this.ui; - return this.makeAssetSizesObject().then(files => { + return this.makeAssetSizesObject().then((files) => { if (files.length !== 0) { - let entries = files.map(file => ({ + let entries = files.map((file) => ({ name: file.name, size: file.size, gzipSize: file.gzipSize, @@ -48,7 +48,7 @@ module.exports = class AssetPrinterSize { } makeAssetSizesObject() { - return new Promise(resolve => { + return new Promise((resolve) => { const fs = require('fs'); const zlib = require('zlib'); let gzip = util.promisify(zlib.gzip); @@ -57,14 +57,14 @@ module.exports = class AssetPrinterSize { let assets = files // Skip test files - .filter(file => { + .filter((file) => { let filename = path.basename(file); return !testFileRegex.test(filename); }) // Print human-readable file sizes (including gzipped) - .map(file => { + .map((file) => { let contentsBuffer = fs.readFileSync(file); - return gzip(contentsBuffer).then(buffer => ({ + return gzip(contentsBuffer).then((buffer) => ({ name: file, size: contentsBuffer.length, gzipSize: buffer.length, @@ -83,8 +83,8 @@ module.exports = class AssetPrinterSize { return walkSync(outputPath, { directories: false, }) - .filter(x => x.endsWith('.css') || x.endsWith('.js')) - .map(x => path.join(outputPath, x)); + .filter((x) => x.endsWith('.css') || x.endsWith('.js')) + .map((x) => path.join(outputPath, x)); } catch (e) { if (e !== null && typeof e === 'object' && e.code === 'ENOENT') { throw new Error(`No asset files found in the path provided: ${outputPath}`); diff --git a/lib/models/blueprint.js b/lib/models/blueprint.js index f1aa61d460..9449a84098 100644 --- a/lib/models/blueprint.js +++ b/lib/models/blueprint.js @@ -429,7 +429,7 @@ let Blueprint = CoreObject.extend({ let fileInfos = await process.call(this, intoDir, locals); // commit changes for each FileInfo (with prompting as needed) - await Promise.all(fileInfos.map(fi => this._commit(fi))); + await Promise.all(fileInfos.map((fi) => this._commit(fi))); // run afterInstall/afterUninstall userland hooks await afterHook.call(this, options); @@ -647,7 +647,7 @@ let Blueprint = CoreObject.extend({ generateFileMap(fileMapVariables) { let tokens = this._fileMapTokens(fileMapVariables); let fileMapValues = _.values(tokens); - let tokenValues = fileMapValues.map(token => token(fileMapVariables)); + let tokenValues = fileMapValues.map((token) => token(fileMapVariables)); let tokenKeys = Object.keys(tokens); return _.zipObject(tokenKeys, tokenValues); }, @@ -754,7 +754,7 @@ let Blueprint = CoreObject.extend({ return Promise.all(fileInfos.filter(isValidFile).map(prepareConfirm)) .then(finishProcessingForInstall) - .then(fileInfos => fileInfos.concat(fileInfosToRemove)); + .then((fileInfos) => fileInfos.concat(fileInfosToRemove)); }, /** @@ -840,9 +840,9 @@ let Blueprint = CoreObject.extend({ let moduleName = (options.entity && options.entity.name) || packageName; let sanitizedModuleName = moduleName.replace(/\//g, '-'); - return new Promise(resolve => { + return new Promise((resolve) => { resolve(this.locals(options)); - }).then(customLocals => { + }).then((customLocals) => { let fileMapVariables = this._generateFileMapVariables(moduleName, customLocals, options); let fileMap = this.generateFileMap(fileMapVariables); let standardLocals = { @@ -1042,7 +1042,7 @@ let Blueprint = CoreObject.extend({ let installText = packages.length > 1 ? 'install bower packages' : 'install bower package'; let packageNames = []; let packageNamesAndVersions = packages - .map(pkg => { + .map((pkg) => { pkg.source = pkg.source || pkg.name; packageNames.push(pkg.name); return pkg; @@ -1099,7 +1099,7 @@ let Blueprint = CoreObject.extend({ let packages = options.packages; if (packages && packages.length) { - taskOptions.packages = packages.map(pkg => { + taskOptions.packages = packages.map((pkg) => { if (typeof pkg === 'string') { return pkg; } @@ -1223,11 +1223,11 @@ let Blueprint = CoreObject.extend({ getJson(verbose) { let json = {}; - this._printableProperties.forEach(key => { + this._printableProperties.forEach((key) => { let value = this[key]; if (key === 'availableOptions') { value = _.cloneDeep(value); - value.forEach(option => { + value.forEach((option) => { if (typeof option.type === 'function') { option.type = option.type.name; } @@ -1274,7 +1274,7 @@ let Blueprint = CoreObject.extend({ matching Blueprint could not be found @return {Blueprint} */ -Blueprint.lookup = function(name, options) { +Blueprint.lookup = function (name, options) { options = options || {}; let lookupPaths = generateLookupPaths(options.paths); @@ -1301,7 +1301,7 @@ Blueprint.lookup = function(name, options) { @param {String} blueprintPath @return {Blueprint} blueprint instance */ -Blueprint.load = function(blueprintPath) { +Blueprint.load = function (blueprintPath) { if (fs.lstatSync(blueprintPath).isDirectory()) { let Constructor = Blueprint; @@ -1328,13 +1328,13 @@ Blueprint.load = function(blueprintPath) { @param {Array} [options.paths] Extra paths to search for blueprints @return {Array} */ -Blueprint.list = function(options) { +Blueprint.list = function (options) { options = options || {}; let lookupPaths = generateLookupPaths(options.paths); let seen = []; - return lookupPaths.map(lookupPath => { + return lookupPaths.map((lookupPath) => { let source; let packagePath = path.join(lookupPath, '../package.json'); if (Blueprint._existsSync(packagePath)) { @@ -1343,7 +1343,7 @@ Blueprint.list = function(options) { source = path.basename(path.join(lookupPath, '..')); } - let blueprints = dir(lookupPath).map(blueprintPath => { + let blueprints = dir(lookupPath).map((blueprintPath) => { let blueprint = Blueprint.load(blueprintPath); if (blueprint) { let name = blueprint.name; @@ -1361,11 +1361,11 @@ Blueprint.list = function(options) { }); }; -Blueprint._existsSync = function(path, parent) { +Blueprint._existsSync = function (path, parent) { return fs.existsSync(path, parent); }; -Blueprint._readdirSync = function(path) { +Blueprint._readdirSync = function (path) { return fs.readdirSync(path); }; @@ -1400,7 +1400,7 @@ Blueprint.ignoredUpdateFiles = ['.gitkeep', 'app.css', 'LICENSE.md']; @static @property defaultLookupPaths */ -Blueprint.defaultLookupPaths = function() { +Blueprint.defaultLookupPaths = function () { return [path.resolve(__dirname, '..', '..', 'blueprints')]; }; @@ -1411,7 +1411,7 @@ Blueprint.defaultLookupPaths = function() { @return {Promise} */ function prepareConfirm(info) { - return info.checkForConflict().then(resolution => { + return info.checkForConflict().then((resolution) => { info.resolution = resolution; return info; }); @@ -1460,7 +1460,7 @@ function gatherConfirmationMessages(collection, info) { function isIgnored(info) { let fn = info.inputPath; - return Blueprint.ignoredFiles.some(ignoredFile => minimatch(fn, ignoredFile, { matchBase: true })); + return Blueprint.ignoredFiles.some((ignoredFile) => minimatch(fn, ignoredFile, { matchBase: true })); } /** @@ -1492,13 +1492,13 @@ function hasPathToken(files) { } function findAddonByName(addonOrProject, name) { - let addon = addonOrProject.addons.find(addon => addon.name === name); + let addon = addonOrProject.addons.find((addon) => addon.name === name); if (addon) { return addon; } - return addonOrProject.addons.find(addon => findAddonByName(addon, name)); + return addonOrProject.addons.find((addon) => findAddonByName(addon, name)); } function ensureTargetDirIsAddon(addonPath) { @@ -1548,7 +1548,7 @@ function isFilePath(fileInfo) { */ function dir(fullPath) { if (Blueprint._existsSync(fullPath)) { - return Blueprint._readdirSync(fullPath).map(fileName => path.join(fullPath, fileName)); + return Blueprint._readdirSync(fullPath).map((fileName) => path.join(fullPath, fileName)); } else { return []; } @@ -1573,7 +1573,7 @@ function finishProcessingForInstall(infos) { } function finishProcessingForUninstall(infos) { - let validInfos = infos.filter(info => fs.existsSync(info.outputPath)); + let validInfos = infos.filter((info) => fs.existsSync(info.outputPath)); validInfos.forEach(markToBeRemoved); return validInfos; diff --git a/lib/models/builder.js b/lib/models/builder.js index 7d069dc7c9..7bf140b1fc 100644 --- a/lib/models/builder.js +++ b/lib/models/builder.js @@ -133,7 +133,7 @@ class Builder extends CoreObject { let changes = sync.sync(); - return changes.map(op => op[1]); + return changes.map((op) => op[1]); } /** diff --git a/lib/models/command.js b/lib/models/command.js index 740f4cf33d..9dec3e64af 100644 --- a/lib/models/command.js +++ b/lib/models/command.js @@ -236,7 +236,7 @@ let Command = CoreObject.extend({ return Promise.resolve() .then(() => task.run(options)) - .catch(error => { + .catch((error) => { logger.info(`An error occurred running \`${name}\` from the \`${this.name}\` command.`, error.stack); throw error; @@ -351,8 +351,8 @@ let Command = CoreObject.extend({ // TODO: warn on duplicates and overwriting mergedAliases = []; - _.map(duplicateOptions, 'aliases').map(alias => { - alias.map(a => { + _.map(duplicateOptions, 'aliases').map((alias) => { + alias.map((a) => { mergedAliases.push(a); }); }); @@ -361,7 +361,7 @@ let Command = CoreObject.extend({ mergedOption = Object.assign.apply(null, duplicateOptions); // replace aliases with unique aliases - mergedOption.aliases = _.uniqBy(mergedAliases, alias => { + mergedOption.aliases = _.uniqBy(mergedAliases, (alias) => { if (typeof alias === 'object') { return alias[Object.keys(alias)[0]]; } @@ -551,11 +551,11 @@ let Command = CoreObject.extend({ this.registerOptions(); - let assembleAndValidateOption = function(option) { + let assembleAndValidateOption = function (option) { return this.assignOption(option, parsedOptions, commandOptions); }; - let validateParsed = function(key) { + let validateParsed = function (key) { // ignore 'argv', 'h', and 'help' if (!(key in commandOptions) && key !== 'argv' && key !== 'h' && key !== 'help') { this.ui.writeLine( @@ -570,7 +570,7 @@ let Command = CoreObject.extend({ } }; - this.availableOptions.forEach(option => { + this.availableOptions.forEach((option) => { if (typeof option.type !== 'string') { knownOpts[option.name] = option.type; } else if (option.type === 'Path') { @@ -654,7 +654,7 @@ let Command = CoreObject.extend({ let json = {}; this.registerOptions(options); - this._printableProperties.forEach(key => (json[key] = this[key])); + this._printableProperties.forEach((key) => (json[key] = this[key])); if (this.addAdditionalJsonForHelp) { this.addAdditionalJsonForHelp(json, options); diff --git a/lib/models/edit-file-diff.js b/lib/models/edit-file-diff.js index 23c740ed73..8d084c7c3a 100644 --- a/lib/models/edit-file-diff.js +++ b/lib/models/edit-file-diff.js @@ -37,7 +37,7 @@ class EditFileDiff { return hash({ diffString: readFile(resultHash.diffPath), currentString: readFile(resultHash.outputPath), - }).then(result => { + }).then((result) => { let appliedDiff = jsdiff.applyPatch(result.currentString.toString(), result.diffString.toString()); if (!appliedDiff) { diff --git a/lib/models/file-info.js b/lib/models/file-info.js index 0a497eff35..df350bb859 100644 --- a/lib/models/file-info.js +++ b/lib/models/file-info.js @@ -26,7 +26,7 @@ function diffHighlight(line) { } } -const NOOP = _ => _; +const NOOP = (_) => _; class FileInfo { constructor(options) { this.action = options.action; @@ -68,7 +68,7 @@ class FileInfo { } } - return this.ui.prompt(promptOptions).then(response => response.answer); + return this.ui.prompt(promptOptions).then((response) => response.answer); } displayDiff() { @@ -77,7 +77,7 @@ class FileInfo { return hash({ input: this.render(), output: readFile(info.outputPath), - }).then(result => { + }).then((result) => { let diff = jsdiff.createPatch( info.outputPath, result.output.toString().replace(rxEOL, '\n'), @@ -104,8 +104,8 @@ class FileInfo { let path = this.inputPath; let context = this.templateVariables; - return readFile(path).then(content => - lstat(path).then(fileStat => { + return readFile(path).then((content) => + lstat(path).then((fileStat) => { if (isBinaryFile(content, fileStat.size)) { return content; } else { @@ -121,16 +121,16 @@ class FileInfo { } checkForConflict() { - return this.render().then(input => { + return this.render().then((input) => { input = input.toString().replace(rxEOL, '\n'); return readFile(this.outputPath) - .then(output => { + .then((output) => { output = output.toString().replace(rxEOL, '\n'); return input === output ? 'identical' : 'confirm'; }) - .catch(e => { + .catch((e) => { if (e.code === 'ENOENT') { return 'none'; } @@ -143,9 +143,9 @@ class FileInfo { confirmOverwriteTask() { let info = this; - return function() { + return function () { function doConfirm() { - return info.confirmOverwrite(info.displayPath).then(action => { + return info.confirmOverwrite(info.displayPath).then((action) => { if (action === 'diff') { return info.displayDiff().then(doConfirm); } else if (action === 'edit') { diff --git a/lib/models/hardware-info.js b/lib/models/hardware-info.js index a2338fc32c..49406df6e7 100644 --- a/lib/models/hardware-info.js +++ b/lib/models/hardware-info.js @@ -10,7 +10,7 @@ function isUsingBatteryAcpi() { const { stdout } = execa.sync('acpi', ['--ac-adapter']); const lines = stdout.split('\n').filter(Boolean); - return lines.every(line => /off-line/.test(line)); + return lines.every((line) => /off-line/.test(line)); } catch (ex) { logger.warn(`Could not get battery status from acpi: ${ex}`); logger.warn(ex.stack); @@ -89,7 +89,7 @@ function isUsingBatteryUpower() { const { stdout } = execa.sync('upower', ['--enumerate']); const devices = stdout.split('\n').filter(Boolean); - return devices.some(device => { + return devices.some((device) => { const { stdout } = execa.sync('upower', ['--show-info', device]); return /\bpower supply:\s+yes\b/.test(stdout) && /\bstate:\s+discharging\b/.test(stdout); diff --git a/lib/models/instantiate-addons.js b/lib/models/instantiate-addons.js index 24f3b79eb2..e48d422617 100644 --- a/lib/models/instantiate-addons.js +++ b/lib/models/instantiate-addons.js @@ -41,7 +41,7 @@ function instantiateAddons(parent, project, addonPackages) { let graph = new DAGMap(); let addonInfo, emberAddonConfig; - addonNames.forEach(name => { + addonNames.forEach((name) => { addonInfo = addonPackages[name]; emberAddonConfig = addonInfo.pkg['ember-addon']; @@ -98,7 +98,7 @@ function instantiateAddons(parent, project, addonPackages) { logger.info( ' addon info %o', - addons.map(addon => ({ + addons.map((addon) => ({ name: addon.name, times: { initialize: addon.constructor._meta_.initializeIn, diff --git a/lib/models/instrumentation.js b/lib/models/instrumentation.js index 4e5b946c0a..3ae48cdc0e 100644 --- a/lib/models/instrumentation.js +++ b/lib/models/instrumentation.js @@ -26,7 +26,7 @@ _enableFSMonitorIfInstrumentationEnabled(); function _getHardwareInfo(platform) { const startTime = process.hrtime(); - Object.getOwnPropertyNames(hwinfo).forEach(metric => (platform[metric] = hwinfo[metric]())); + Object.getOwnPropertyNames(hwinfo).forEach((metric) => (platform[metric] = hwinfo[metric]())); const collectionTime = process.hrtime(startTime); @@ -211,7 +211,7 @@ class Instrumentation { _invokeAddonHook(name, instrumentationInfo) { if (this.project && this.project.addons.length) { - this.project.addons.forEach(addon => { + this.project.addons.forEach((addon) => { if (typeof addon.instrumentation === 'function') { addon.instrumentation(name, instrumentationInfo); } diff --git a/lib/models/package-info-cache/index.js b/lib/models/package-info-cache/index.js index 3b8b340be2..1e307e0552 100644 --- a/lib/models/package-info-cache/index.js +++ b/lib/models/package-info-cache/index.js @@ -55,7 +55,7 @@ class PackageInfoCache { hasErrors() { let paths = Object.keys(this.entries); - if (paths.find(entryPath => this.getEntry(entryPath).hasErrors())) { + if (paths.find((entryPath) => this.getEntry(entryPath).hasErrors())) { return true; } @@ -72,7 +72,7 @@ class PackageInfoCache { showErrors() { let paths = Object.keys(this.entries).sort(); - paths.forEach(entryPath => { + paths.forEach((entryPath) => { this._showObjErrors(this.getEntry(entryPath)); }); } @@ -110,7 +110,7 @@ class PackageInfoCache { rootPath = obj.realPath; } - errorEntries.forEach(errorEntry => { + errorEntries.forEach((errorEntry) => { switch (errorEntry.type) { case Errors.ERROR_PACKAGE_JSON_MISSING: logger.info(` does not exist`); @@ -131,7 +131,7 @@ class PackageInfoCache { logger.info(` specifies a missing dependency '${errorEntry.data[0]}'`); } else { logger.info(` specifies some missing dependencies:`); - errorEntry.data.forEach(dependencyName => { + errorEntry.data.forEach((dependencyName) => { logger.info(` ${dependencyName}`); }); } @@ -187,7 +187,7 @@ class PackageInfoCache { // create a PackageInfo unless there is really a directory at the // suggested location. The created addon may internally have errors, // as with any other PackageInfo. - projectInstance.supportedInternalAddonPaths().forEach(internalAddonPath => { + projectInstance.supportedInternalAddonPaths().forEach((internalAddonPath) => { if (getRealDirectoryPath(internalAddonPath)) { logger.info('Reading package for internal addon: %o', internalAddonPath); pkgInfo.addInternalAddon(this._readPackage(internalAddonPath)); @@ -222,7 +222,7 @@ class PackageInfoCache { reloadProjects() { let projects = this.projects.slice(); this._clear(); - projects.forEach(project => this.loadProject(project)); + projects.forEach((project) => this.loadProject(project)); } /** @@ -274,7 +274,7 @@ class PackageInfoCache { logger.info('Resolving dependencies...'); let packageInfos = this._getPackageInfos(); - packageInfos.forEach(pkgInfo => { + packageInfos.forEach((pkgInfo) => { if (!pkgInfo.processed) { let pkgs = pkgInfo.addDependencies(pkgInfo.pkg.dependencies); if (pkgs) { @@ -331,7 +331,7 @@ class PackageInfoCache { _getPackageInfos() { let result = []; - Object.keys(this.entries).forEach(path => { + Object.keys(this.entries).forEach((path) => { let entry = this.entries[path]; if (entry instanceof PackageInfo) { result.push(entry); @@ -549,7 +549,7 @@ class PackageInfoCache { let paths = emberAddonInfo.paths; if (paths) { - paths.forEach(p => { + paths.forEach((p) => { let addonPath = path.join(realPath, p); // real path, though may not exist. logger.info('Adding in-repo-addon at %o', addonPath); let addonPkgInfo = this._readPackage(addonPath); // may have errors in the addon package. @@ -636,7 +636,7 @@ class PackageInfoCache { logger.info('Creating new NodeModulesList instance for %o', realPath); nodeModulesList = new NodeModulesList(realPath, this); - const entries = fs.readdirSync(realPath).filter(fileName => { + const entries = fs.readdirSync(realPath).filter((fileName) => { if (fileName.startsWith('.') || fileName.startsWith('_')) { // we explicitly want to ignore these, according to the // definition of a valid package name. @@ -651,7 +651,7 @@ class PackageInfoCache { } }); // should not fail because getRealDirectoryPath passed - entries.forEach(entryName => { + entries.forEach((entryName) => { // entries should be either a package or a scoping directory. I think // there can also be files, but we'll ignore those. diff --git a/lib/models/package-info-cache/package-info.js b/lib/models/package-info-cache/package-info.js index dca22a3645..d7863d4a4e 100644 --- a/lib/models/package-info-cache/package-info.js +++ b/lib/models/package-info-cache/package-info.js @@ -189,7 +189,7 @@ class PackageInfo { let missingDependencies = []; - dependencyNames.forEach(dependencyName => { + dependencyNames.forEach((dependencyName) => { logger.info('%s: Trying to find dependency %o', this.pkg.name, dependencyName); let dependencyPackage; @@ -244,13 +244,13 @@ class PackageInfo { let result = []; if (Array.isArray(packageInfoList)) { if (excludeFn) { - packageInfoList = packageInfoList.filter(pkgInfo => !excludeFn(pkgInfo)); + packageInfoList = packageInfoList.filter((pkgInfo) => !excludeFn(pkgInfo)); } - packageInfoList.forEach(pkgInfo => result.push(pkgInfo)); + packageInfoList.forEach((pkgInfo) => result.push(pkgInfo)); } else { // We're going to assume we have a map of name to packageInfo - Object.keys(packageInfoList).forEach(name => { + Object.keys(packageInfoList).forEach((name) => { let pkgInfo = packageInfoList[name]; if (!excludeFn || !excludeFn(pkgInfo)) { result.push(pkgInfo); @@ -258,7 +258,7 @@ class PackageInfo { }); } - result.sort(lexicographically).forEach(pkgInfo => pushUnique(addonPackageList, pkgInfo)); + result.sort(lexicographically).forEach((pkgInfo) => pushUnique(addonPackageList, pkgInfo)); return addonPackageList; } @@ -274,7 +274,7 @@ class PackageInfo { this.addPackages( addonPackageList, this.dependencyPackages, - pkgInfo => !pkgInfo.isAddon() || pkgInfo.name === 'ember-cli' + (pkgInfo) => !pkgInfo.isAddon() || pkgInfo.name === 'ember-cli' ); this.addPackages(addonPackageList, this.inRepoAddons); @@ -294,8 +294,8 @@ class PackageInfo { this.addPackages(addonPackageList, project.isEmberCLIAddon() ? [this] : null); this.addPackages(addonPackageList, this.cliInfo ? this.cliInfo.inRepoAddons : null); this.addPackages(addonPackageList, this.internalAddons); - this.addPackages(addonPackageList, this.devDependencyPackages, pkgInfo => !pkgInfo.isAddon()); - this.addPackages(addonPackageList, this.dependencyPackages, pkgInfo => !pkgInfo.isAddon()); + this.addPackages(addonPackageList, this.devDependencyPackages, (pkgInfo) => !pkgInfo.isAddon()); + this.addPackages(addonPackageList, this.dependencyPackages, (pkgInfo) => !pkgInfo.isAddon()); this.addPackages(addonPackageList, this.inRepoAddons); return addonPackageList; @@ -317,7 +317,7 @@ class PackageInfo { let packageMap = Object.create(null); - validPackages.forEach(pkgInfo => { + validPackages.forEach((pkgInfo) => { let addonInfo = new AddonInfo(pkgInfo.name, pkgInfo.realPath, pkgInfo.pkg); if (!excludeFn || !excludeFn(addonInfo)) { packageMap[pkgInfo.name] = addonInfo; @@ -328,11 +328,11 @@ class PackageInfo { } getValidPackages(addonPackageList) { - return addonPackageList.filter(pkgInfo => pkgInfo.valid); + return addonPackageList.filter((pkgInfo) => pkgInfo.valid); } getInvalidPackages(addonPackageList) { - return addonPackageList.filter(pkgInfo => !pkgInfo.valid); + return addonPackageList.filter((pkgInfo) => !pkgInfo.valid); } dumpInvalidAddonPackages(addonPackageList) { @@ -354,7 +354,7 @@ class PackageInfo { msg = `${msg}\n specifies an invalid, malformed or missing addon at relative path '${relativePath}'`; } else { msg = `${msg}\n specifies invalid, malformed or missing addons at relative paths`; - invalidPackages.forEach(packageInfo => { + invalidPackages.forEach((packageInfo) => { let relativePath = path.relative(this.realPath, packageInfo.realPath); msg = `${msg}\n '${relativePath}'`; }); diff --git a/lib/models/project.js b/lib/models/project.js index bd567465bc..ec35a9cc02 100644 --- a/lib/models/project.js +++ b/lib/models/project.js @@ -154,15 +154,15 @@ class Project { NULL_PROJECT = new Project(processCwd, {}, ui, cli); - NULL_PROJECT.isEmberCLIProject = function() { + NULL_PROJECT.isEmberCLIProject = function () { return false; }; - NULL_PROJECT.isEmberCLIAddon = function() { + NULL_PROJECT.isEmberCLIAddon = function () { return false; }; - NULL_PROJECT.name = function() { + NULL_PROJECT.name = function () { return path.basename(process.cwd()); }; @@ -455,7 +455,7 @@ class Project { this.discoverAddons(); this.addons = instantiateAddons(this, this, this.addonPackages); - this.addons.forEach(addon => logger.info('addon: %s', addon.name)); + this.addons.forEach((addon) => logger.info('addon: %s', addon.name)); } /** @@ -469,7 +469,7 @@ class Project { addonCommands() { const Command = require('../models/command'); let commands = Object.create(null); - this.addons.forEach(addon => { + this.addons.forEach((addon) => { if (!addon.includedCommands) { return; } diff --git a/lib/models/watcher.js b/lib/models/watcher.js index 68f909e54b..38d8416ccc 100644 --- a/lib/models/watcher.js +++ b/lib/models/watcher.js @@ -86,13 +86,13 @@ module.exports = class Watcher extends CoreObject { _totalTime(hash) { const sumNodes = (node, cb) => { let total = 0; - node.visitPreOrder(node => { + node.visitPreOrder((node) => { total += cb(node); }); return total; }; - return sumNodes(hash.graph.__heimdall__, node => node.stats.time.self); + return sumNodes(hash.graph.__heimdall__, (node) => node.stats.time.self); } didError(error) { diff --git a/lib/tasks/bower-install.js b/lib/tasks/bower-install.js index 93c387d46e..e4f6a1e6b6 100644 --- a/lib/tasks/bower-install.js +++ b/lib/tasks/bower-install.js @@ -32,14 +32,14 @@ class BowerInstallTask extends Task { } return this.resolveBower() - .catch(error => { + .catch((error) => { if (error.message.indexOf("Cannot find module 'bower'") === -1) { throw error; } return this.installBower().then(() => this.resolveBower()); }) - .then(bowerPath => this.importBower(bowerPath)); + .then((bowerPath) => this.importBower(bowerPath)); } installBower() { @@ -52,7 +52,7 @@ class BowerInstallTask extends Task { return execa('npm', ['install', 'bower@^1.3.12'], { cwd: cliPath }) .finally(() => ui.stopProgress()) - .catch(error => this.handleInstallBowerError(error)) + .catch((error) => this.handleInstallBowerError(error)) .then(() => ui.writeLine(chalk.green('npm: Installed bower'))); } diff --git a/lib/tasks/generate-from-blueprint.js b/lib/tasks/generate-from-blueprint.js index af939ab392..45ab47d74a 100644 --- a/lib/tasks/generate-from-blueprint.js +++ b/lib/tasks/generate-from-blueprint.js @@ -64,7 +64,7 @@ class GenerateTask extends Task { await mainBlueprint[this.blueprintFunction](blueprintOptions); if (testBlueprint) { if (testBlueprint.locals === Blueprint.prototype.locals) { - testBlueprint.locals = function(options) { + testBlueprint.locals = function (options) { return mainBlueprint.locals(options); }; } @@ -81,7 +81,7 @@ class GenerateTask extends Task { } if (addonBlueprint.locals === Blueprint.prototype.locals) { - addonBlueprint.locals = function(options) { + addonBlueprint.locals = function (options) { return mainBlueprint.locals(options); }; } diff --git a/lib/tasks/install-blueprint.js b/lib/tasks/install-blueprint.js index 432ff286c3..43b1acade1 100644 --- a/lib/tasks/install-blueprint.js +++ b/lib/tasks/install-blueprint.js @@ -43,7 +43,7 @@ class InstallBlueprintTask extends Task { installOptions = merge(installOptions, options || {}); - return this._resolveBlueprint(blueprintOption).then(blueprint => { + return this._resolveBlueprint(blueprintOption).then((blueprint) => { logger.info(`Installing blueprint into "${target}" ...`); return blueprint.install(installOptions); }); @@ -53,7 +53,7 @@ class InstallBlueprintTask extends Task { name = name || 'app'; logger.info(`Resolving blueprint "${name}" ...`); - return this._lookupLocalBlueprint(name).catch(error => this._handleLocalLookupFailure(name, error)); + return this._lookupLocalBlueprint(name).catch((error) => this._handleLocalLookupFailure(name, error)); } _lookupLocalBlueprint(name) { diff --git a/lib/tasks/npm-task.js b/lib/tasks/npm-task.js index aecfe8e48b..87c0db76af 100644 --- a/lib/tasks/npm-task.js +++ b/lib/tasks/npm-task.js @@ -44,11 +44,11 @@ class NpmTask extends Task { checkYarn() { return this.yarn(['--version']) - .then(result => { + .then((result) => { let version = result.stdout; logger.info('yarn --version: %s', version); }) - .catch(error => { + .catch((error) => { logger.error('yarn --version failed: %s', error); throw error; }); @@ -56,7 +56,7 @@ class NpmTask extends Task { checkNpmVersion() { return this.npm(['--version']) - .then(result => { + .then((result) => { let version = result.stdout; logger.info('npm --version: %s', version); @@ -80,7 +80,7 @@ class NpmTask extends Task { return { npmVersion: version }; }) - .catch(error => { + .catch((error) => { logger.error('npm --version failed: %s', error); if (error.code === 'ENOENT') { @@ -112,7 +112,7 @@ class NpmTask extends Task { if (this.useYarn === true) { logger.info('yarn requested -> trying yarn'); - return this.checkYarn().catch(error => { + return this.checkYarn().catch((error) => { if (error.code === 'ENOENT') { throw new SilentError('Yarn could not be found.'); } @@ -146,7 +146,7 @@ class NpmTask extends Task { run(options) { this.useYarn = options.useYarn; - return this.findPackageManager().then(result => { + return this.findPackageManager().then((result) => { let ui = this.ui; let startMessage = this.formatStartMessage(options.packages); let completeMessage = this.formatCompleteMessage(options.packages); diff --git a/lib/tasks/server/express-server.js b/lib/tasks/server/express-server.js index 665f3d3394..856cc283da 100644 --- a/lib/tasks/server/express-server.js +++ b/lib/tasks/server/express-server.js @@ -19,7 +19,7 @@ class ExpressServerTask extends Task { this.https = this.https || require('https'); let serverRestartDelayTime = this.serverRestartDelayTime || 100; - this.scheduleServerRestart = debounce(function() { + this.scheduleServerRestart = debounce(function () { this.restartHttpServer(); }, serverRestartDelayTime); } @@ -51,7 +51,7 @@ class ExpressServerTask extends Task { // when we need to restart. this.sockets = {}; this.nextSocketId = 0; - this.httpServer.on('connection', socket => { + this.httpServer.on('connection', (socket) => { let socketId = this.nextSocketId++; this.sockets[socketId] = socket; @@ -102,7 +102,7 @@ class ExpressServerTask extends Task { return mapSeries( this.project.addons, - function(addon) { + function (addon) { if (addon.serverMiddleware) { return addon.serverMiddleware({ app: this.app, @@ -166,7 +166,7 @@ class ExpressServerTask extends Task { this.ui.writeLine(chalk.green('Server restarted.')); this.ui.writeLine(''); }) - .catch(err => { + .catch((err) => { this.ui.writeError(err); }) .finally(() => { @@ -184,7 +184,7 @@ class ExpressServerTask extends Task { if (!this.httpServer) { return resolve(); } - this.httpServer.close(err => { + this.httpServer.close((err) => { if (err) { reject(err); return; diff --git a/lib/tasks/server/livereload-server.js b/lib/tasks/server/livereload-server.js index ade03118ea..8eb2c36bf6 100644 --- a/lib/tasks/server/livereload-server.js +++ b/lib/tasks/server/livereload-server.js @@ -69,7 +69,7 @@ module.exports = class LiveReloadServer { if (options.liveReload) { if (options.liveReloadPort && options.port !== options.liveReloadPort) { - return this.createServerforCustomPort(options, Server).catch(error => { + return this.createServerforCustomPort(options, Server).catch((error) => { if (error !== null && typeof error === 'object' && error.code === 'EADDRINUSE') { let url = `http${options.ssl ? 's' : ''}://${this.displayHost(options.liveReloadHost)}:${ options.liveReloadPort @@ -94,7 +94,7 @@ module.exports = class LiveReloadServer { // Reload on file changes this.watcher.on( 'change', - function() { + function () { try { this.didChange.apply(this, arguments); } catch (e) { @@ -141,7 +141,7 @@ module.exports = class LiveReloadServer { createServerforCustomPort(options, Server) { let instance; - Server.prototype.error = function() { + Server.prototype.error = function () { instance.error.apply(instance, arguments); }; let serverOptions = { @@ -184,7 +184,7 @@ module.exports = class LiveReloadServer { if (this.project.liveReloadFilterPatterns.length > 0) { let filePath = path.relative(this.project.root, options.filePath || ''); - result = this.project.liveReloadFilterPatterns.every(pattern => pattern.test(filePath) === false); + result = this.project.liveReloadFilterPatterns.every((pattern) => pattern.test(filePath) === false); if (result === false) { this.writeSkipBanner(filePath); diff --git a/lib/tasks/server/middleware/broccoli-watcher/index.js b/lib/tasks/server/middleware/broccoli-watcher/index.js index 3f474ff650..03669a9930 100644 --- a/lib/tasks/server/middleware/broccoli-watcher/index.js +++ b/lib/tasks/server/middleware/broccoli-watcher/index.js @@ -46,7 +46,7 @@ class WatcherAddon { // Find asset and set response headers, if no file has been found, reset url for proxy stuff // that comes afterwards - middleware(req, res, err => { + middleware(req, res, (err) => { req.url = oldURL; if (err) { logger.error('err', err); diff --git a/lib/tasks/server/middleware/proxy-server/index.js b/lib/tasks/server/middleware/proxy-server/index.js index 75dddc3a12..917a6d1866 100644 --- a/lib/tasks/server/middleware/proxy-server/index.js +++ b/lib/tasks/server/middleware/proxy-server/index.js @@ -26,7 +26,7 @@ class ProxyServerAddon { timeout: options.proxyInTimeout, }); - proxy.on('error', e => { + proxy.on('error', (e) => { options.ui.writeLine(`Error proxying to ${options.proxy}`); options.ui.writeError(e); }); diff --git a/lib/utilities/clean-remove.js b/lib/utilities/clean-remove.js index 2d81c53440..1310df4192 100644 --- a/lib/utilities/clean-remove.js +++ b/lib/utilities/clean-remove.js @@ -10,11 +10,11 @@ function cleanRemove(fileInfo) { .stat(fileInfo.outputPath) .then(() => fs.remove(fileInfo.outputPath)) .then(() => { - let paths = walkUp(fileInfo.displayPath).map(thePath => path.join(fileInfo.outputBasePath, thePath)); + let paths = walkUp(fileInfo.displayPath).map((thePath) => path.join(fileInfo.outputBasePath, thePath)); return paths.reduce( (chainedPromise, thePath) => - chainedPromise.then(wasShortCircuited => { + chainedPromise.then((wasShortCircuited) => { if (wasShortCircuited) { // optimization that says since my child dir wasn't empty, // I can't be empty, so keep skipping @@ -22,7 +22,7 @@ function cleanRemove(fileInfo) { } // get list of files remaining in this dir - return fs.readdir(thePath).then(paths => { + return fs.readdir(thePath).then((paths) => { if (paths.length) { // don't check parent dirs since this one isn't empty return true; @@ -34,7 +34,7 @@ function cleanRemove(fileInfo) { Promise.resolve() ); }) - .catch(err => { + .catch((err) => { if (err.code !== 'ENOENT') { throw err; } diff --git a/lib/utilities/deprecate.js b/lib/utilities/deprecate.js index 4906bd5784..6309970e4b 100644 --- a/lib/utilities/deprecate.js +++ b/lib/utilities/deprecate.js @@ -2,7 +2,7 @@ const chalk = require('chalk'); -module.exports = function(message, test) { +module.exports = function (message, test) { if (test) { console.log(chalk.yellow(`DEPRECATION: ${message}`)); } diff --git a/lib/utilities/execa.js b/lib/utilities/execa.js index 0b22b6610f..e09568a416 100644 --- a/lib/utilities/execa.js +++ b/lib/utilities/execa.js @@ -5,13 +5,13 @@ const logger = require('heimdalljs-logger')('ember-cli:execa'); function _execa(cmd, args, opts) { logger.info('execa(%j, %j)', cmd, args); - return Promise.resolve(execa(cmd, args, opts)).then(result => { + return Promise.resolve(execa(cmd, args, opts)).then((result) => { logger.info('execa(%j, %j) -> code: %d', cmd, args, result.code); return result; }); } -_execa.sync = function(cmd, args, opts) { +_execa.sync = function (cmd, args, opts) { logger.info('execa.sync(%j, %j)', cmd, args); let result = execa.sync(cmd, args, opts); logger.info('execa.sync(%j, %j) -> code: %d', cmd, args, result.code); diff --git a/lib/utilities/find-addon-by-name.js b/lib/utilities/find-addon-by-name.js index 56ecbef096..be5098b06b 100644 --- a/lib/utilities/find-addon-by-name.js +++ b/lib/utilities/find-addon-by-name.js @@ -29,13 +29,13 @@ let HAS_FOUND_ADDON_BY_UNSCOPED_NAME = Object.create(null); */ module.exports = function findAddonByName(addons, name) { let unscopedName = unscope(name); - let exactMatchFromPkg = addons.find(addon => addon.pkg && addon.pkg.name === name); + let exactMatchFromPkg = addons.find((addon) => addon.pkg && addon.pkg.name === name); if (exactMatchFromPkg) { return exactMatchFromPkg; } - let exactMatchFromIndex = addons.find(addon => addon.name === name); + let exactMatchFromIndex = addons.find((addon) => addon.name === name); if (exactMatchFromIndex) { let pkg = exactMatchFromIndex.pkg; @@ -51,7 +51,7 @@ module.exports = function findAddonByName(addons, name) { return exactMatchFromIndex; } - let unscopedMatchFromIndex = addons.find(addon => addon.name && unscope(addon.name) === unscopedName); + let unscopedMatchFromIndex = addons.find((addon) => addon.name && unscope(addon.name) === unscopedName); if (unscopedMatchFromIndex) { if (HAS_FOUND_ADDON_BY_UNSCOPED_NAME[name] !== true) { HAS_FOUND_ADDON_BY_UNSCOPED_NAME[name] = true; @@ -66,7 +66,7 @@ module.exports = function findAddonByName(addons, name) { return null; }; -module.exports._clearCaches = function() { +module.exports._clearCaches = function () { HAS_FOUND_ADDON_BY_NAME = Object.create(null); HAS_FOUND_ADDON_BY_UNSCOPED_NAME = Object.create(null); }; diff --git a/lib/utilities/find-build-file.js b/lib/utilities/find-build-file.js index eb3f497326..1357bbd7e9 100644 --- a/lib/utilities/find-build-file.js +++ b/lib/utilities/find-build-file.js @@ -2,7 +2,7 @@ const findUp = require('find-up'); const path = require('path'); -module.exports = function(file, dir) { +module.exports = function (file, dir) { let buildFilePath = findUp.sync(file, { cwd: dir }); // Note: In the future this should throw diff --git a/lib/utilities/get-option-args.js b/lib/utilities/get-option-args.js index 2442228d06..34198cecef 100644 --- a/lib/utilities/get-option-args.js +++ b/lib/utilities/get-option-args.js @@ -1,6 +1,6 @@ 'use strict'; -module.exports = function(option, commandArgs) { +module.exports = function (option, commandArgs) { let results = [], value, i; diff --git a/lib/utilities/get-package-base-name.js b/lib/utilities/get-package-base-name.js index bd6b6ceaf8..3ff984a76a 100644 --- a/lib/utilities/get-package-base-name.js +++ b/lib/utilities/get-package-base-name.js @@ -2,7 +2,7 @@ const npa = require('npm-package-arg'); -module.exports = function(name) { +module.exports = function (name) { if (!name) { return null; } diff --git a/lib/utilities/get-serve-url.js b/lib/utilities/get-serve-url.js index 0c7165a429..4c80000841 100644 --- a/lib/utilities/get-serve-url.js +++ b/lib/utilities/get-serve-url.js @@ -2,7 +2,7 @@ const cleanBaseURL = require('clean-base-url'); -module.exports = function(options, project) { +module.exports = function (options, project) { let config = project.config(options.environment); let baseURL = config.rootURL === '' ? '/' : cleanBaseURL(config.rootURL || config.baseURL || '/'); diff --git a/lib/utilities/heimdall-progress.js b/lib/utilities/heimdall-progress.js index ee9eb7702b..a47864f878 100644 --- a/lib/utilities/heimdall-progress.js +++ b/lib/utilities/heimdall-progress.js @@ -9,11 +9,11 @@ module.exports = function progress(heimdalljs = require('heimdalljs')) { } return stack - .filter(name => name !== 'heimdall') + .filter((name) => name !== 'heimdall') .reverse() .join(' > '); }; -module.exports.format = function(text) { +module.exports.format = function (text) { return require('chalk').green('building... ') + (text ? `[${text}]` : ''); }; diff --git a/lib/utilities/json-generator.js b/lib/utilities/json-generator.js index d77615fff9..6501685398 100644 --- a/lib/utilities/json-generator.js +++ b/lib/utilities/json-generator.js @@ -29,7 +29,7 @@ class JsonGenerator { json.commands = []; json.addons = []; - Object.keys(this.commands).forEach(function(commandName) { + Object.keys(this.commands).forEach(function (commandName) { this._addCommandHelpToJson(commandName, commandOptions, json); }, this); @@ -41,7 +41,7 @@ class JsonGenerator { addonJson.commands = []; json.addons.push(addonJson); - Object.keys(this.commands).forEach(function(commandName) { + Object.keys(this.commands).forEach(function (commandName) { this._addCommandHelpToJson(commandName, commandOptions, addonJson); }, this); }); diff --git a/lib/utilities/markdown-color.js b/lib/utilities/markdown-color.js index cc5c11e8c7..d7cb59fcf1 100644 --- a/lib/utilities/markdown-color.js +++ b/lib/utilities/markdown-color.js @@ -74,7 +74,7 @@ class MarkdownColor { let styles = Object.keys(this.tokens); input = input.replace(/^/gm, indent); - styles.reverse().map(style => { + styles.reverse().map((style) => { input = input.replace(this.tokens[style].pattern, this.tokens[style].render); }); input = input.replace(/~\^(.*)~\^/g, escapeToken); @@ -128,7 +128,7 @@ class MarkdownColor { styles = [checkStyleName(renderer, styleNames)]; } - return function(match, pattern) { + return function (match, pattern) { return styles.reverse().reduce((previous, current) => renderer[current](previous), pattern); }; } diff --git a/lib/utilities/merge-blueprint-options.js b/lib/utilities/merge-blueprint-options.js index 1420638b0b..fc240e8fd0 100644 --- a/lib/utilities/merge-blueprint-options.js +++ b/lib/utilities/merge-blueprint-options.js @@ -14,7 +14,7 @@ const Blueprint = require('../models/blueprint'); * beforeRun: mergeBlueprintOptions * }) */ -module.exports = function(rawArgs) { +module.exports = function (rawArgs) { if (rawArgs.length === 0) { return; } diff --git a/lib/utilities/open-editor.js b/lib/utilities/open-editor.js index 2fa869fd56..99260ff34c 100644 --- a/lib/utilities/open-editor.js +++ b/lib/utilities/open-editor.js @@ -17,7 +17,7 @@ function openEditor(file) { let editProcess = openEditor._spawn(editor, args, { stdio: 'inherit' }); return new Promise((resolve, reject) => { - editProcess.on('close', code => { + editProcess.on('close', (code) => { if (code === 0) { resolve(); } else { @@ -29,15 +29,15 @@ function openEditor(file) { }); } -openEditor.canEdit = function() { +openEditor.canEdit = function () { return openEditor._env().EDITOR !== undefined; }; -openEditor._env = function() { +openEditor._env = function () { return process.env; }; -openEditor._spawn = function() { +openEditor._spawn = function () { return spawn.apply(this, arguments); }; diff --git a/lib/utilities/platform-checker.js b/lib/utilities/platform-checker.js index 65b4bd66bf..5234cc75dd 100644 --- a/lib/utilities/platform-checker.js +++ b/lib/utilities/platform-checker.js @@ -10,7 +10,7 @@ const nodeVersions = new Set(); for (let jobName in ci.jobs) { let job = ci.jobs[jobName]; - job.steps.forEach(step => { + job.steps.forEach((step) => { let isSetupNode = step.uses === 'actions/setup-node@v1'; if (isSetupNode && step.with['node-version'].includes('${{') === false) { nodeVersions.add(step.with['node-version']); @@ -18,7 +18,7 @@ for (let jobName in ci.jobs) { }); if (job.strategy && job.strategy.matrix && job.strategy.matrix['node-version']) { - job.strategy.matrix['node-version'].forEach(version => nodeVersions.add(version)); + job.strategy.matrix['node-version'].forEach((version) => nodeVersions.add(version)); } } diff --git a/lib/utilities/print-command.js b/lib/utilities/print-command.js index 9230c8232c..436348a75b 100644 --- a/lib/utilities/print-command.js +++ b/lib/utilities/print-command.js @@ -3,7 +3,7 @@ const chalk = require('chalk'); const EOL = require('os').EOL; -module.exports = function(initialMargin, shouldDescriptionBeGrey) { +module.exports = function (initialMargin, shouldDescriptionBeGrey) { initialMargin = initialMargin || ''; let output = ''; @@ -14,7 +14,7 @@ module.exports = function(initialMargin, shouldDescriptionBeGrey) { if (options.length) { output += ` ${chalk.yellow( options - .map(option => { + .map((option) => { // blueprints we insert brackets, commands already have them if (option.indexOf('<') === 0) { return option; @@ -44,12 +44,12 @@ module.exports = function(initialMargin, shouldDescriptionBeGrey) { // aliases: a b c if (this.aliases && this.aliases.length) { - output += `${EOL + initialMargin} ${chalk.grey(`aliases: ${this.aliases.filter(a => a).join(', ')}`)}`; + output += `${EOL + initialMargin} ${chalk.grey(`aliases: ${this.aliases.filter((a) => a).join(', ')}`)}`; } // --available-option (Required) (Default: value) // ... - options.forEach(option => { + options.forEach((option) => { output += `${EOL + initialMargin} ${chalk.cyan(`--${option.name}`)}`; if (option.values) { @@ -77,7 +77,7 @@ module.exports = function(initialMargin, shouldDescriptionBeGrey) { if (option.aliases && option.aliases.length) { output += `${EOL + initialMargin} ${chalk.grey( `aliases: ${option.aliases - .map(a => { + .map((a) => { if (typeof a === 'string') { return (a.length > 4 ? '--' : '-') + a + (option.type === Boolean ? '' : ' '); } else { diff --git a/lib/utilities/will-interrupt-process.js b/lib/utilities/will-interrupt-process.js index 65d3a77162..748d670bd9 100644 --- a/lib/utilities/will-interrupt-process.js +++ b/lib/utilities/will-interrupt-process.js @@ -165,7 +165,7 @@ function trapWindowsSignals(_process) { // This is required to capture Ctrl + C on Windows stdin.setRawMode(true); - windowsCtrlCTrap = function(data) { + windowsCtrlCTrap = function (data) { if (data.length === 1 && data[0] === 0x03) { _process.emit('SIGINT'); } diff --git a/lib/utilities/windows-admin.js b/lib/utilities/windows-admin.js index 7348d22c44..c1a305c48e 100644 --- a/lib/utilities/windows-admin.js +++ b/lib/utilities/windows-admin.js @@ -84,7 +84,7 @@ class WindowsSymlinkChecker { * @return {Promise} Object describing whether we're on windows and if admin rights exist */ checkIfSymlinksNeedToBeEnabled() { - return new Promise(resolve => { + return new Promise((resolve) => { if (!this.isWindows) { resolve({ windows: false, @@ -115,7 +115,7 @@ class WindowsSymlinkChecker { let ui = this.ui; let exec = this.exec; - return new Promise(resolve => { + return new Promise((resolve) => { exec('NET SESSION', (error, stdout, stderr) => { let elevated = !stderr || stderr.length === 0; diff --git a/tests/acceptance/addon-dummy-generate-test.js b/tests/acceptance/addon-dummy-generate-test.js index 21c7281ec2..ce1d2a01d8 100644 --- a/tests/acceptance/addon-dummy-generate-test.js +++ b/tests/acceptance/addon-dummy-generate-test.js @@ -13,23 +13,23 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember generate in-addon-dummy', function() { +describe('Acceptance: ember generate in-addon-dummy', function () { this.timeout(20000); - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { let tmpdir = await mkTmpDirIn(tmproot); process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { process.chdir(root); return fs.remove(tmproot); }); @@ -47,12 +47,12 @@ describe('Acceptance: ember generate in-addon-dummy', function() { function generateInAddon(args) { let generateArgs = ['generate'].concat(args); - return initAddon().then(function() { + return initAddon().then(function () { return ember(generateArgs); }); } - it('dummy blueprint foo', async function() { + it('dummy blueprint foo', async function () { await generateInAddon(['blueprint', 'foo', '--dummy']); expect(file('blueprints/foo/index.js')).to.contain( @@ -73,7 +73,7 @@ describe('Acceptance: ember generate in-addon-dummy', function() { ); }); - it('dummy blueprint foo/bar', async function() { + it('dummy blueprint foo/bar', async function () { await generateInAddon(['blueprint', 'foo/bar', '--dummy']); expect(file('blueprints/foo/bar/index.js')).to.contain( @@ -94,7 +94,7 @@ describe('Acceptance: ember generate in-addon-dummy', function() { ); }); - it('dummy http-mock foo', async function() { + it('dummy http-mock foo', async function () { await generateInAddon(['http-mock', 'foo', '--dummy']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -151,7 +151,7 @@ describe('Acceptance: ember generate in-addon-dummy', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('dummy http-mock foo-bar', async function() { + it('dummy http-mock foo-bar', async function () { await generateInAddon(['http-mock', 'foo-bar', '--dummy']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -208,7 +208,7 @@ describe('Acceptance: ember generate in-addon-dummy', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('dummy http-proxy foo', async function() { + it('dummy http-proxy foo', async function () { await generateInAddon(['http-proxy', 'foo', 'http://localhost:5000', '--dummy']); expect(file('server/index.js')).to.contain('proxies.forEach(route => route(app));'); @@ -236,7 +236,7 @@ describe('Acceptance: ember generate in-addon-dummy', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('dummy server', async function() { + it('dummy server', async function () { await generateInAddon(['server', '--dummy']); expect(file('server/index.js')).to.exist; }); diff --git a/tests/acceptance/addon-generate-test.js b/tests/acceptance/addon-generate-test.js index 19c86bc8d3..367744ddf0 100644 --- a/tests/acceptance/addon-generate-test.js +++ b/tests/acceptance/addon-generate-test.js @@ -13,23 +13,23 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember generate in-addon', function() { +describe('Acceptance: ember generate in-addon', function () { this.timeout(20000); - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { let tmpdir = await mkTmpDirIn(tmproot); process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { process.chdir(root); return fs.remove(tmproot); }); @@ -52,12 +52,12 @@ describe('Acceptance: ember generate in-addon', function() { name = arguments[1]; } - return initAddon(name).then(function() { + return initAddon(name).then(function () { return ember(generateArgs); }); } - it('in-addon addon-import cannot be called directly', async function() { + it('in-addon addon-import cannot be called directly', async function () { try { await generateInAddon(['addon-import', 'foo']); } catch (error) { @@ -66,7 +66,7 @@ describe('Acceptance: ember generate in-addon', function() { } }); - it('runs the `addon-import` blueprint from a classic addon', async function() { + it('runs the `addon-import` blueprint from a classic addon', async function () { await initAddon('my-addon'); await fs.outputFile( @@ -79,7 +79,7 @@ describe('Acceptance: ember generate in-addon', function() { expect(file('app/services/session.js')).to.exist; }); - it('runs a custom "*-addon" blueprint from a classic addon', async function() { + it('runs a custom "*-addon" blueprint from a classic addon', async function () { await initAddon('my-addon'); await fs.outputFile( @@ -97,7 +97,7 @@ describe('Acceptance: ember generate in-addon', function() { expect(file('app/services/session.js')).to.exist; }); - it('in-addon blueprint foo', async function() { + it('in-addon blueprint foo', async function () { await generateInAddon(['blueprint', 'foo']); expect(file('blueprints/foo/index.js')).to.contain( @@ -118,7 +118,7 @@ describe('Acceptance: ember generate in-addon', function() { ); }); - it('in-addon blueprint foo/bar', async function() { + it('in-addon blueprint foo/bar', async function () { await generateInAddon(['blueprint', 'foo/bar']); expect(file('blueprints/foo/bar/index.js')).to.contain( @@ -139,7 +139,7 @@ describe('Acceptance: ember generate in-addon', function() { ); }); - it('in-addon http-mock foo', async function() { + it('in-addon http-mock foo', async function () { await generateInAddon(['http-mock', 'foo']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -196,7 +196,7 @@ describe('Acceptance: ember generate in-addon', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('in-addon http-mock foo-bar', async function() { + it('in-addon http-mock foo-bar', async function () { await generateInAddon(['http-mock', 'foo-bar']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -253,7 +253,7 @@ describe('Acceptance: ember generate in-addon', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('in-addon http-proxy foo', async function() { + it('in-addon http-proxy foo', async function () { await generateInAddon(['http-proxy', 'foo', 'http://localhost:5000']); expect(file('server/index.js')).to.contain('proxies.forEach(route => route(app));'); @@ -281,7 +281,7 @@ describe('Acceptance: ember generate in-addon', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('in-addon server', async function() { + it('in-addon server', async function () { await generateInAddon(['server']); expect(file('server/index.js')).to.exist; }); diff --git a/tests/acceptance/addon-smoke-test-slow.js b/tests/acceptance/addon-smoke-test-slow.js index c7fdd3e0d4..d6c4c04418 100644 --- a/tests/acceptance/addon-smoke-test-slow.js +++ b/tests/acceptance/addon-smoke-test-slow.js @@ -22,10 +22,10 @@ let dir = chai.dir; let addonName = 'some-cool-addon'; let addonRoot; -describe('Acceptance: addon-smoke-test', function() { +describe('Acceptance: addon-smoke-test', function () { this.timeout(450000); - before(function() { + before(function () { return createTestTargets(addonName, { command: 'addon', }); @@ -33,13 +33,13 @@ describe('Acceptance: addon-smoke-test', function() { after(teardownTestTargets); - beforeEach(function() { + beforeEach(function () { addonRoot = linkDependencies(addonName); process.env.JOBS = '1'; }); - afterEach(function() { + afterEach(function () { runCommand.killAll(); // Cleans up a folder set up on the other side of a symlink. fs.removeSync(path.join(addonRoot, 'node_modules', 'developing-addon')); @@ -50,7 +50,7 @@ describe('Acceptance: addon-smoke-test', function() { delete process.env.JOBS; }); - it('generates package.json with proper metadata', function() { + it('generates package.json with proper metadata', function () { let packageContents = fs.readJsonSync('package.json'); expect(packageContents.name).to.equal(addonName); @@ -59,11 +59,11 @@ describe('Acceptance: addon-smoke-test', function() { expect(packageContents['ember-addon']).to.deep.equal({ configPath: 'tests/dummy/config' }); }); - it('ember addon foo, clean from scratch', function() { + it('ember addon foo, clean from scratch', function () { return ember(['test']); }); - it('works in most common scenarios for an example addon', async function() { + it('works in most common scenarios for an example addon', async function () { await copyFixtureFiles('addon/kitchen-sink'); let packageJsonPath = path.join(addonRoot, 'package.json'); @@ -99,8 +99,8 @@ describe('Acceptance: addon-smoke-test', function() { expect(result.code).to.eql(0); }); - it('npm pack does not include unnecessary files', async function() { - let handleError = function(error, commandName) { + it('npm pack does not include unnecessary files', async function () { + let handleError = function (error, commandName) { if (error.code === 'ENOENT') { console.warn(chalk.yellow(` Your system does not provide ${commandName} -> Skipped this test.`)); } else { @@ -139,7 +139,7 @@ describe('Acceptance: addon-smoke-test', function() { let outputFiles = output .split('\n') .filter(Boolean) - .map(f => f.replace(/^package\//, '')); + .map((f) => f.replace(/^package\//, '')); expect(outputFiles, 'verify our assumptions about the output structure').to.include.members(necessaryFiles); diff --git a/tests/acceptance/brocfile-smoke-test-slow.js b/tests/acceptance/brocfile-smoke-test-slow.js index da4a099c83..d3425a500a 100644 --- a/tests/acceptance/brocfile-smoke-test-slow.js +++ b/tests/acceptance/brocfile-smoke-test-slow.js @@ -19,26 +19,26 @@ let dir = chai.dir; let appName = 'some-cool-app'; let appRoot; -describe('Acceptance: brocfile-smoke-test', function() { +describe('Acceptance: brocfile-smoke-test', function () { this.timeout(500000); - before(function() { + before(function () { return createTestTargets(appName); }); after(teardownTestTargets); - beforeEach(function() { + beforeEach(function () { appRoot = linkDependencies(appName); }); - afterEach(function() { + afterEach(function () { runCommand.killAll(); cleanupRun(appName); expect(dir(appRoot)).to.not.exist; }); - it('a custom EmberENV in config/environment.js is used for window.EmberENV', async function() { + it('a custom EmberENV in config/environment.js is used for window.EmberENV', async function () { await copyFixtureFiles('brocfile-tests/custom-ember-env'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -52,18 +52,18 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(vendorContents).to.contain(expected, 'EmberENV should be in assets/vendor.js'); }); - it('a custom environment config can be used in Brocfile.js', async function() { + it('a custom environment config can be used in Brocfile.js', async function () { await copyFixtureFiles('brocfile-tests/custom-environment-config'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test'); }); - it('without app/templates', async function() { + it('without app/templates', async function () { await copyFixtureFiles('brocfile-tests/pods-templates'); await fs.remove(path.join(process.cwd(), 'app/templates')); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test'); }); - it('strips app/styles or app/templates from JS', async function() { + it('strips app/styles or app/templates from JS', async function () { await copyFixtureFiles('brocfile-tests/styles-and-templates-stripped'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -75,7 +75,7 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(appFileContents).to.include('//app/styles-manager.js'); }); - it('should throw if no build file is found', async function() { + it('should throw if no build file is found', async function () { fs.removeSync('./ember-cli-build.js'); try { await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -84,7 +84,7 @@ describe('Acceptance: brocfile-smoke-test', function() { } }); - it('using autoRun: true', async function() { + it('using autoRun: true', async function () { await copyFixtureFiles('brocfile-tests/auto-run-true'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -94,7 +94,7 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(appFileContents).to.match(/\/app"\)\["default"\]\.create\(/); }); - it('using autoRun: false', async function() { + it('using autoRun: false', async function () { await copyFixtureFiles('brocfile-tests/auto-run-false'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -105,7 +105,7 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(appFileContents).to.not.match(/\/app"\)\["default"\]\.create\(/); }); - it('app.import works properly with test tree files', async function() { + it('app.import works properly with test tree files', async function () { await copyFixtureFiles('brocfile-tests/app-test-import'); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -122,7 +122,7 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(subjectFileContents).to.contain('// File for test tree imported and added via postprocessTree()'); }); - it('app.import works properly with non-js/css files', async function() { + it('app.import works properly with non-js/css files', async function () { await copyFixtureFiles('brocfile-tests/app-import'); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -139,7 +139,7 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(subjectFileContents).to.equal('EXAMPLE TEXT FILE CONTENT\n'); }); - it('addons can have a public tree that is merged and returned namespaced by default', async function() { + it('addons can have a public tree that is merged and returned namespaced by default', async function () { await copyFixtureFiles('brocfile-tests/public-tree'); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -156,17 +156,17 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(subjectFileContents).to.equal('ROOT FILE\n'); }); - it('using pods based templates', async function() { + it('using pods based templates', async function () { await copyFixtureFiles('brocfile-tests/pods-templates'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test'); }); - it('using pods based templates with a podModulePrefix', async function() { + it('using pods based templates with a podModulePrefix', async function () { await copyFixtureFiles('brocfile-tests/pods-with-prefix-templates'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test'); }); - it('addon trees are not jshinted', async function() { + it('addon trees are not jshinted', async function () { await copyFixtureFiles('brocfile-tests/jshint-addon'); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -183,7 +183,7 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(error.output.join('')).to.include('Error: No tests matched the filter "jshint"'); }); - it('multiple css files in styles/ are output when a preprocessor is not used', async function() { + it('multiple css files in styles/ are output when a preprocessor is not used', async function () { await copyFixtureFiles('brocfile-tests/multiple-css-files'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -191,12 +191,12 @@ describe('Acceptance: brocfile-smoke-test', function() { let files = ['/assets/some-cool-app.css', '/assets/other.css']; let basePath = path.join(appRoot, 'dist'); - files.forEach(function(f) { + files.forEach(function (f) { expect(file(path.join(basePath, f))).to.exist; }); }); - it('specifying custom output paths works properly', async function() { + it('specifying custom output paths works properly', async function () { await copyFixtureFiles('brocfile-tests/custom-output-paths'); let themeCSSPath = path.join(appRoot, 'app', 'styles', 'theme.css'); @@ -216,24 +216,24 @@ describe('Acceptance: brocfile-smoke-test', function() { ]; let basePath = path.join(appRoot, 'dist'); - files.forEach(function(f) { + files.forEach(function (f) { expect(file(path.join(basePath, f))).to.exist; }); }); - it('specifying outputFile results in an explicitly generated assets', async function() { + it('specifying outputFile results in an explicitly generated assets', async function () { await copyFixtureFiles('brocfile-tests/app-import-output-file'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); let files = ['/assets/output-file.js', '/assets/output-file.css', '/assets/vendor.css', '/assets/vendor.js']; let basePath = path.join(appRoot, 'dist'); - files.forEach(function(f) { + files.forEach(function (f) { expect(file(path.join(basePath, f))).to.exist; }); }); - it('can use transformation to turn anonymous AMD into named AMD', async function() { + it('can use transformation to turn anonymous AMD into named AMD', async function () { await copyFixtureFiles('brocfile-tests/app-import-anonymous-amd'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -241,7 +241,7 @@ describe('Acceptance: brocfile-smoke-test', function() { encoding: 'utf8', }); - (function() { + (function () { let defineCount = 0; // eslint-disable-next-line no-unused-vars function define(name, deps, factory) { @@ -257,7 +257,7 @@ describe('Acceptance: brocfile-smoke-test', function() { })(); }); - it('can use transformation to turn named UMD into named AMD', async function() { + it('can use transformation to turn named UMD into named AMD', async function () { await copyFixtureFiles('brocfile-tests/app-import-named-umd'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -265,7 +265,7 @@ describe('Acceptance: brocfile-smoke-test', function() { encoding: 'utf8', }); - (function() { + (function () { let defineCount = 0; // eslint-disable-next-line no-unused-vars function define(name, deps, factory) { @@ -281,7 +281,7 @@ describe('Acceptance: brocfile-smoke-test', function() { })(); }); - it('can do amd transform from addon', async function() { + it('can do amd transform from addon', async function () { await copyFixtureFiles('brocfile-tests/app-import-custom-transform'); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -295,7 +295,7 @@ describe('Acceptance: brocfile-smoke-test', function() { encoding: 'utf8', }); - (function() { + (function () { let defineCount = 0; // eslint-disable-next-line no-unused-vars function define(name, deps, factory) { @@ -311,7 +311,7 @@ describe('Acceptance: brocfile-smoke-test', function() { })(); }); - it('can use transformation to turn library into custom transformation', async function() { + it('can use transformation to turn library into custom transformation', async function () { await copyFixtureFiles('brocfile-tests/app-import-custom-transform'); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -331,7 +331,7 @@ describe('Acceptance: brocfile-smoke-test', function() { }); // skipped because of potentially broken assertion that should be fixed correctly at a later point - it.skip('specifying partial `outputPaths` hash deep merges options correctly', async function() { + it.skip('specifying partial `outputPaths` hash deep merges options correctly', async function () { await copyFixtureFiles('brocfile-tests/custom-output-paths'); let themeCSSPath = path.join(appRoot, 'app', 'styles', 'theme.css'); @@ -359,14 +359,14 @@ describe('Acceptance: brocfile-smoke-test', function() { ]; let basePath = path.join(appRoot, 'dist'); - files.forEach(function(f) { + files.forEach(function (f) { expect(file(path.join(basePath, f))).to.exist; }); expect(file(path.join(basePath, '/assets/some-cool-app.css'))).to.not.exist; }); - it('multiple paths can be CSS preprocessed', async function() { + it('multiple paths can be CSS preprocessed', async function () { await copyFixtureFiles('brocfile-tests/multiple-sass-files'); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -384,13 +384,13 @@ describe('Acceptance: brocfile-smoke-test', function() { ); }); - it('app.css is output to .css by default', async function() { + it('app.css is output to .css by default', async function () { await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); expect(file(`dist/assets/${appName}.css`)).to.exist; }); // for backwards compat. - it('app.scss is output to .css by default', async function() { + it('app.scss is output to .css by default', async function () { await copyFixtureFiles('brocfile-tests/multiple-sass-files'); let brocfilePath = path.join(appRoot, 'ember-cli-build.js'); @@ -411,7 +411,7 @@ describe('Acceptance: brocfile-smoke-test', function() { expect(file(`dist/assets/${appName}.css`)).to.equal('body { background: green; }\n'); }); - it('additional trees can be passed to the app', async function() { + it('additional trees can be passed to the app', async function () { await copyFixtureFiles('brocfile-tests/additional-trees'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', { verbose: true }); @@ -423,7 +423,7 @@ describe('Acceptance: brocfile-smoke-test', function() { ]; let basePath = path.join(appRoot, 'dist'); - files.forEach(function(f) { + files.forEach(function (f) { expect(file(path.join(basePath, f))).to.exist; }); }); diff --git a/tests/acceptance/destroy-test.js b/tests/acceptance/destroy-test.js index 7cc5685c24..0857a61cee 100644 --- a/tests/acceptance/destroy-test.js +++ b/tests/acceptance/destroy-test.js @@ -14,24 +14,24 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember destroy', function() { +describe('Acceptance: ember destroy', function () { this.timeout(60000); let tmpdir; - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { tmpdir = await mkTmpDirIn(tmproot); process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { process.chdir(root); return fs.remove(tmproot); }); @@ -51,18 +51,18 @@ describe('Acceptance: ember destroy', function() { } function assertFilesExist(files) { - files.forEach(function(f) { + files.forEach(function (f) { expect(file(f)).to.exist; }); } function assertFilesNotExist(files) { - files.forEach(function(f) { + files.forEach(function (f) { expect(file(f)).to.not.exist; }); } - const assertDestroyAfterGenerate = async function(args, files) { + const assertDestroyAfterGenerate = async function (args, files) { await initApp(); await generate(args); @@ -73,35 +73,35 @@ describe('Acceptance: ember destroy', function() { assertFilesNotExist(files); }; - it('blueprint foo', function() { + it('blueprint foo', function () { let commandArgs = ['blueprint', 'foo']; let files = ['blueprints/foo/index.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('blueprint foo/bar', function() { + it('blueprint foo/bar', function () { let commandArgs = ['blueprint', 'foo/bar']; let files = ['blueprints/foo/bar/index.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('http-mock foo', function() { + it('http-mock foo', function () { let commandArgs = ['http-mock', 'foo']; let files = ['server/mocks/foo.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('http-proxy foo', function() { + it('http-proxy foo', function () { let commandArgs = ['http-proxy', 'foo', 'bar']; let files = ['server/proxies/foo.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('deletes files generated using blueprints from the project directory', async function() { + it('deletes files generated using blueprints from the project directory', async function () { let commandArgs = ['foo', 'bar']; let files = ['app/foos/bar.js']; await initApp(); @@ -118,7 +118,7 @@ describe('Acceptance: ember destroy', function() { assertFilesNotExist(files); }); - it('correctly identifies the root of the project', async function() { + it('correctly identifies the root of the project', async function () { let commandArgs = ['controller', 'foo']; let files = ['app/controllers/foo.js']; await initApp(); @@ -138,7 +138,7 @@ describe('Acceptance: ember destroy', function() { assertFilesNotExist(files); }); - it('http-mock does not remove server/', async function() { + it('http-mock does not remove server/', async function () { await initApp(); await generate(['http-mock', 'foo']); await generate(['http-mock', 'bar']); diff --git a/tests/acceptance/generate-test.js b/tests/acceptance/generate-test.js index a3ea8b5d97..bbf16bb516 100755 --- a/tests/acceptance/generate-test.js +++ b/tests/acceptance/generate-test.js @@ -18,25 +18,25 @@ let expect = chai.expect; let file = chai.file; let dir = chai.dir; -describe('Acceptance: ember generate', function() { +describe('Acceptance: ember generate', function () { this.timeout(20000); let tmpdir; - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { tmpdir = await mkTmpDirIn(tmproot); process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { process.chdir(root); return remove(tmproot); }); @@ -54,12 +54,12 @@ describe('Acceptance: ember generate', function() { function generate(args) { let generateArgs = ['generate'].concat(args); - return initApp().then(function() { + return initApp().then(function () { return ember(generateArgs); }); } - it('blueprint foo', async function() { + it('blueprint foo', async function () { await generate(['blueprint', 'foo']); expect(file('blueprints/foo/index.js')).to.contain( @@ -80,7 +80,7 @@ describe('Acceptance: ember generate', function() { ); }); - it('blueprint foo/bar', async function() { + it('blueprint foo/bar', async function () { await generate(['blueprint', 'foo/bar']); expect(file('blueprints/foo/bar/index.js')).to.contain( @@ -101,7 +101,7 @@ describe('Acceptance: ember generate', function() { ); }); - it('http-mock foo', async function() { + it('http-mock foo', async function () { await generate(['http-mock', 'foo']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -158,7 +158,7 @@ describe('Acceptance: ember generate', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('http-mock foo-bar', async function() { + it('http-mock foo-bar', async function () { await generate(['http-mock', 'foo-bar']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -215,7 +215,7 @@ describe('Acceptance: ember generate', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('http-proxy foo', async function() { + it('http-proxy foo', async function () { await generate(['http-proxy', 'foo', 'http://localhost:5000']); expect(file('server/index.js')).to.contain('proxies.forEach(route => route(app));'); @@ -243,7 +243,7 @@ describe('Acceptance: ember generate', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('uses blueprints from the project directory', async function() { + it('uses blueprints from the project directory', async function () { await initApp(); await outputFile( @@ -256,7 +256,7 @@ describe('Acceptance: ember generate', function() { expect(file('app/foos/bar.js')).to.contain('foo: true'); }); - it('allows custom blueprints to override built-ins', async function() { + it('allows custom blueprints to override built-ins', async function () { await initApp(); await outputFile( 'blueprints/controller/files/app/controllers/__name__.js', @@ -268,7 +268,7 @@ describe('Acceptance: ember generate', function() { expect(file('app/controllers/foo.js')).to.contain('custom: true'); }); - it('passes custom cli arguments to blueprint options', async function() { + it('passes custom cli arguments to blueprint options', async function () { await initApp(); await outputFile( @@ -292,7 +292,7 @@ describe('Acceptance: ember generate', function() { expect(file('app/foo.js')).to.contain('A: Yes!'); }); - it('correctly identifies the root of the project', async function() { + it('correctly identifies the root of the project', async function () { await initApp(); await outputFile( @@ -307,17 +307,17 @@ describe('Acceptance: ember generate', function() { expect(file('app/controllers/foo.js')).to.contain('custom: true'); }); - it('server', async function() { + it('server', async function () { await generate(['server']); expect(file('server/index.js')).to.exist; }); - it('lib', async function() { + it('lib', async function () { await generate(['lib']); expect(dir('lib')).to.exist; }); - it('custom blueprint availableOptions', async function() { + it('custom blueprint availableOptions', async function () { await initApp(); await ember(['generate', 'blueprint', 'foo']); diff --git a/tests/acceptance/help-test.js b/tests/acceptance/help-test.js index 4999dd7f54..4627c62ede 100644 --- a/tests/acceptance/help-test.js +++ b/tests/acceptance/help-test.js @@ -22,10 +22,10 @@ let FooCommand = Command.extend({ anonymousOptions: [''], }); -describe('Acceptance: ember help', function() { +describe('Acceptance: ember help', function () { let options, command; - beforeEach(function() { + beforeEach(function () { let commands = requireAsHash('../../lib/commands/*.js', Command); options = commandOptions({ @@ -43,7 +43,7 @@ describe('Acceptance: ember help', function() { command = new HelpCommand(options); }); - it('works', function() { + it('works', function () { command.run(options, []); let output = options.ui.output; @@ -53,8 +53,8 @@ describe('Acceptance: ember help', function() { expect(output).to.equal(expected); }); - it('prints addon commands', function() { - options.project.eachAddonCommand = function(cb) { + it('prints addon commands', function () { + options.project.eachAddonCommand = function (cb) { cb('dummy-addon', { Foo: FooCommand }); }; @@ -68,8 +68,8 @@ describe('Acceptance: ember help', function() { expect(output).to.equal(expected); }); - it('prints single addon commands', function() { - options.project.eachAddonCommand = function(cb) { + it('prints single addon commands', function () { + options.project.eachAddonCommand = function (cb) { cb('dummy-addon', { Foo: FooCommand }); }; @@ -83,7 +83,7 @@ describe('Acceptance: ember help', function() { expect(output).to.equal(expected); }); - it('prints all blueprints', function() { + it('prints all blueprints', function () { command.run(options, ['generate']); let output = options.ui.output; @@ -94,7 +94,7 @@ describe('Acceptance: ember help', function() { expect(output).to.contain(expected); }); - it('prints helpful message for unknown command', function() { + it('prints helpful message for unknown command', function () { command.run(options, ['asdf']); let output = options.ui.output; @@ -103,7 +103,7 @@ describe('Acceptance: ember help', function() { expect(output).to.not.contain('undefined'); }); - it('prints a single blueprints', function() { + it('prints a single blueprints', function () { command.run(options, ['generate', 'blueprint']); let output = options.ui.output; @@ -114,8 +114,8 @@ describe('Acceptance: ember help', function() { expect(output).to.equal(expected); }); - it('prints blueprints from addons', function() { - options.project.blueprintLookupPaths = function() { + it('prints blueprints from addons', function () { + options.project.blueprintLookupPaths = function () { return [path.join(__dirname, '..', 'fixtures', 'blueprints')]; }; @@ -129,12 +129,12 @@ describe('Acceptance: ember help', function() { expect(output).to.equal(expected); }); - describe('--json', function() { - beforeEach(function() { + describe('--json', function () { + beforeEach(function () { options.json = true; }); - it('works', function() { + it('works', function () { command.run(options, []); let json = convertToJson(options.ui.output); @@ -143,8 +143,8 @@ describe('Acceptance: ember help', function() { expect(json).to.deep.equal(expected); }); - it('prints commands from addons', function() { - options.project.eachAddonCommand = function(cb) { + it('prints commands from addons', function () { + options.project.eachAddonCommand = function (cb) { cb('dummy-addon', { Foo: FooCommand }); }; @@ -156,8 +156,8 @@ describe('Acceptance: ember help', function() { expect(json).to.deep.equal(expected); }); - it('prints blueprints from addons', function() { - options.project.blueprintLookupPaths = function() { + it('prints blueprints from addons', function () { + options.project.blueprintLookupPaths = function () { return [path.join(__dirname, '..', 'fixtures', 'blueprints')]; }; @@ -179,7 +179,7 @@ function loadTextFixture(path) { } function decodeUnicode(str) { - return str.replace(/\\u([\d\w]{4})/gi, function(match, grp) { + return str.replace(/\\u([\d\w]{4})/gi, function (match, grp) { return String.fromCharCode(parseInt(grp, 16)); }); } diff --git a/tests/acceptance/in-option-destroy-test.js b/tests/acceptance/in-option-destroy-test.js index 781e62dd39..1500023c6c 100644 --- a/tests/acceptance/in-option-destroy-test.js +++ b/tests/acceptance/in-option-destroy-test.js @@ -16,25 +16,25 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember destroy with --in option', function() { +describe('Acceptance: ember destroy with --in option', function () { let tmpdir; this.timeout(20000); - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { tmpdir = await mkTmpDirIn(tmproot); process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { this.timeout(10000); process.chdir(root); @@ -52,18 +52,18 @@ describe('Acceptance: ember destroy with --in option', function() { } function assertFilesExist(files) { - files.forEach(function(f) { + files.forEach(function (f) { expect(file(f)).to.exist; }); } function assertFilesNotExist(files) { - files.forEach(function(f) { + files.forEach(function (f) { expect(file(f)).to.not.exist; }); } - const assertDestroyAfterGenerate = async function(args, addonPath, files) { + const assertDestroyAfterGenerate = async function (args, addonPath, files) { await initApp(); await generateUtils.inRepoAddon(addonPath); await generateUtils.tempBlueprint(); @@ -76,7 +76,7 @@ describe('Acceptance: ember destroy with --in option', function() { assertFilesNotExist(files); }; - it('blueprint foo --in lib/other-thing', function() { + it('blueprint foo --in lib/other-thing', function () { let addonPath = './lib/other-thing'; let commandArgs = ['foo', 'bar', '--in', addonPath]; let files = ['lib/other-thing/addon/foos/bar.js']; @@ -84,7 +84,7 @@ describe('Acceptance: ember destroy with --in option', function() { return assertDestroyAfterGenerate(commandArgs, addonPath, files); }); - it('blueprint foo --in ./non-lib/other-thing', function() { + it('blueprint foo --in ./non-lib/other-thing', function () { let addonPath = './non-lib/other-thing'; let commandArgs = ['foo', 'bar', '--in', addonPath]; let files = ['non-lib/other-thing/addon/foos/bar.js']; @@ -92,7 +92,7 @@ describe('Acceptance: ember destroy with --in option', function() { return assertDestroyAfterGenerate(commandArgs, addonPath, files); }); - it('blueprint foo --in non-lib/other-thing', function() { + it('blueprint foo --in non-lib/other-thing', function () { let addonPath = 'non-lib/other-thing'; let commandArgs = ['foo', 'bar', '--in', addonPath]; let files = ['non-lib/other-thing/addon/foos/bar.js']; @@ -100,7 +100,7 @@ describe('Acceptance: ember destroy with --in option', function() { return assertDestroyAfterGenerate(commandArgs, addonPath, files); }); - it('blueprint foo --in non-lib/nested/other-thing', function() { + it('blueprint foo --in non-lib/nested/other-thing', function () { let addonPath = 'non-lib/nested/other-thing'; let commandArgs = ['foo', 'bar', '--in', addonPath]; let files = ['non-lib/nested/other-thing/addon/foos/bar.js']; diff --git a/tests/acceptance/in-option-generate-test.js b/tests/acceptance/in-option-generate-test.js index 45a51d3b29..0d449b6f61 100644 --- a/tests/acceptance/in-option-generate-test.js +++ b/tests/acceptance/in-option-generate-test.js @@ -15,24 +15,24 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember generate with --in option', function() { +describe('Acceptance: ember generate with --in option', function () { this.timeout(20000); - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(function() { - return mkTmpDirIn(tmproot).then(function(tmpdir) { + beforeEach(function () { + return mkTmpDirIn(tmproot).then(function (tmpdir) { process.chdir(tmpdir); }); }); - afterEach(function() { + afterEach(function () { process.chdir(root); return fs.remove(tmproot); }); @@ -46,7 +46,7 @@ describe('Acceptance: ember generate with --in option', function() { return fs.writeJsonSync(packageJsonPath, packageJson); } - it('generate blueprint foo using lib', function() { + it('generate blueprint foo using lib', function () { // build an app with an in-repo addon in a non-standard path return ( initApp() @@ -55,14 +55,14 @@ describe('Acceptance: ember generate with --in option', function() { .then(() => generateUtils.tempBlueprint()) // confirm that we can generate into the non-lib path .then(() => - ember(['generate', 'foo', 'bar', '--in=lib/other-thing']).then(function() { + ember(['generate', 'foo', 'bar', '--in=lib/other-thing']).then(function () { expect(file('lib/other-thing/addon/foos/bar.js')).to.exist; }) ) ); }); - it('generate blueprint foo using custom path using current directory', function() { + it('generate blueprint foo using custom path using current directory', function () { // build an app with an in-repo addon in a non-standard path return ( initApp() @@ -71,14 +71,14 @@ describe('Acceptance: ember generate with --in option', function() { .then(() => generateUtils.tempBlueprint()) // confirm that we can generate into the non-lib path .then(() => - ember(['generate', 'foo', 'bar', '--in=non-lib/other-thing']).then(function() { + ember(['generate', 'foo', 'bar', '--in=non-lib/other-thing']).then(function () { expect(file('non-lib/other-thing/addon/foos/bar.js')).to.exist; }) ) ); }); - it('generate blueprint foo using custom path', function() { + it('generate blueprint foo using custom path', function () { // build an app with an in-repo addon in a non-standard path return ( initApp() @@ -87,14 +87,14 @@ describe('Acceptance: ember generate with --in option', function() { .then(() => generateUtils.tempBlueprint()) // confirm that we can generate into the non-lib path .then(() => - ember(['generate', 'foo', 'bar', '--in=./non-lib/other-thing']).then(function() { + ember(['generate', 'foo', 'bar', '--in=./non-lib/other-thing']).then(function () { expect(file('non-lib/other-thing/addon/foos/bar.js')).to.exist; }) ) ); }); - it('generate blueprint foo using custom nested path', function() { + it('generate blueprint foo using custom nested path', function () { // build an app with an in-repo addon in a non-standard path return ( initApp() @@ -103,14 +103,14 @@ describe('Acceptance: ember generate with --in option', function() { .then(() => generateUtils.tempBlueprint()) // confirm that we can generate into the non-lib path .then(() => - ember(['generate', 'foo', 'bar', '--in=./non-lib/nested/other-thing']).then(function() { + ember(['generate', 'foo', 'bar', '--in=./non-lib/nested/other-thing']).then(function () { expect(file('non-lib/nested/other-thing/addon/foos/bar.js')).to.exist; }) ) ); }); - it('generate blueprint foo using sibling path', function() { + it('generate blueprint foo using sibling path', function () { // build an app with an in-repo addon in a non-standard path return ( initApp() @@ -122,7 +122,7 @@ describe('Acceptance: ember generate with --in option', function() { .then(() => generateUtils.tempBlueprint()) // confirm that we can generate into the non-lib path .then(() => - ember(['generate', 'foo', 'bar', '--in=../sibling']).then(function() { + ember(['generate', 'foo', 'bar', '--in=../sibling']).then(function () { expect(file('../sibling/addon/foos/bar.js')).to.exist; }) ) diff --git a/tests/acceptance/in-repo-addon-generate-test.js b/tests/acceptance/in-repo-addon-generate-test.js index 6d712399b0..e8e857af35 100644 --- a/tests/acceptance/in-repo-addon-generate-test.js +++ b/tests/acceptance/in-repo-addon-generate-test.js @@ -16,23 +16,23 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember generate in-repo-addon', function() { +describe('Acceptance: ember generate in-repo-addon', function () { this.timeout(20000); - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { const tmpdir = await mkTmpDirIn(tmproot); return process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { process.chdir(root); return remove(tmproot); }); @@ -46,7 +46,7 @@ describe('Acceptance: ember generate in-repo-addon', function() { return ember(['generate', 'in-repo-addon', 'my-addon']); } - it('in-repo-addon blueprint foo inside alternate path', async function() { + it('in-repo-addon blueprint foo inside alternate path', async function () { // build an app with an in-repo addon in a non-standard path await initApp(); await ember(['generate', 'in-repo-addon', './non-lib/other-thing']); @@ -58,7 +58,7 @@ describe('Acceptance: ember generate in-repo-addon', function() { expect(file('non-lib/other-thing/addon/foos/bar.js')).to.exist; }); - it('in-repo-addon adds path to lib', async function() { + it('in-repo-addon adds path to lib', async function () { await initInRepoAddon(); expect(file('package.json')).to.contain('lib/my-addon'); diff --git a/tests/acceptance/init-test.js b/tests/acceptance/init-test.js index d9729c782d..497473f780 100644 --- a/tests/acceptance/init-test.js +++ b/tests/acceptance/init-test.js @@ -23,17 +23,17 @@ let defaultIgnoredFiles = Blueprint.ignoredFiles; let tmpPath = './tmp/init-test'; -describe('Acceptance: ember init', function() { +describe('Acceptance: ember init', function () { this.timeout(20000); - beforeEach(async function() { + beforeEach(async function () { Blueprint.ignoredFiles = defaultIgnoredFiles; await tmp.setup(tmpPath); process.chdir(tmpPath); }); - afterEach(function() { + afterEach(function () { return tmp.teardown(tmpPath); }); @@ -42,7 +42,7 @@ describe('Acceptance: ember init', function() { let expected = walkSync(blueprintPath).sort(); let actual = walkSync('.').sort(); - forEach(Blueprint.renamedFiles, function(destFile, srcFile) { + forEach(Blueprint.renamedFiles, function (destFile, srcFile) { expected[expected.indexOf(srcFile)] = destFile; }); @@ -91,13 +91,13 @@ describe('Acceptance: ember init', function() { } function removeTmp(array) { - remove(array, function(entry) { + remove(array, function (entry) { return /^tmp[\\/]$/.test(entry); }); } function removeIgnored(array) { - remove(array, function(fn) { - return Blueprint.ignoredFiles.some(function(ignoredFile) { + remove(array, function (fn) { + return Blueprint.ignoredFiles.some(function (ignoredFile) { return minimatch(fn, ignoredFile, { matchBase: true, }); @@ -105,13 +105,13 @@ describe('Acceptance: ember init', function() { }); } - it('ember init', async function() { + it('ember init', async function () { await ember(['init', '--skip-npm', '--skip-bower']); confirmBlueprinted(); }); - it("init an already init'd folder", async function() { + it("init an already init'd folder", async function () { await ember(['init', '--skip-npm', '--skip-bower']); await ember(['init', '--skip-npm', '--skip-bower']); @@ -119,13 +119,13 @@ describe('Acceptance: ember init', function() { confirmBlueprinted(); }); - it('init a single file', async function() { + it('init a single file', async function () { await ember(['init', 'app.js', '--skip-npm', '--skip-bower']); confirmGlobBlueprinted('app.js'); }); - it("init a single file on already init'd folder", async function() { + it("init a single file on already init'd folder", async function () { await ember(['init', '--skip-npm', '--skip-bower']); await ember(['init', 'app.js', '--skip-npm', '--skip-bower']); @@ -133,13 +133,13 @@ describe('Acceptance: ember init', function() { confirmBlueprinted(); }); - it('init multiple files by glob pattern', async function() { + it('init multiple files by glob pattern', async function () { await ember(['init', 'app/**', '--skip-npm', '--skip-bower']); confirmGlobBlueprinted('app/**'); }); - it("init multiple files by glob pattern on already init'd folder", async function() { + it("init multiple files by glob pattern on already init'd folder", async function () { await ember(['init', '--skip-npm', '--skip-bower']); await ember(['init', 'app/**', '--skip-npm', '--skip-bower']); @@ -147,13 +147,13 @@ describe('Acceptance: ember init', function() { confirmBlueprinted(); }); - it('init multiple files by glob patterns', async function() { + it('init multiple files by glob patterns', async function () { await ember(['init', 'app/**', '{package,bower}.json', 'resolver.js', '--skip-npm', '--skip-bower']); confirmGlobBlueprinted('{app/**,{package,bower}.json,resolver.js}'); }); - it("init multiple files by glob patterns on already init'd folder", async function() { + it("init multiple files by glob patterns on already init'd folder", async function () { await ember(['init', '--skip-npm', '--skip-bower']); await ember(['init', 'app/**', '{package,bower}.json', 'resolver.js', '--skip-npm', '--skip-bower']); @@ -161,7 +161,7 @@ describe('Acceptance: ember init', function() { confirmBlueprinted(); }); - it('should not create .git folder', async function() { + it('should not create .git folder', async function () { await ember(['init', '--skip-npm', '--skip-bower']); expect(dir('.git')).to.not.exist; diff --git a/tests/acceptance/missing-before-addon-test.js b/tests/acceptance/missing-before-addon-test.js index 303267ecbb..077c12ad43 100644 --- a/tests/acceptance/missing-before-addon-test.js +++ b/tests/acceptance/missing-before-addon-test.js @@ -4,16 +4,16 @@ const path = require('path'); const ember = require('../helpers/ember'); let root = process.cwd(); -describe('Acceptance: missing a before/after addon', function() { - beforeEach(function() { +describe('Acceptance: missing a before/after addon', function () { + beforeEach(function () { process.chdir(path.join(root, 'tests', 'fixtures', 'missing-before-addon')); }); - afterEach(function() { + afterEach(function () { process.chdir(root); }); - it('does not break ember-cli', function() { + it('does not break ember-cli', function () { return ember(['help']); }); }); diff --git a/tests/acceptance/nested-addons-smoke-test-slow.js b/tests/acceptance/nested-addons-smoke-test-slow.js index 47cdc428d9..bdd40342ef 100644 --- a/tests/acceptance/nested-addons-smoke-test-slow.js +++ b/tests/acceptance/nested-addons-smoke-test-slow.js @@ -19,26 +19,26 @@ let dir = chai.dir; let appName = 'some-cool-app'; let appRoot; -describe('Acceptance: nested-addons-smoke-test', function() { +describe('Acceptance: nested-addons-smoke-test', function () { this.timeout(360000); - before(function() { + before(function () { return createTestTargets(appName); }); after(teardownTestTargets); - beforeEach(function() { + beforeEach(function () { appRoot = linkDependencies(appName); }); - afterEach(function() { + afterEach(function () { runCommand.killAll(); cleanupRun(appName); expect(dir(appRoot)).to.not.exist; }); - it('addons with nested addons compile correctly', async function() { + it('addons with nested addons compile correctly', async function () { await copyFixtureFiles('addon/with-nested-addons'); let packageJsonPath = path.join(appRoot, 'package.json'); diff --git a/tests/acceptance/new-test.js b/tests/acceptance/new-test.js index 97f3eaee8a..84a629fc24 100644 --- a/tests/acceptance/new-test.js +++ b/tests/acceptance/new-test.js @@ -21,17 +21,17 @@ const assertVersionLock = require('../helpers/assert-version-lock'); let tmpDir = './tmp/new-test'; -describe('Acceptance: ember new', function() { +describe('Acceptance: ember new', function () { this.timeout(10000); let ORIGINAL_PROCESS_ENV_CI; - beforeEach(async function() { + beforeEach(async function () { await tmp.setup(tmpDir); process.chdir(tmpDir); ORIGINAL_PROCESS_ENV_CI = process.env.CI; }); - afterEach(function() { + afterEach(function () { if (ORIGINAL_PROCESS_ENV_CI === undefined) { delete process.env.CI; } else { @@ -46,7 +46,7 @@ describe('Acceptance: ember new', function() { let actual = walkSync('.').sort(); let directory = path.basename(process.cwd()); - forEach(Blueprint.renamedFiles, function(destFile, srcFile) { + forEach(Blueprint.renamedFiles, function (destFile, srcFile) { expected[expected.indexOf(srcFile)] = destFile; }); @@ -59,7 +59,7 @@ describe('Acceptance: ember new', function() { ); } - it('ember new adds ember-welcome-page by default', async function() { + it('ember new adds ember-welcome-page by default', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git']); expect(file('package.json')).to.match(/"ember-welcome-page"/); @@ -67,13 +67,13 @@ describe('Acceptance: ember new', function() { expect(file('app/templates/application.hbs')).to.contain(''); }); - it('ember new @foo/bar, when parent directory does not contain `foo`', async function() { + it('ember new @foo/bar, when parent directory does not contain `foo`', async function () { await ember(['new', '@foo/bar', '--skip-npm', '--skip-bower']); confirmBlueprintedForDir('blueprints/app', 'foo-bar'); }); - it('ember new @foo/bar, when direct parent directory contains `foo`', async function() { + it('ember new @foo/bar, when direct parent directory contains `foo`', async function () { let scopedDirectoryPath = path.join(process.cwd(), 'foo'); fs.mkdirsSync(scopedDirectoryPath); process.chdir(scopedDirectoryPath); @@ -83,7 +83,7 @@ describe('Acceptance: ember new', function() { confirmBlueprintedForDir('blueprints/app', 'bar'); }); - it('ember new @foo/bar, when parent directory heirarchy contains `foo`', async function() { + it('ember new @foo/bar, when parent directory heirarchy contains `foo`', async function () { let scopedDirectoryPath = path.join(process.cwd(), 'foo', 'packages'); fs.mkdirsSync(scopedDirectoryPath); process.chdir(scopedDirectoryPath); @@ -93,7 +93,7 @@ describe('Acceptance: ember new', function() { confirmBlueprintedForDir('blueprints/app', 'bar'); }); - it('ember new --no-welcome skips installation of ember-welcome-page', async function() { + it('ember new --no-welcome skips installation of ember-welcome-page', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--no-welcome']); expect(file('package.json')).not.to.match(/"ember-welcome-page"/); @@ -101,19 +101,19 @@ describe('Acceptance: ember new', function() { expect(file('app/templates/application.hbs')).to.contain('Welcome to Ember'); }); - it('ember new npm blueprint with old version', async function() { + it('ember new npm blueprint with old version', async function () { await ember(['new', 'foo', '--blueprint', '@glimmer/blueprint@0.6.4', '--skip-npm', '--skip-bower']); expect(dir('src')).to.exist; }); - it('ember new foo, where foo does not yet exist, works', async function() { + it('ember new foo, where foo does not yet exist, works', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower']); confirmBlueprintedForDir('blueprints/app'); }); - it('ember new foo, blueprint targets match the default ember-cli targets', async function() { + it('ember new foo, blueprint targets match the default ember-cli targets', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower']); process.env.CI = true; @@ -122,21 +122,21 @@ describe('Acceptance: ember new', function() { expect(blueprintTargets).to.have.same.deep.members(defaultTargets); }); - it('ember new with empty app name fails with a warning', async function() { + it('ember new with empty app name fails with a warning', async function () { let err = await expect(ember(['new', ''])).to.be.rejected; expect(err.name).to.equal('SilentError'); expect(err.message).to.contain('The `ember new` command requires a name to be specified.'); }); - it('ember new without app name fails with a warning', async function() { + it('ember new without app name fails with a warning', async function () { let err = await expect(ember(['new'])).to.be.rejected; expect(err.name).to.equal('SilentError'); expect(err.message).to.contain('The `ember new` command requires a name to be specified.'); }); - it('ember new with app name creates new directory and has a dasherized package name', async function() { + it('ember new with app name creates new directory and has a dasherized package name', async function () { await ember(['new', 'FooApp', '--skip-npm', '--skip-bower', '--skip-git']); expect(dir('FooApp')).to.not.exist; @@ -146,13 +146,13 @@ describe('Acceptance: ember new', function() { expect(pkgJson.name).to.equal('foo-app'); }); - it('Can create new ember project in an existing empty directory', async function() { + it('Can create new ember project in an existing empty directory', async function () { fs.mkdirsSync('bar'); await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--directory=bar']); }); - it('Cannot create new ember project in a populated directory', async function() { + it('Cannot create new ember project in a populated directory', async function () { fs.mkdirsSync('bar'); fs.writeFileSync(path.join('bar', 'package.json'), '{}'); @@ -163,7 +163,7 @@ describe('Acceptance: ember new', function() { expect(error.message).to.equal("Directory 'bar' already exists."); }); - it('Cannot run ember new, inside of ember-cli project', async function() { + it('Cannot run ember new, inside of ember-cli project', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git']); let error = await expect(ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git'])).to.be.rejected; @@ -175,7 +175,7 @@ describe('Acceptance: ember new', function() { confirmBlueprintedForDir('blueprints/app'); }); - it('ember new with blueprint uses the specified blueprint directory with a relative path', async function() { + it('ember new with blueprint uses the specified blueprint directory with a relative path', async function () { fs.mkdirsSync('my_blueprint/files'); fs.writeFileSync('my_blueprint/files/gitignore', ''); @@ -184,7 +184,7 @@ describe('Acceptance: ember new', function() { confirmBlueprintedForDir(path.join(tmpDir, 'my_blueprint')); }); - it('ember new with blueprint uses the specified blueprint directory with an absolute path', async function() { + it('ember new with blueprint uses the specified blueprint directory with an absolute path', async function () { fs.mkdirsSync('my_blueprint/files'); fs.writeFileSync('my_blueprint/files/gitignore', ''); @@ -200,7 +200,7 @@ describe('Acceptance: ember new', function() { confirmBlueprintedForDir(path.join(tmpDir, 'my_blueprint')); }); - it('ember new with git blueprint checks out the blueprint and uses it', async function() { + it('ember new with git blueprint checks out the blueprint and uses it', async function () { this.timeout(20000); // relies on GH network stuff await ember([ @@ -215,7 +215,7 @@ describe('Acceptance: ember new', function() { expect(file('.ember-cli')).to.exist; }); - it('ember new with git blueprint and ref checks out the blueprint with the correct ref and uses it', async function() { + it('ember new with git blueprint and ref checks out the blueprint with the correct ref and uses it', async function () { this.timeout(20000); // relies on GH network stuff await ember([ @@ -230,7 +230,7 @@ describe('Acceptance: ember new', function() { expect(file('.named-ref')).to.exist; }); - it('ember new with shorthand git blueprint and ref checks out the blueprint with the correct ref and uses it', async function() { + it('ember new with shorthand git blueprint and ref checks out the blueprint with the correct ref and uses it', async function () { this.timeout(20000); // relies on GH network stuff await ember([ @@ -245,7 +245,7 @@ describe('Acceptance: ember new', function() { expect(file('.named-ref')).to.exist; }); - it('ember new passes blueprint options through to blueprint', async function() { + it('ember new passes blueprint options through to blueprint', async function () { fs.mkdirsSync('my_blueprint/files'); fs.writeFileSync( 'my_blueprint/index.js', @@ -275,7 +275,7 @@ describe('Acceptance: ember new', function() { expect(file('.gitignore')).to.contain('customValue'); }); - it('ember new uses yarn when blueprint has yarn.lock', async function() { + it('ember new uses yarn when blueprint has yarn.lock', async function () { if (!hasGlobalYarn) { this.skip(); } @@ -291,7 +291,7 @@ describe('Acceptance: ember new', function() { expect(dir('node_modules/fs-extra')).to.not.be.empty; }); - it('ember new without skip-git flag creates .git dir', async function() { + it('ember new without skip-git flag creates .git dir', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower'], { skipGit: false, }); @@ -299,7 +299,7 @@ describe('Acceptance: ember new', function() { expect(dir('.git')).to.exist; }); - it('ember new cleans up after itself on error', async function() { + it('ember new cleans up after itself on error', async function () { fs.mkdirsSync('my_blueprint'); fs.writeFileSync('my_blueprint/index.js', 'throw("this will break");'); @@ -308,7 +308,7 @@ describe('Acceptance: ember new', function() { expect(dir('foo')).to.not.exist; }); - it('ember new with --dry-run does not create new directory', async function() { + it('ember new with --dry-run does not create new directory', async function () { await ember(['new', 'foo', '--dry-run']); expect(process.cwd()).to.not.match(/foo/, 'does not change cwd to foo in a dry run'); @@ -316,7 +316,7 @@ describe('Acceptance: ember new', function() { expect(dir('.git')).to.not.exist; }); - it('ember new with --directory uses given directory name and has correct package name', async function() { + it('ember new with --directory uses given directory name and has correct package name', async function () { let workdir = process.cwd(); await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--directory=bar']); @@ -332,7 +332,7 @@ describe('Acceptance: ember new', function() { expect(pkgJson.name).to.equal('foo', 'uses app name for package name'); }); - it('ember addon with --directory uses given directory name and has correct package name', async function() { + it('ember addon with --directory uses given directory name and has correct package name', async function () { let workdir = process.cwd(); await ember(['addon', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--directory=bar']); @@ -348,7 +348,7 @@ describe('Acceptance: ember new', function() { expect(pkgJson.name).to.equal('foo', 'uses addon name for package name'); }); - it('ember addon @foo/bar when parent directory does not contain `foo`', async function() { + it('ember addon @foo/bar when parent directory does not contain `foo`', async function () { await ember(['addon', '@foo/bar', '--skip-npm', '--skip-bower', '--skip-git']); let directoryName = path.basename(process.cwd()); @@ -359,7 +359,7 @@ describe('Acceptance: ember new', function() { expect(pkgJson.name).to.equal('@foo/bar', 'uses addon name for package name'); }); - it('ember addon @foo/bar when parent directory contains `foo`', async function() { + it('ember addon @foo/bar when parent directory contains `foo`', async function () { let scopedDirectoryPath = path.join(process.cwd(), 'foo'); fs.mkdirsSync(scopedDirectoryPath); process.chdir(scopedDirectoryPath); @@ -374,7 +374,7 @@ describe('Acceptance: ember new', function() { expect(pkgJson.name).to.equal('@foo/bar', 'uses addon name for package name'); }); - describe('verify fixtures', function() { + describe('verify fixtures', function () { function checkEslintConfig(fixturePath) { expect(file('.eslintrc.js')).to.equal(file(path.join(__dirname, '../fixtures', fixturePath, '.eslintrc.js'))); } @@ -389,13 +389,13 @@ describe('Acceptance: ember new', function() { expect(file('package.json')).to.equal(fixtureContents); } - it('app + npm + !welcome', async function() { + it('app + npm + !welcome', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--no-welcome']); let namespace = 'app'; let fixturePath = `${namespace}/npm`; - ['app/templates/application.hbs', '.travis.yml', 'README.md'].forEach(filePath => { + ['app/templates/application.hbs', '.travis.yml', 'README.md'].forEach((filePath) => { expect(file(filePath)).to.equal(file(path.join(__dirname, '../fixtures', fixturePath, filePath))); }); @@ -405,19 +405,19 @@ describe('Acceptance: ember new', function() { checkEslintConfig(namespace); }); - it('app + yarn + welcome', async function() { + it('app + yarn + welcome', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--yarn']); let fixturePath = 'app/yarn'; - ['app/templates/application.hbs', '.travis.yml', 'README.md'].forEach(filePath => { + ['app/templates/application.hbs', '.travis.yml', 'README.md'].forEach((filePath) => { expect(file(filePath)).to.equal(file(path.join(__dirname, '../fixtures', fixturePath, filePath))); }); checkPackageJson(fixturePath); }); - it('addon + yarn + welcome', async function() { + it('addon + yarn + welcome', async function () { await ember(['addon', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--yarn', '--welcome']); let fixturePath = 'addon/yarn'; @@ -428,14 +428,14 @@ describe('Acceptance: ember new', function() { '.travis.yml', 'README.md', 'CONTRIBUTING.md', - ].forEach(filePath => { + ].forEach((filePath) => { expect(file(filePath)).to.equal(file(path.join(__dirname, '../fixtures', fixturePath, filePath))); }); checkPackageJson(fixturePath); }); - it('addon + npm + !welcome', async function() { + it('addon + npm + !welcome', async function () { await ember(['addon', 'foo', '--skip-npm', '--skip-bower', '--skip-git']); let namespace = 'addon'; @@ -447,7 +447,7 @@ describe('Acceptance: ember new', function() { '.travis.yml', 'README.md', 'CONTRIBUTING.md', - ].forEach(filePath => { + ].forEach((filePath) => { expect(file(filePath)).to.equal(file(path.join(__dirname, '../fixtures', fixturePath, filePath))); }); @@ -458,8 +458,8 @@ describe('Acceptance: ember new', function() { }); }); - describe('verify dependencies', function() { - it('are locked down for pre-1.0 versions', async function() { + describe('verify dependencies', function () { + it('are locked down for pre-1.0 versions', async function () { await ember(['new', 'foo', '--skip-npm', '--skip-bower', '--skip-git', '--yarn', '--welcome']); let pkg = fs.readJsonSync('package.json'); diff --git a/tests/acceptance/pods-destroy-test.js b/tests/acceptance/pods-destroy-test.js index 0bbfe6dfcc..79c8fc4d43 100644 --- a/tests/acceptance/pods-destroy-test.js +++ b/tests/acceptance/pods-destroy-test.js @@ -18,25 +18,25 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember destroy pod', function() { +describe('Acceptance: ember destroy pod', function () { let tmpdir; this.timeout(20000); - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { tmpdir = await mkTmpDirIn(tmproot); process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { this.timeout(10000); process.chdir(root); @@ -58,18 +58,18 @@ describe('Acceptance: ember destroy pod', function() { } function assertFilesExist(files) { - files.forEach(function(f) { + files.forEach(function (f) { expect(file(f)).to.exist; }); } function assertFilesNotExist(files) { - files.forEach(function(f) { + files.forEach(function (f) { expect(file(f)).to.not.exist; }); } - const assertDestroyAfterGenerate = async function(args, files) { + const assertDestroyAfterGenerate = async function (args, files) { await initApp(); replaceFile('config/environment.js', '(var|let|const) ENV = {', "$1 ENV = {\npodModulePrefix: 'app/pods', \n"); @@ -82,7 +82,7 @@ describe('Acceptance: ember destroy pod', function() { assertFilesNotExist(files); }; - const destroyAfterGenerate = async function(args) { + const destroyAfterGenerate = async function (args) { await initApp(); replaceFile('config/environment.js', '(var|let|const) ENV = {', "$1 ENV = {\npodModulePrefix: 'app/pods', \n"); @@ -91,35 +91,35 @@ describe('Acceptance: ember destroy pod', function() { return await destroy(args); }; - it('blueprint foo --pod', function() { + it('blueprint foo --pod', function () { let commandArgs = ['blueprint', 'foo', '--pod']; let files = ['blueprints/foo/index.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('blueprint foo/bar --pod', function() { + it('blueprint foo/bar --pod', function () { let commandArgs = ['blueprint', 'foo/bar', '--pod']; let files = ['blueprints/foo/bar/index.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('http-mock foo --pod', function() { + it('http-mock foo --pod', function () { let commandArgs = ['http-mock', 'foo', '--pod']; let files = ['server/mocks/foo.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('http-proxy foo --pod', function() { + it('http-proxy foo --pod', function () { let commandArgs = ['http-proxy', 'foo', 'bar', '--pod']; let files = ['server/proxies/foo.js']; return assertDestroyAfterGenerate(commandArgs, files); }); - it('deletes files generated using blueprints from the project directory', async function() { + it('deletes files generated using blueprints from the project directory', async function () { let commandArgs = ['foo', 'bar', '--pod']; let files = ['app/foos/bar.js']; @@ -138,7 +138,7 @@ describe('Acceptance: ember destroy pod', function() { }); // Skip until podModulePrefix is deprecated - it.skip('podModulePrefix deprecation warning', async function() { + it.skip('podModulePrefix deprecation warning', async function () { let result = await destroyAfterGenerate(['controller', 'foo', '--pod']); expect(result.outputStream.join()).to.include( diff --git a/tests/acceptance/pods-generate-test.js b/tests/acceptance/pods-generate-test.js index 9b2d6e8241..9b98d4726f 100644 --- a/tests/acceptance/pods-generate-test.js +++ b/tests/acceptance/pods-generate-test.js @@ -15,25 +15,25 @@ const chai = require('../chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember generate pod', function() { +describe('Acceptance: ember generate pod', function () { this.timeout(60000); let tmpdir; - before(function() { + before(function () { BlueprintNpmTask.disableNPM(Blueprint); }); - after(function() { + after(function () { BlueprintNpmTask.restoreNPM(Blueprint); }); - beforeEach(async function() { + beforeEach(async function () { tmpdir = await mkTmpDirIn(tmproot); process.chdir(tmpdir); }); - afterEach(function() { + afterEach(function () { process.chdir(root); return fs.remove(tmproot); }); @@ -51,7 +51,7 @@ describe('Acceptance: ember generate pod', function() { function generate(args) { let generateArgs = ['generate'].concat(args); - return initApp().then(function() { + return initApp().then(function () { return ember(generateArgs); }); } @@ -59,13 +59,13 @@ describe('Acceptance: ember generate pod', function() { function generateWithPrefix(args) { let generateArgs = ['generate'].concat(args); - return initApp().then(function() { + return initApp().then(function () { replaceFile('config/environment.js', '(var|let|const) ENV = {', "$1 ENV = {\npodModulePrefix: 'app/pods', \n"); return ember(generateArgs); }); } - it('blueprint foo --pod', async function() { + it('blueprint foo --pod', async function () { await generate(['blueprint', 'foo', '--pod']); expect(file('blueprints/foo/index.js')).to.contain( @@ -86,7 +86,7 @@ describe('Acceptance: ember generate pod', function() { ); }); - it('blueprint foo/bar --pod', async function() { + it('blueprint foo/bar --pod', async function () { await generate(['blueprint', 'foo/bar', '--pod']); expect(file('blueprints/foo/bar/index.js')).to.contain( @@ -107,7 +107,7 @@ describe('Acceptance: ember generate pod', function() { ); }); - it('http-mock foo --pod', async function() { + it('http-mock foo --pod', async function () { await generate(['http-mock', 'foo', '--pod']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -164,7 +164,7 @@ describe('Acceptance: ember generate pod', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('http-mock foo-bar --pod', async function() { + it('http-mock foo-bar --pod', async function () { await generate(['http-mock', 'foo-bar', '--pod']); expect(file('server/index.js')).to.contain('mocks.forEach(route => route(app));'); @@ -221,7 +221,7 @@ describe('Acceptance: ember generate pod', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('http-proxy foo --pod', async function() { + it('http-proxy foo --pod', async function () { await generate(['http-proxy', 'foo', 'http://localhost:5000', '--pod']); expect(file('server/index.js')).to.contain('proxies.forEach(route => route(app));'); @@ -249,7 +249,7 @@ describe('Acceptance: ember generate pod', function() { expect(file('server/.jshintrc')).to.contain('{\n "node": true\n}'); }); - it('uses blueprints from the project directory', async function() { + it('uses blueprints from the project directory', async function () { await initApp(); await fs.outputFile( 'blueprints/foo/files/app/foos/__name__.js', @@ -261,7 +261,7 @@ describe('Acceptance: ember generate pod', function() { expect(file('app/foos/bar.js')).to.contain('foo: true'); }); - it('allows custom blueprints to override built-ins', async function() { + it('allows custom blueprints to override built-ins', async function () { await initApp(); await fs.outputFile( 'blueprints/controller/files/app/__path__/__name__.js', @@ -273,7 +273,7 @@ describe('Acceptance: ember generate pod', function() { expect(file('app/foo/controller.js')).to.contain('custom: true'); }); - it('passes custom cli arguments to blueprint options', async function() { + it('passes custom cli arguments to blueprint options', async function () { await initApp(); await fs.outputFile( 'blueprints/customblue/files/app/__name__.js', @@ -303,7 +303,7 @@ describe('Acceptance: ember generate pod', function() { expect(file('app/foo.js')).to.contain('A: Yes!'); }); - it('correctly identifies the root of the project', async function() { + it('correctly identifies the root of the project', async function () { await initApp(); await fs.outputFile( 'blueprints/controller/files/app/__path__/__name__.js', @@ -318,7 +318,7 @@ describe('Acceptance: ember generate pod', function() { }); // Skip until podModulePrefix is deprecated - it.skip('podModulePrefix deprecation warning', async function() { + it.skip('podModulePrefix deprecation warning', async function () { let result = await generateWithPrefix(['controller', 'foo', '--pod']); expect(result.outputStream.join()).to.include( diff --git a/tests/acceptance/preprocessor-smoke-test-slow.js b/tests/acceptance/preprocessor-smoke-test-slow.js index 30d116d589..68396eef66 100644 --- a/tests/acceptance/preprocessor-smoke-test-slow.js +++ b/tests/acceptance/preprocessor-smoke-test-slow.js @@ -19,26 +19,26 @@ let dir = chai.dir; let appName = 'some-cool-app'; let appRoot; -describe('Acceptance: preprocessor-smoke-test', function() { +describe('Acceptance: preprocessor-smoke-test', function () { this.timeout(360000); - before(function() { + before(function () { return createTestTargets(appName); }); after(teardownTestTargets); - beforeEach(function() { + beforeEach(function () { appRoot = linkDependencies(appName); }); - afterEach(function() { + afterEach(function () { runCommand.killAll(); cleanupRun(appName); expect(dir(appRoot)).to.not.exist; }); - it('addons with standard preprocessors compile correctly', async function() { + it('addons with standard preprocessors compile correctly', async function () { await copyFixtureFiles(`preprocessor-tests/app-with-addon-with-preprocessors`); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -53,7 +53,7 @@ describe('Acceptance: preprocessor-smoke-test', function() { expect(file('dist/assets/vendor.css')).to.contain('addon styles included'); }); - it('addon registry entries are added in the proper order', async function() { + it('addon registry entries are added in the proper order', async function () { await copyFixtureFiles(`preprocessor-tests/app-registry-ordering`); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -70,7 +70,7 @@ describe('Acceptance: preprocessor-smoke-test', function() { .to.not.contain('__FIRST_PREPROCESSOR_REPLACEMENT_TOKEN__', 'token should not be contained'); }); - it('addons without preprocessors compile correctly', async function() { + it('addons without preprocessors compile correctly', async function () { await copyFixtureFiles(`preprocessor-tests/app-with-addon-without-preprocessors`); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -92,7 +92,7 @@ describe('Acceptance: preprocessor-smoke-test', function() { | |-- preprocessor should not apply to this */ - it('addons depending on preprocessor addon preprocesses addon but not app', async function() { + it('addons depending on preprocessor addon preprocesses addon but not app', async function () { await copyFixtureFiles(`preprocessor-tests/app-with-addon-with-preprocessors-2`); let packageJsonPath = path.join(appRoot, 'package.json'); @@ -120,7 +120,7 @@ describe('Acceptance: preprocessor-smoke-test', function() { | |-- preprocessor should not apply to this */ - it('addon N levels deep depending on preprocessor preprocesses that parent addon only', async function() { + it('addon N levels deep depending on preprocessor preprocesses that parent addon only', async function () { await copyFixtureFiles(`preprocessor-tests/app-with-addon-with-preprocessors-3`); let packageJsonPath = path.join(appRoot, 'package.json'); diff --git a/tests/acceptance/smoke-test-slow.js b/tests/acceptance/smoke-test-slow.js index 40a0d76207..deb372801c 100644 --- a/tests/acceptance/smoke-test-slow.js +++ b/tests/acceptance/smoke-test-slow.js @@ -24,30 +24,30 @@ let dir = chai.dir; let appName = 'some-cool-app'; let appRoot; -describe('Acceptance: smoke-test', function() { +describe('Acceptance: smoke-test', function () { this.timeout(500000); - before(function() { + before(function () { return createTestTargets(appName); }); after(teardownTestTargets); - beforeEach(function() { + beforeEach(function () { appRoot = linkDependencies(appName); }); - afterEach(function() { + afterEach(function () { delete process.env._TESTEM_CONFIG_JS_RAN; runCommand.killAll(); cleanupRun(appName); expect(dir(appRoot)).to.not.exist; }); - it('ember new foo, clean from scratch', function() { + it('ember new foo, clean from scratch', function () { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test'); }); - it('ember new foo, make sure addon template overwrites', async function() { + it('ember new foo, make sure addon template overwrites', async function () { await ember(['generate', 'template', 'foo']); await ember(['generate', 'in-repo-addon', 'my-addon']); @@ -73,7 +73,7 @@ describe('Acceptance: smoke-test', function() { expect(result.code).to.equal(0); }); - it('ember test still runs when a JavaScript testem config exists', async function() { + it('ember test still runs when a JavaScript testem config exists', async function () { await copyFixtureFiles('smoke-tests/js-testem-config'); let result = await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test'); @@ -85,7 +85,7 @@ describe('Acceptance: smoke-test', function() { expect(output).to.include('***CUSTOM_TESTEM_JS**'); }); - it('eslint passes after running ember new', async function() { + it('eslint passes after running ember new', async function () { let result = await runCommand(path.join('.', 'node_modules', 'eslint', 'bin', 'eslint.js'), appRoot); let exitCode = result.code; @@ -98,14 +98,14 @@ describe('Acceptance: smoke-test', function() { // when run in isolation, it passes // here is the error: // test-support-80f2fe63fae0c44478fe0f8af73200a7.js contains the fingerprint (2871106928f813936fdd64f4d16005ac): expected 'test-support-80f2fe63fae0c44478fe0f8af73200a7.js' to include '2871106928f813936fdd64f4d16005ac' - it.skip('ember new foo, build production and verify fingerprint', async function() { + it.skip('ember new foo, build production and verify fingerprint', async function () { await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--environment=production'); let dirPath = path.join(appRoot, 'dist', 'assets'); let dir = fs.readdirSync(dirPath); let files = []; - dir.forEach(function(filepath) { + dir.forEach(function (filepath) { if (filepath === '.gitkeep') { return; } @@ -122,12 +122,12 @@ describe('Acceptance: smoke-test', function() { }); let indexHtml = file('dist/index.html'); - files.forEach(function(filename) { + files.forEach(function (filename) { expect(indexHtml).to.contain(filename); }); }); - it('ember test --environment=production', async function() { + it('ember test --environment=production', async function () { await copyFixtureFiles('smoke-tests/passing-test'); let result = await runCommand( @@ -144,7 +144,7 @@ describe('Acceptance: smoke-test', function() { expect(output).to.match(/pass\s+\d+/, 'many passing'); }); - it('ember test --path with previous build', async function() { + it('ember test --path with previous build', async function () { let originalWrite = process.stdout.write; let output = []; @@ -154,8 +154,8 @@ describe('Acceptance: smoke-test', function() { await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); // TODO: Figure out how to get this to write into the MockUI - process.stdout.write = (function() { - return function() { + process.stdout.write = (function () { + return function () { output.push(arguments[0]); }; })(originalWrite); @@ -175,7 +175,7 @@ describe('Acceptance: smoke-test', function() { expect(output).to.match(/pass\s+\d+/, 'many passing'); }); - it('ember test wasm', async function() { + it('ember test wasm', async function () { let originalWrite = process.stdout.write; let output = []; @@ -185,8 +185,8 @@ describe('Acceptance: smoke-test', function() { await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); // TODO: Figure out how to get this to write into the MockUI - process.stdout.write = (function() { - return function() { + process.stdout.write = (function () { + return function () { output.push(arguments[0]); }; })(originalWrite); @@ -206,7 +206,7 @@ describe('Acceptance: smoke-test', function() { expect(output).to.match(/pass\s+\d+/, 'many passing'); }); - it('ember new foo, build development, and verify generated files', async function() { + it('ember new foo, build development, and verify generated files', async function () { await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); let dirPath = path.join(appRoot, 'dist'); @@ -215,7 +215,7 @@ describe('Acceptance: smoke-test', function() { expect(paths).to.have.length.below(24, `expected fewer than 24 files in dist, found ${paths.length}`); }); - it('ember build exits with non-zero code when build fails', async function() { + it('ember build exits with non-zero code when build fails', async function () { let appJsPath = path.join(appRoot, 'app', 'app.js'); let result = await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -230,7 +230,7 @@ describe('Acceptance: smoke-test', function() { expect(result.code).to.not.equal(0, `expected exit code to be non-zero, but got ${result.code}`); }); - it('ember build generates instrumentation files when viz is enabled', async function() { + it('ember build generates instrumentation files when viz is enabled', async function () { process.env.BROCCOLI_VIZ = '1'; try { @@ -248,7 +248,7 @@ describe('Acceptance: smoke-test', function() { 'instrumentation.command.json', 'instrumentation.init.json', 'instrumentation.shutdown.json', - ].forEach(instrumentationFile => { + ].forEach((instrumentationFile) => { expect(fs.existsSync(instrumentationFile)).to.equal(true); let json = fs.readJsonSync(instrumentationFile); @@ -258,7 +258,7 @@ describe('Acceptance: smoke-test', function() { }); }); - it.skip('ember new foo, build --watch development, and verify rebuilt after change', async function() { + it.skip('ember new foo, build --watch development, and verify rebuilt after change', async function () { let touched = false; let appJsPath = path.join(appRoot, 'app', 'app.js'); let builtJsPath = path.join(appRoot, 'dist', 'assets', 'some-cool-app.js'); @@ -287,7 +287,7 @@ describe('Acceptance: smoke-test', function() { } }); - it.skip('ember new foo, build --watch development, and verify rebuilt after multiple changes', async function() { + it.skip('ember new foo, build --watch development, and verify rebuilt after multiple changes', async function () { let buildCount = 0; let touched = false; let appJsPath = path.join(appRoot, 'app', 'app.js'); @@ -329,7 +329,7 @@ describe('Acceptance: smoke-test', function() { } }); - it('build failures should be logged correctly', async function() { + it('build failures should be logged correctly', async function () { fs.writeFileSync( `${process.cwd()}/ember-cli-build.js`, ` @@ -368,7 +368,7 @@ module.exports = function() { ); }); - it.skip('ember new foo, server, SIGINT clears tmp/', async function() { + it.skip('ember new foo, server, SIGINT clears tmp/', async function () { let result = await runCommand( path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'server', @@ -391,12 +391,12 @@ module.exports = function() { // With broccoli2 that should not exist, they should be using os.tmpdir(). // So we'll just check for "if tmp/ is there, are the contents correct?" if (fs.existsSync(dirPath)) { - let dir = fs.readdirSync(dirPath).filter(file => file !== '.metadata_never_index'); + let dir = fs.readdirSync(dirPath).filter((file) => file !== '.metadata_never_index'); expect(dir.length, `${dirPath} should be empty`).to.equal(0); } }); - it('ember new foo, test, SIGINT exits with error and clears tmp/', async function() { + it('ember new foo, test, SIGINT exits with error and clears tmp/', async function () { let result = await expect( runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--test-port=25522', { onOutput(string, child) { @@ -416,12 +416,12 @@ module.exports = function() { // With broccoli2 that should not exist, they should be using os.tmpdir(). // So we'll just check for "if tmp/ is there, are the contents correct?" if (fs.existsSync(dirPath)) { - let dir = fs.readdirSync(dirPath).filter(file => file !== '.metadata_never_index'); + let dir = fs.readdirSync(dirPath).filter((file) => file !== '.metadata_never_index'); expect(dir.length, `${dirPath} should be empty`).to.equal(0); } }); - it('ember new foo, build production and verify css files are concatenated', async function() { + it('ember new foo, build production and verify css files are concatenated', async function () { await copyFixtureFiles('with-styles'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--environment=production'); @@ -429,7 +429,7 @@ module.exports = function() { let dirPath = path.join(appRoot, 'dist', 'assets'); let dir = fs.readdirSync(dirPath); let cssNameRE = new RegExp(`${appName}-([a-f0-9]+)\\.css`, 'i'); - dir.forEach(function(filepath) { + dir.forEach(function (filepath) { if (cssNameRE.test(filepath)) { expect(file(`dist/assets/${filepath}`)) .to.contain('.some-weird-selector') @@ -438,7 +438,7 @@ module.exports = function() { }); }); - it('ember new foo, build production and verify css files are minified', async function() { + it('ember new foo, build production and verify css files are minified', async function () { await copyFixtureFiles('with-unminified-styles'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--environment=production'); @@ -446,7 +446,7 @@ module.exports = function() { let dirPath = path.join(appRoot, 'dist', 'assets'); let dir = fs.readdirSync(dirPath); let cssNameRE = new RegExp(`${appName}-([a-f0-9]+)\\.css`, 'i'); - dir.forEach(function(filepath) { + dir.forEach(function (filepath) { if (cssNameRE.test(filepath)) { let contents = fs.readFileSync(path.join(appRoot, 'dist', 'assets', filepath), { encoding: 'utf8' }); expect(contents).to.match(/^\S+$/, 'css file is minified'); @@ -454,13 +454,13 @@ module.exports = function() { }); }); - it('ember new foo, build production and verify single "use strict";', async function() { + it('ember new foo, build production and verify single "use strict";', async function () { await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--environment=production'); let dirPath = path.join(appRoot, 'dist', 'assets'); let dir = fs.readdirSync(dirPath); let appNameRE = new RegExp(`${appName}-([a-f0-9]+)\\.js`, 'i'); - dir.forEach(function(filepath) { + dir.forEach(function (filepath) { if (appNameRE.test(filepath)) { let contents = fs.readFileSync(path.join(appRoot, 'dist', 'assets', filepath), { encoding: 'utf8' }); let count = (contents.match(/(["'])use strict\1;/g) || []).length; @@ -469,7 +469,7 @@ module.exports = function() { }); }); - it('ember can override and reuse the built-in blueprints', async function() { + it('ember can override and reuse the built-in blueprints', async function () { await copyFixtureFiles('addon/with-blueprint-override'); await runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'generate', 'component', 'foo-bar'); @@ -480,7 +480,7 @@ module.exports = function() { expect(file(filePath)).to.contain('generated component successfully'); }); - it('template linting works properly for pods and classic structured templates', async function() { + it('template linting works properly for pods and classic structured templates', async function () { await copyFixtureFiles('smoke-tests/with-template-failing-linting'); let packageJsonPath = 'package.json'; diff --git a/tests/factories/command-options.js b/tests/factories/command-options.js index 2dfc439b85..5f1df04fbe 100644 --- a/tests/factories/command-options.js +++ b/tests/factories/command-options.js @@ -7,10 +7,10 @@ const MockProject = require('../helpers/mock-project'); function createProject() { let project = new MockProject(); - project.isEmberCLIProject = function() { + project.isEmberCLIProject = function () { return true; }; - project.config = function() { + project.config = function () { return {}; }; return project; diff --git a/tests/helpers/acceptance.js b/tests/helpers/acceptance.js index 22b2482ec9..7dd1b49ede 100644 --- a/tests/helpers/acceptance.js +++ b/tests/helpers/acceptance.js @@ -36,7 +36,7 @@ function applyCommand(command, name /*, ...flags*/) { let binaryPath = path.resolve(path.join(__dirname, '..', '..', 'bin', 'ember')); let args = [binaryPath, command, name, '--disable-analytics', '--watcher=node', '--skip-git', runCommandOptions]; - flags.forEach(function(flag) { + flags.forEach(function (flag) { args.splice(2, 0, flag); }); diff --git a/tests/helpers/assert-version-lock.js b/tests/helpers/assert-version-lock.js index 96005d7adb..b82bd0310e 100644 --- a/tests/helpers/assert-version-lock.js +++ b/tests/helpers/assert-version-lock.js @@ -7,7 +7,7 @@ const semver = require('semver'); module.exports = function assertVersionLock(_deps) { let deps = _deps || {}; - Object.keys(deps).forEach(function(name) { + Object.keys(deps).forEach(function (name) { if (name !== 'ember-cli' && semver.valid(deps[name]) && semver.gtr('1.0.0', deps[name])) { // only valid if the version is fixed expect(semver.valid(deps[name]), `"${name}" has a valid version`).to.be.ok; diff --git a/tests/helpers/convert-help-output-to-json.js b/tests/helpers/convert-help-output-to-json.js index 56d69f9e68..585439fd08 100644 --- a/tests/helpers/convert-help-output-to-json.js +++ b/tests/helpers/convert-help-output-to-json.js @@ -1,5 +1,5 @@ 'use strict'; -module.exports = function(output) { +module.exports = function (output) { return JSON.parse(output.substr(output.indexOf('{'))); }; diff --git a/tests/helpers/fixturify-project.js b/tests/helpers/fixturify-project.js index d942579a86..0fdca2615c 100644 --- a/tests/helpers/fixturify-project.js +++ b/tests/helpers/fixturify-project.js @@ -38,7 +38,7 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject { } addAddon(name, version = '0.0.0', cb) { - return this.addDependency(name, version, addon => { + return this.addDependency(name, version, (addon) => { prepareAddon(addon); if (typeof cb === 'function') { @@ -48,7 +48,7 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject { } addDevAddon(name, version = '0.0.0', cb) { - return this.addDevDependency(name, version, addon => { + return this.addDevDependency(name, version, (addon) => { prepareAddon(addon); if (typeof cb === 'function') { cb(addon); @@ -57,7 +57,7 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject { } addInRepoAddon(name, version = '0.0.0', cb) { - const inRepoAddon = new FixturifyProject(name, version, project => { + const inRepoAddon = new FixturifyProject(name, version, (project) => { project.pkg.keywords.push('ember-addon'); project.pkg['ember-addon'] = {}; project.files['index.js'] = 'module.exports = { name: require("./package").name };'; @@ -72,7 +72,7 @@ module.exports = class EmberCLIFixturifyProject extends FixturifyProject { addon.paths = addon.paths || []; const addonPath = `lib/${name}`; - if (addon.paths.find(path => path.toLowerCase() === addonPath.toLowerCase())) { + if (addon.paths.find((path) => path.toLowerCase() === addonPath.toLowerCase())) { throw new Error(`project: ${this.name} already contains the in-repo-addon: ${name}`); } diff --git a/tests/helpers/kill-cli-process.js b/tests/helpers/kill-cli-process.js index 336971b073..aef4d0318c 100644 --- a/tests/helpers/kill-cli-process.js +++ b/tests/helpers/kill-cli-process.js @@ -1,6 +1,6 @@ 'use strict'; -module.exports = function(childProcess) { +module.exports = function (childProcess) { // Calling `.kill` or `.send` when the process has already exited causes // errors on Windows, when an `.exitCode` is non-null the process has exited if (childProcess.exitCode !== null) { diff --git a/tests/helpers/log-on-failure.js b/tests/helpers/log-on-failure.js index d38ad41e49..7bfca90439 100644 --- a/tests/helpers/log-on-failure.js +++ b/tests/helpers/log-on-failure.js @@ -4,11 +4,11 @@ let logSink; -beforeEach(function() { +beforeEach(function () { logSink = []; }); -afterEach(function() { +afterEach(function () { if (this.currentTest && this.currentTest.state !== 'passed') { // It would be preferable to attach the log output to the error object // (this.currentTest.err) and have Mocha report it somehow, so that the diff --git a/tests/helpers/mock-process.js b/tests/helpers/mock-process.js index 97cbe4b516..15f08718d3 100644 --- a/tests/helpers/mock-process.js +++ b/tests/helpers/mock-process.js @@ -14,7 +14,7 @@ module.exports = class MockProcess extends EventEmitter { new EventEmitter(), { isRaw: process.stdin.isRaw, - setRawMode: flag => { + setRawMode: (flag) => { stdin.isRaw = flag; }, }, diff --git a/tests/helpers/mock-project.js b/tests/helpers/mock-project.js index 025707d771..97655e1aa3 100644 --- a/tests/helpers/mock-project.js +++ b/tests/helpers/mock-project.js @@ -27,7 +27,7 @@ class MockProject extends Project { require(file) { if (file === './server') { - return function() { + return function () { return { listen() { arguments[arguments.length - 1](); diff --git a/tests/helpers/process-help-string.js b/tests/helpers/process-help-string.js index c596ecea30..ebb6deae3c 100644 --- a/tests/helpers/process-help-string.js +++ b/tests/helpers/process-help-string.js @@ -5,7 +5,7 @@ const chalk = require('chalk'); // eslint-disable-next-line node/no-unpublished-require const stripAnsi = require('strip-ansi'); -module.exports = function(helpString) { +module.exports = function (helpString) { // currently windows if (chalk.supportsColor) { return helpString; diff --git a/tests/helpers/proxy-server.js b/tests/helpers/proxy-server.js index 058dfc1bfe..50aef85b34 100644 --- a/tests/helpers/proxy-server.js +++ b/tests/helpers/proxy-server.js @@ -22,15 +22,15 @@ class ProxyServer { }); let websocketEvents = (this.websocketEvents = []); - wsServer.on('connect', connection => { + wsServer.on('connect', (connection) => { websocketEvents.push('connect'); - connection.on('message', message => { + connection.on('message', (message) => { websocketEvents.push(`message: ${message.utf8Data}`); connection.sendUTF(message.utf8Data); }); - connection.on('error', error => { + connection.on('error', (error) => { websocketEvents.push(`error: ${error}`); }); diff --git a/tests/helpers/run-command.js b/tests/helpers/run-command.js index 439661dca8..c2942523ab 100644 --- a/tests/helpers/run-command.js +++ b/tests/helpers/run-command.js @@ -47,7 +47,7 @@ module.exports = function run(/* command, args, options */) { }); let child; - const promise = new Promise(function(resolve, reject) { + const promise = new Promise(function (resolve, reject) { options.log(` Running: ${command} ${args.join(' ')} in: ${process.cwd()}`); let opts = {}; @@ -73,7 +73,7 @@ module.exports = function run(/* command, args, options */) { code: null, }; - child.stdout.on('data', function(data) { + child.stdout.on('data', function (data) { let string = data.toString(); options.onOutput(string, child); @@ -81,7 +81,7 @@ module.exports = function run(/* command, args, options */) { result.output.push(string); }); - child.stderr.on('data', function(data) { + child.stderr.on('data', function (data) { let string = data.toString(); options.onError(string, child); @@ -89,7 +89,7 @@ module.exports = function run(/* command, args, options */) { result.errors.push(string); }); - child.on('close', function(code, signal) { + child.on('close', function (code, signal) { result.code = code; result.signal = signal; @@ -101,15 +101,15 @@ module.exports = function run(/* command, args, options */) { }); }); - promise.kill = function() { + promise.kill = function () { killCliProcess(child); }; return promise; }; -module.exports.killAll = function() { - RUNS.forEach(run => { +module.exports.killAll = function () { + RUNS.forEach((run) => { try { killCliProcess(run); } catch (e) { diff --git a/tests/helpers/tmp.js b/tests/helpers/tmp.js index 1275522cd7..17774f4001 100644 --- a/tests/helpers/tmp.js +++ b/tests/helpers/tmp.js @@ -4,15 +4,15 @@ const fs = require('fs-extra'); let root = process.cwd(); -module.exports.setup = function(path) { +module.exports.setup = function (path) { process.chdir(root); - return fs.remove(path).then(function() { + return fs.remove(path).then(function () { fs.mkdirsSync(path); }); }; -module.exports.teardown = function(path) { +module.exports.teardown = function (path) { process.chdir(root); return fs.remove(path); }; diff --git a/tests/integration/models/blueprint-test.js b/tests/integration/models/blueprint-test.js index 621e177050..2d81ce793f 100644 --- a/tests/integration/models/blueprint-test.js +++ b/tests/integration/models/blueprint-test.js @@ -110,22 +110,22 @@ let basicBlueprintFilesAfterBasic2 = [ 'test.txt', ]; -describe('Blueprint', function() { +describe('Blueprint', function () { const BasicBlueprintClass = require(basicBlueprint); let InstrumentedBasicBlueprint = BasicBlueprintClass.extend(instrumented); - beforeEach(function() { + beforeEach(function () { resetCalled(); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - describe('.fileMapTokens', function() { - it('adds additional tokens from fileMapTokens hook', function() { + describe('.fileMapTokens', function () { + it('adds additional tokens from fileMapTokens hook', function () { let blueprint = Blueprint.lookup(basicBlueprint); - blueprint.fileMapTokens = function() { + blueprint.fileMapTokens = function () { return { __foo__() { return 'foo'; @@ -137,8 +137,8 @@ describe('Blueprint', function() { }); }); - describe('.generateFileMap', function() { - it('should not have locals in the fileMap', function() { + describe('.generateFileMap', function () { + it('should not have locals in the fileMap', function () { let blueprint = Blueprint.lookup(basicBlueprint); let fileMapVariables = { @@ -162,8 +162,8 @@ describe('Blueprint', function() { }); }); - describe('.lookup', function() { - it('uses an explicit path if one is given', function() { + describe('.lookup', function () { + it('uses an explicit path if one is given', function () { const expectedClass = require(basicBlueprint); let blueprint = Blueprint.lookup(basicBlueprint); @@ -172,7 +172,7 @@ describe('Blueprint', function() { expect(blueprint instanceof expectedClass).to.equal(true); }); - it('finds blueprints within given lookup paths', function() { + it('finds blueprints within given lookup paths', function () { const expectedClass = require(basicBlueprint); let blueprint = Blueprint.lookup('basic', { paths: [fixtureBlueprints], @@ -183,7 +183,7 @@ describe('Blueprint', function() { expect(blueprint instanceof expectedClass).to.equal(true); }); - it('finds blueprints in the ember-cli package', function() { + it('finds blueprints in the ember-cli package', function () { let expectedPath = path.resolve(defaultBlueprints, 'app'); let expectedClass = Blueprint; @@ -194,7 +194,7 @@ describe('Blueprint', function() { expect(blueprint instanceof expectedClass).to.equal(true); }); - it('can instantiate a blueprint that exports an object instead of a constructor', function() { + it('can instantiate a blueprint that exports an object instead of a constructor', function () { let blueprint = Blueprint.lookup('exporting-object', { paths: [fixtureBlueprints], }); @@ -203,13 +203,13 @@ describe('Blueprint', function() { expect(blueprint instanceof Blueprint).to.equal(true); }); - it('throws an error if no blueprint is found', function() { + it('throws an error if no blueprint is found', function () { expect(() => { Blueprint.lookup('foo'); }).to.throw('Unknown blueprint: foo'); }); - it('returns undefined if no blueprint is found and ignoredMissing is passed', function() { + it('returns undefined if no blueprint is found and ignoredMissing is passed', function () { let blueprint = Blueprint.lookup('foo', { ignoreMissing: true, }); @@ -218,32 +218,32 @@ describe('Blueprint', function() { }); }); - it('exists', function() { + it('exists', function () { let blueprint = new Blueprint(basicBlueprint); expect(!!blueprint).to.equal(true); }); - it('derives name from path', function() { + it('derives name from path', function () { let blueprint = new Blueprint(basicBlueprint); expect(blueprint.name).to.equal('basic'); }); - describe('filesPath', function() { - it('returns the blueprints default files path', function() { + describe('filesPath', function () { + it('returns the blueprints default files path', function () { let blueprint = new Blueprint(basicBlueprint); expect(blueprint.filesPath()).to.equal(path.join(basicBlueprint, 'files')); }); }); - describe('basic blueprint installation', function() { + describe('basic blueprint installation', function () { let blueprint; let ui; let project; let options; let tmpdir; - beforeEach(async function() { + beforeEach(async function () { const dir = await mkTmpDirIn(tempRoot); tmpdir = dir; blueprint = new InstrumentedBasicBlueprint(basicBlueprint); @@ -258,11 +258,11 @@ describe('Blueprint', function() { }; }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('installs basic files', async function() { + it('installs basic files', async function () { expect(!!blueprint).to.equal(true); await blueprint.install(options); @@ -281,7 +281,7 @@ describe('Blueprint', function() { expect(output.length).to.equal(0); expect(actualFiles).to.deep.equal(basicBlueprintFiles); expect(() => { - fs.readFile(path.join(tmpdir, 'test.txt'), 'utf-8', function(err, content) { + fs.readFile(path.join(tmpdir, 'test.txt'), 'utf-8', function (err, content) { if (err) { throw 'error'; } @@ -290,7 +290,7 @@ describe('Blueprint', function() { }).not.to.throw(); }); - it('re-installing identical files', async function() { + it('re-installing identical files', async function () { await blueprint.install(options); let output = ui.output.trim().split(EOL); @@ -324,7 +324,7 @@ describe('Blueprint', function() { expect(actualFiles).to.deep.equal(basicBlueprintFiles); }); - it('re-installing conflicting files', async function() { + it('re-installing conflicting files', async function () { td.when(ui.prompt(td.matchers.anything())).thenReturn( Promise.resolve({ answer: 'skip' }), Promise.resolve({ answer: 'overwrite' }) @@ -366,7 +366,7 @@ describe('Blueprint', function() { expect(actualFiles).to.deep.equal(basicBlueprintFilesAfterBasic2); }); - it('installs path globPattern file', async function() { + it('installs path globPattern file', async function () { options.targetFiles = ['foo.txt']; await blueprint.install(options); let actualFiles = walkSync(tmpdir).sort(); @@ -387,7 +387,7 @@ describe('Blueprint', function() { expect(actualFiles).to.deep.equal(globFiles); }); - it('installs multiple globPattern files', async function() { + it('installs multiple globPattern files', async function () { options.targetFiles = ['foo.txt', 'test.txt']; await blueprint.install(options); let actualFiles = walkSync(tmpdir).sort(); @@ -409,12 +409,12 @@ describe('Blueprint', function() { expect(actualFiles).to.deep.equal(globFiles); }); - describe('called on an existing project', function() { - beforeEach(function() { + describe('called on an existing project', function () { + beforeEach(function () { Blueprint.ignoredUpdateFiles.push('foo.txt'); }); - it('ignores files in ignoredUpdateFiles', async function() { + it('ignores files in ignoredUpdateFiles', async function () { td.when(ui.prompt(), { ignoreExtraArgs: true }).thenReturn(Promise.resolve({ answer: 'skip' })); await blueprint.install(options); @@ -433,7 +433,7 @@ describe('Blueprint', function() { let blueprintNew = new Blueprint(basicNewBlueprint); - options.project.isEmberCLIProject = function() { + options.project.isEmberCLIProject = function () { return true; }; @@ -453,12 +453,12 @@ describe('Blueprint', function() { }); }); - describe('called on a new project', function() { - beforeEach(function() { + describe('called on a new project', function () { + beforeEach(function () { Blueprint.ignoredUpdateFiles.push('foo.txt'); }); - it('does not ignores files in ignoredUpdateFiles', async function() { + it('does not ignores files in ignoredUpdateFiles', async function () { td.when(ui.prompt(), { ignoreExtraArgs: true }).thenReturn(Promise.resolve({ answer: 'skip' })); await blueprint.install(options); @@ -477,7 +477,7 @@ describe('Blueprint', function() { let blueprintNew = new Blueprint(basicNewBlueprint); - options.project.isEmberCLIProject = function() { + options.project.isEmberCLIProject = function () { return false; }; @@ -498,7 +498,7 @@ describe('Blueprint', function() { }); }); - it('throws error when there is a trailing forward slash in entityName', function() { + it('throws error when there is a trailing forward slash in entityName', function () { options.entity = { name: 'foo/' }; expect(() => { blueprint.install(options); @@ -519,14 +519,14 @@ describe('Blueprint', function() { }).not.to.throw(); }); - it('throws error when an entityName is not provided', function() { + it('throws error when an entityName is not provided', function () { options.entity = {}; expect(() => { blueprint.install(options); }).to.throw(SilentError, /The `ember generate ` command requires an entity name to be specified./); }); - it('throws error when an action does not exist', async function() { + it('throws error when an action does not exist', async function () { blueprint._actions = {}; try { await blueprint.install(options); @@ -536,9 +536,9 @@ describe('Blueprint', function() { } }); - it('calls normalizeEntityName hook during install', async function() { - const wait = new Promise(resolve => { - blueprint.normalizeEntityName = function() { + it('calls normalizeEntityName hook during install', async function () { + const wait = new Promise((resolve) => { + blueprint.normalizeEntityName = function () { resolve(); }; }); @@ -547,8 +547,8 @@ describe('Blueprint', function() { await wait; }); - it('normalizeEntityName hook can modify the entity name', async function() { - blueprint.normalizeEntityName = function() { + it('normalizeEntityName hook can modify the entity name', async function () { + blueprint.normalizeEntityName = function () { return 'foo'; }; options.entity = { name: 'bar' }; @@ -560,11 +560,11 @@ describe('Blueprint', function() { expect(actualFiles).to.not.contain('app/basics/mock-project.txt'); }); - it('calls normalizeEntityName before locals hook is called', function(done) { - blueprint.normalizeEntityName = function() { + it('calls normalizeEntityName before locals hook is called', function (done) { + blueprint.normalizeEntityName = function () { return 'foo'; }; - blueprint.locals = function(options) { + blueprint.locals = function (options) { expect(options.entity.name).to.equal('foo'); done(); }; @@ -572,7 +572,7 @@ describe('Blueprint', function() { blueprint.install(options); }); - it('calls appropriate hooks with correct arguments', async function() { + it('calls appropriate hooks with correct arguments', async function () { options.entity = { name: 'foo' }; await blueprint.install(options); @@ -586,12 +586,12 @@ describe('Blueprint', function() { expect(afterUninstallCalled).to.be.false; }); - it("doesn't throw when running uninstall without installing first", function() { + it("doesn't throw when running uninstall without installing first", function () { return blueprint.uninstall(options); }); }); - describe('basic blueprint uninstallation', function() { + describe('basic blueprint uninstallation', function () { const BasicBlueprintClass = require(basicBlueprint); let blueprint; let ui; @@ -604,7 +604,7 @@ describe('Blueprint', function() { options.ui = ui; } - beforeEach(async function() { + beforeEach(async function () { let dir = await mkTmpDirIn(tempRoot); tmpdir = dir; @@ -620,11 +620,11 @@ describe('Blueprint', function() { refreshUI(); }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('uninstalls basic files', async function() { + it('uninstalls basic files', async function () { expect(!!blueprint).to.equal(true); await blueprint.uninstall(options); @@ -646,7 +646,7 @@ describe('Blueprint', function() { expect(fs.existsSync(path.join(tmpdir, 'test.txt'))).to.be.false; }); - it("uninstall doesn't remove non-empty folders", async function() { + it("uninstall doesn't remove non-empty folders", async function () { options.entity = { name: 'foo' }; await blueprint.install(options); @@ -662,7 +662,7 @@ describe('Blueprint', function() { expect(actualFiles).to.contain('app/basics/mock-project.txt'); }); - it("uninstall doesn't log remove messages when file does not exist", async function() { + it("uninstall doesn't log remove messages when file does not exist", async function () { options.entity = { name: 'does-not-exist' }; await blueprint.uninstall(options); @@ -674,7 +674,7 @@ describe('Blueprint', function() { }); }); - describe('instrumented blueprint uninstallation', function() { + describe('instrumented blueprint uninstallation', function () { let blueprint; let ui; let project; @@ -686,7 +686,7 @@ describe('Blueprint', function() { options.ui = ui; } - beforeEach(async function() { + beforeEach(async function () { let dir = await mkTmpDirIn(tempRoot); tmpdir = dir; blueprint = new InstrumentedBasicBlueprint(basicBlueprint); @@ -701,7 +701,7 @@ describe('Blueprint', function() { refreshUI(); }); - it('calls appropriate hooks with correct arguments', async function() { + it('calls appropriate hooks with correct arguments', async function () { options.entity = { name: 'foo' }; await blueprint.uninstall(options); @@ -717,23 +717,23 @@ describe('Blueprint', function() { }); }); - describe('addPackageToProject', function() { + describe('addPackageToProject', function () { let blueprint; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); }); - it('passes a packages array for addPackagesToProject', function() { - blueprint.addPackagesToProject = function(packages) { + it('passes a packages array for addPackagesToProject', function () { + blueprint.addPackagesToProject = function (packages) { expect(packages).to.deep.equal([{ name: 'foo-bar' }]); }; blueprint.addPackageToProject('foo-bar'); }); - it('passes a packages array with target for addPackagesToProject', function() { - blueprint.addPackagesToProject = function(packages) { + it('passes a packages array with target for addPackagesToProject', function () { + blueprint.addPackagesToProject = function (packages) { expect(packages).to.deep.equal([{ name: 'foo-bar', target: '^123.1.12' }]); }; @@ -741,26 +741,26 @@ describe('Blueprint', function() { }); }); - describe('addPackagesToProject', function() { + describe('addPackagesToProject', function () { let blueprint; let ui; let NpmInstallTask; let taskNameLookedUp; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); ui = new MockUI(); - blueprint.taskFor = function(name) { + blueprint.taskFor = function (name) { taskNameLookedUp = name; return new NpmInstallTask(); }; }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('looks up the `npm-install` task', function() { + it('looks up the `npm-install` task', function () { NpmInstallTask = Task.extend({ run() {}, }); @@ -770,7 +770,7 @@ describe('Blueprint', function() { expect(taskNameLookedUp).to.equal('npm-install'); }); - it('calls the task with package names', function() { + it('calls the task with package names', function () { let packages; NpmInstallTask = Task.extend({ @@ -784,7 +784,7 @@ describe('Blueprint', function() { expect(packages).to.deep.equal(['foo-bar', 'bar-foo']); }); - it('calls the task with package names and versions', function() { + it('calls the task with package names and versions', function () { let packages; NpmInstallTask = Task.extend({ @@ -801,7 +801,7 @@ describe('Blueprint', function() { expect(packages).to.deep.equal(['foo-bar@^123.1.12', 'bar-foo@0.0.7']); }); - it('writes information to the ui log for a single package', function() { + it('writes information to the ui log for a single package', function () { blueprint.ui = ui; blueprint.addPackagesToProject([{ name: 'foo-bar', target: '^123.1.12' }]); @@ -811,7 +811,7 @@ describe('Blueprint', function() { expect(output).to.match(/install package.*foo-bar/); }); - it('writes information to the ui log for multiple packages', function() { + it('writes information to the ui log for multiple packages', function () { blueprint.ui = ui; blueprint.addPackagesToProject([ @@ -824,7 +824,7 @@ describe('Blueprint', function() { expect(output).to.match(/install packages.*foo-bar, bar-foo/); }); - it('does not error if ui is not present', function() { + it('does not error if ui is not present', function () { delete blueprint.ui; blueprint.addPackagesToProject([{ name: 'foo-bar', target: '^123.1.12' }]); @@ -834,7 +834,7 @@ describe('Blueprint', function() { expect(output).to.not.match(/install package.*foo-bar/); }); - it('runs task with --save-dev', function() { + it('runs task with --save-dev', function () { let saveDev; NpmInstallTask = Task.extend({ @@ -851,7 +851,7 @@ describe('Blueprint', function() { expect(!!saveDev).to.equal(true); }); - it('does not use verbose mode with the task', function() { + it('does not use verbose mode with the task', function () { let verbose; NpmInstallTask = Task.extend({ @@ -869,33 +869,33 @@ describe('Blueprint', function() { }); }); - describe('removePackageFromProject', function() { + describe('removePackageFromProject', function () { let blueprint; let NpmUninstallTask; let taskNameLookedUp; let project; - beforeEach(function() { + beforeEach(function () { project = new MockProject(); blueprint = new Blueprint(basicBlueprint); blueprint.project = project; - blueprint.taskFor = function(name) { + blueprint.taskFor = function (name) { taskNameLookedUp = name; return new NpmUninstallTask(); }; }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('looks up the `npm-uninstall` task', function() { + it('looks up the `npm-uninstall` task', function () { NpmUninstallTask = Task.extend({ run() {}, }); - project.dependencies = function() { + project.dependencies = function () { return { 'foo-bar': '1.0.0', }; @@ -906,30 +906,30 @@ describe('Blueprint', function() { }); }); - describe('removePackagesFromProject', function() { + describe('removePackagesFromProject', function () { let blueprint; let ui; let NpmUninstallTask; let taskNameLookedUp; let project; - beforeEach(function() { + beforeEach(function () { project = new MockProject(); blueprint = new Blueprint(basicBlueprint); ui = new MockUI(); blueprint.project = project; - blueprint.taskFor = function(name) { + blueprint.taskFor = function (name) { taskNameLookedUp = name; return new NpmUninstallTask(); }; }); - afterEach(function() { + afterEach(function () { return remove(tempRoot); }); - it('looks up the `npm-uninstall` task', function() { + it('looks up the `npm-uninstall` task', function () { NpmUninstallTask = Task.extend({ run() {}, }); @@ -939,7 +939,7 @@ describe('Blueprint', function() { expect(taskNameLookedUp).to.equal('npm-uninstall'); }); - it('calls the task with only existing packages', function() { + it('calls the task with only existing packages', function () { let packages; NpmUninstallTask = Task.extend({ @@ -948,7 +948,7 @@ describe('Blueprint', function() { }, }); - project.dependencies = function() { + project.dependencies = function () { return { 'foo-bar': '1.0.0', 'bar-zoo': '2.0.0', @@ -960,7 +960,7 @@ describe('Blueprint', function() { expect(packages).to.deep.equal(['foo-bar']); }); - it('skips uninstall if no matching package exists', function() { + it('skips uninstall if no matching package exists', function () { let packages; NpmUninstallTask = Task.extend({ @@ -969,7 +969,7 @@ describe('Blueprint', function() { }, }); - project.dependencies = function() { + project.dependencies = function () { return { 'foo-baz': '1.0.0', 'bar-zoo': '2.0.0', @@ -981,7 +981,7 @@ describe('Blueprint', function() { expect(packages).to.deep.equal(undefined); }); - it('calls the task with package names', function() { + it('calls the task with package names', function () { let packages; NpmUninstallTask = Task.extend({ @@ -990,7 +990,7 @@ describe('Blueprint', function() { }, }); - project.dependencies = function() { + project.dependencies = function () { return { 'foo-bar': '1.0.0', 'bar-foo': '2.0.0', @@ -1002,10 +1002,10 @@ describe('Blueprint', function() { expect(packages).to.deep.equal(['foo-bar', 'bar-foo']); }); - it('writes information to the ui log for a single package', function() { + it('writes information to the ui log for a single package', function () { blueprint.ui = ui; - project.dependencies = function() { + project.dependencies = function () { return { 'foo-bar': '1.0.0', }; @@ -1018,10 +1018,10 @@ describe('Blueprint', function() { expect(output).to.match(/uninstall package.*foo-bar/); }); - it('writes information to the ui log for multiple packages', function() { + it('writes information to the ui log for multiple packages', function () { blueprint.ui = ui; - project.dependencies = function() { + project.dependencies = function () { return { 'foo-bar': '1.0.0', 'bar-foo': '2.0.0', @@ -1035,7 +1035,7 @@ describe('Blueprint', function() { expect(output).to.match(/uninstall packages.*foo-bar, bar-foo/); }); - it('does not error if ui is not present', function() { + it('does not error if ui is not present', function () { delete blueprint.ui; blueprint.removePackagesFromProject([{ name: 'foo-bar' }]); @@ -1045,7 +1045,7 @@ describe('Blueprint', function() { expect(output).to.not.match(/uninstall package.*foo-bar/); }); - it('runs task with --save-dev', function() { + it('runs task with --save-dev', function () { let saveDev; NpmUninstallTask = Task.extend({ @@ -1054,7 +1054,7 @@ describe('Blueprint', function() { }, }); - project.dependencies = function() { + project.dependencies = function () { return { 'foo-bar': '1.0.0', 'bar-foo': '2.0.0', @@ -1066,7 +1066,7 @@ describe('Blueprint', function() { expect(!!saveDev).to.equal(true); }); - it('does not use verbose mode with the task', function() { + it('does not use verbose mode with the task', function () { let verbose; NpmUninstallTask = Task.extend({ @@ -1075,7 +1075,7 @@ describe('Blueprint', function() { }, }); - project.dependencies = function() { + project.dependencies = function () { return { 'foo-bar': '1.0.0', 'bar-foo': '2.0.0', @@ -1088,50 +1088,50 @@ describe('Blueprint', function() { }); }); - describe('addBowerPackageToProject', function() { + describe('addBowerPackageToProject', function () { let blueprint; let ui; let BowerInstallTask; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); ui = new MockUI(); blueprint.ui = ui; - blueprint.taskFor = function() { + blueprint.taskFor = function () { return new BowerInstallTask(); }; }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('passes a packages array for addBowerPackagesToProject', function() { - blueprint.addBowerPackagesToProject = function(packages) { + it('passes a packages array for addBowerPackagesToProject', function () { + blueprint.addBowerPackagesToProject = function (packages) { expect(packages).to.deep.equal([{ name: 'foo-bar', source: 'foo-bar', target: '*' }]); }; blueprint.addBowerPackageToProject('foo-bar'); }); - it('passes a packages array with target for addBowerPackagesToProject', function() { - blueprint.addBowerPackagesToProject = function(packages) { + it('passes a packages array with target for addBowerPackagesToProject', function () { + blueprint.addBowerPackagesToProject = function (packages) { expect(packages).to.deep.equal([{ name: 'foo-bar', source: 'foo-bar', target: '1.0.0' }]); }; blueprint.addBowerPackageToProject('foo-bar', '1.0.0'); }); - it('correctly handles local package naming, with a numbered pkg version', function() { - blueprint.addBowerPackagesToProject = function(packages) { + it('correctly handles local package naming, with a numbered pkg version', function () { + blueprint.addBowerPackagesToProject = function (packages) { expect(packages).to.deep.equal([{ name: 'foo-bar-local', target: '1.0.0', source: 'foo-bar' }]); }; blueprint.addBowerPackageToProject('foo-bar-local', 'foo-bar#1.0.0'); }); - it('correctly handles local package naming, with a non-versioned package', function() { - blueprint.addBowerPackagesToProject = function(packages) { + it('correctly handles local package naming, with a non-versioned package', function () { + blueprint.addBowerPackagesToProject = function (packages) { expect(packages).to.deep.equal([ { name: 'foo-bar-local', target: '*', source: 'https://twitter.github.io/bootstrap/assets/bootstrap' }, ]); @@ -1141,24 +1141,24 @@ describe('Blueprint', function() { }); }); - describe('addBowerPackagesToProject', function() { + describe('addBowerPackagesToProject', function () { let blueprint; let BowerInstallTask; let taskNameLookedUp; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); - blueprint.taskFor = function(name) { + blueprint.taskFor = function (name) { taskNameLookedUp = name; return new BowerInstallTask(); }; }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('looks up the `bower-install` task', function() { + it('looks up the `bower-install` task', function () { BowerInstallTask = Task.extend({ run() {}, }); @@ -1167,7 +1167,7 @@ describe('Blueprint', function() { expect(taskNameLookedUp).to.equal('bower-install'); }); - it('calls the task with the package names', function() { + it('calls the task with the package names', function () { let packages; BowerInstallTask = Task.extend({ @@ -1181,7 +1181,7 @@ describe('Blueprint', function() { expect(packages).to.deep.equal(['foo-bar=foo-bar', 'bar-foo=bar-foo']); }); - it('uses the provided target (version, range, sha, etc)', function() { + it('uses the provided target (version, range, sha, etc)', function () { let packages; BowerInstallTask = Task.extend({ @@ -1198,7 +1198,7 @@ describe('Blueprint', function() { expect(packages).to.deep.equal(['foo-bar=foo-bar#~1.0.0', 'bar-foo=bar-foo#0.7.0']); }); - it('properly parses a variety of bower package endpoints', function() { + it('properly parses a variety of bower package endpoints', function () { let packages; BowerInstallTask = Task.extend({ @@ -1223,7 +1223,7 @@ describe('Blueprint', function() { ]); }); - it('uses uses verbose mode with the task', function() { + it('uses uses verbose mode with the task', function () { let verbose; BowerInstallTask = Task.extend({ @@ -1241,27 +1241,27 @@ describe('Blueprint', function() { }); }); - describe('addAddonToProject', function() { + describe('addAddonToProject', function () { let blueprint; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('passes a packages array for addAddonsToProject', function() { - blueprint.addAddonsToProject = function(options) { + it('passes a packages array for addAddonsToProject', function () { + blueprint.addAddonsToProject = function (options) { expect(options.packages).to.deep.equal(['foo-bar']); }; blueprint.addAddonToProject('foo-bar'); }); - it('passes a packages array with target for addAddonsToProject', function() { - blueprint.addAddonsToProject = function(options) { + it('passes a packages array with target for addAddonsToProject', function () { + blueprint.addAddonsToProject = function (options) { expect(options.packages).to.deep.equal([{ name: 'foo-bar', target: '^123.1.12' }]); }; @@ -1269,26 +1269,26 @@ describe('Blueprint', function() { }); }); - describe('addAddonsToProject', function() { + describe('addAddonsToProject', function () { let blueprint; let ui; let AddonInstallTask; let taskNameLookedUp; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); ui = new MockUI(); - blueprint.taskFor = function(name) { + blueprint.taskFor = function (name) { taskNameLookedUp = name; return new AddonInstallTask(); }; }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('looks up the `addon-install` task', function() { + it('looks up the `addon-install` task', function () { AddonInstallTask = Task.extend({ run() {}, }); @@ -1298,7 +1298,7 @@ describe('Blueprint', function() { expect(taskNameLookedUp).to.equal('addon-install'); }); - it('calls the task with package name', function() { + it('calls the task with package name', function () { let pkg; AddonInstallTask = Task.extend({ @@ -1312,7 +1312,7 @@ describe('Blueprint', function() { expect(pkg).to.deep.equal(['foo-bar', 'baz-bat']); }); - it('calls the task with correctly parsed options', function() { + it('calls the task with correctly parsed options', function () { let pkg, args, bluOpts; AddonInstallTask = Task.extend({ @@ -1341,7 +1341,7 @@ describe('Blueprint', function() { expect(bluOpts).to.equal('-foo'); }); - it('writes information to the ui log for a single package', function() { + it('writes information to the ui log for a single package', function () { blueprint.ui = ui; blueprint.addAddonsToProject({ @@ -1358,7 +1358,7 @@ describe('Blueprint', function() { expect(output).to.match(/install addon.*foo-bar/); }); - it('writes information to the ui log for multiple packages', function() { + it('writes information to the ui log for multiple packages', function () { blueprint.ui = ui; blueprint.addAddonsToProject({ @@ -1377,7 +1377,7 @@ describe('Blueprint', function() { expect(output).to.match(/install addons.*foo-bar@1.0.0,.*stuff-things,.*baz-bat@0.0.1/); }); - it('does not error if ui is not present', function() { + it('does not error if ui is not present', function () { delete blueprint.ui; blueprint.addAddonsToProject({ @@ -1395,24 +1395,24 @@ describe('Blueprint', function() { }); }); - describe('load', function() { - it('loads and returns a blueprint object', function() { + describe('load', function () { + it('loads and returns a blueprint object', function () { let blueprint = Blueprint.load(basicBlueprint); expect(blueprint).to.be.an('object'); expect(blueprint.name).to.equal('basic'); }); - it('loads only blueprints with an index.js', function() { + it('loads only blueprints with an index.js', function () { expect(Blueprint.load(path.join(fixtureBlueprints, '.notablueprint'))).to.not.exist; }); }); - describe('lookupBlueprint', function() { + describe('lookupBlueprint', function () { let blueprint; let tmpdir; let project; - beforeEach(async function() { + beforeEach(async function () { let dir = await mkTmpDirIn(tempRoot); tmpdir = dir; blueprint = new Blueprint(basicBlueprint); @@ -1420,29 +1420,29 @@ describe('Blueprint', function() { // normally provided by `install`, but mocked here for testing project.root = tmpdir; blueprint.project = project; - project.blueprintLookupPaths = function() { + project.blueprintLookupPaths = function () { return [fixtureBlueprints]; }; }); - afterEach(async function() { + afterEach(async function () { await remove(tempRoot); }); - it('can lookup other Blueprints from the project blueprintLookupPaths', function() { + it('can lookup other Blueprints from the project blueprintLookupPaths', function () { let result = blueprint.lookupBlueprint('basic_2'); expect(result.description).to.equal('Another basic blueprint'); }); - it('can find internal blueprints', function() { + it('can find internal blueprints', function () { let result = blueprint.lookupBlueprint('blueprint'); expect(result.description).to.equal('Generates a blueprint and definition.'); }); }); - describe('._generateFileMapVariables', function() { + describe('._generateFileMapVariables', function () { let blueprint; let project; let moduleName; @@ -1451,7 +1451,7 @@ describe('Blueprint', function() { let result; let expectation; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); project = new MockProject(); moduleName = project.name(); @@ -1478,13 +1478,13 @@ describe('Blueprint', function() { }; }); - it('should create the correct default fileMapVariables', function() { + it('should create the correct default fileMapVariables', function () { result = blueprint._generateFileMapVariables(moduleName, locals, options); expect(result).to.eql(expectation); }); - it('should use the moduleName method argument for moduleName', function() { + it('should use the moduleName method argument for moduleName', function () { moduleName = 'foo'; expectation.dasherizedModuleName = 'foo'; @@ -1493,7 +1493,7 @@ describe('Blueprint', function() { expect(result).to.eql(expectation); }); - it('should use the locals method argument for its locals value', function() { + it('should use the locals method argument for its locals value', function () { locals = { foo: 'bar' }; expectation.locals = locals; @@ -1502,7 +1502,7 @@ describe('Blueprint', function() { expect(result).to.eql(expectation); }); - it('should use the option.originBlueprintName value as its originBlueprintName if included in the options hash', function() { + it('should use the option.originBlueprintName value as its originBlueprintName if included in the options hash', function () { options.originBlueprintName = 'foo'; expectation.originBlueprintName = 'foo'; @@ -1511,8 +1511,8 @@ describe('Blueprint', function() { expect(result).to.eql(expectation); }); - it("should include a podPath if the project's podModulePrefix is defined", function() { - blueprint.project.config = function() { + it("should include a podPath if the project's podModulePrefix is defined", function () { + blueprint.project.config = function () { return { podModulePrefix: 'foo/bar', }; @@ -1525,10 +1525,10 @@ describe('Blueprint', function() { expect(result).to.eql(expectation); }); - it('should include an inAddon and inDummy flag of true if the project is an addon', function() { + it('should include an inAddon and inDummy flag of true if the project is an addon', function () { options.dummy = true; - blueprint.project.isEmberCLIAddon = function() { + blueprint.project.isEmberCLIAddon = function () { return true; }; @@ -1540,7 +1540,7 @@ describe('Blueprint', function() { expect(result).to.eql(expectation); }); - it('should include an inAddon and inRepoAddon flag of true if options.inRepoAddon is true', function() { + it('should include an inAddon and inRepoAddon flag of true if options.inRepoAddon is true', function () { options.inRepoAddon = true; expectation.inRepoAddon = true; @@ -1551,7 +1551,7 @@ describe('Blueprint', function() { expect(result).to.eql(expectation); }); - it('should include an in flag of true if options.in is true', function() { + it('should include an in flag of true if options.in is true', function () { options.in = true; expectation.in = true; @@ -1561,7 +1561,7 @@ describe('Blueprint', function() { expect(result).to.eql(expectation); }); - it('should have a hasPathToken flag of true if the blueprint hasPathToken is true', function() { + it('should have a hasPathToken flag of true if the blueprint hasPathToken is true', function () { blueprint.hasPathToken = true; expectation.hasPathToken = true; @@ -1572,22 +1572,22 @@ describe('Blueprint', function() { }); }); - describe('._locals', function() { + describe('._locals', function () { let blueprint; let project; let options; let result; let expectation; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint(basicBlueprint); project = new MockProject(); - blueprint._generateFileMapVariables = function() { + blueprint._generateFileMapVariables = function () { return {}; }; - blueprint.generateFileMap = function() { + blueprint.generateFileMap = function () { return {}; }; @@ -1606,26 +1606,26 @@ describe('Blueprint', function() { }; }); - it('should return a default object if no custom options are passed', async function() { + it('should return a default object if no custom options are passed', async function () { result = await blueprint._locals(options); expect(result).to.deep.include(expectation); }); - it('it should call the locals method with the correct arguments', function() { - blueprint.locals = function(opts) { + it('it should call the locals method with the correct arguments', function () { + blueprint.locals = function (opts) { expect(opts).to.equal(options); }; blueprint._locals(options); }); - it('should call _generateFileMapVariables with the correct arguments', function() { - blueprint.locals = function() { + it('should call _generateFileMapVariables with the correct arguments', function () { + blueprint.locals = function () { return { foo: 'bar' }; }; - blueprint._generateFileMapVariables = function(modName, lcls, opts) { + blueprint._generateFileMapVariables = function (modName, lcls, opts) { expect(modName).to.equal('mock-project'); expect(lcls).to.eql({ foo: 'bar' }); expect(opts).to.eql(opts); @@ -1634,19 +1634,19 @@ describe('Blueprint', function() { blueprint._locals(options); }); - it('should call generateFileMap with the correct arguments', function() { - blueprint._generateFileMapVariables = function() { + it('should call generateFileMap with the correct arguments', function () { + blueprint._generateFileMapVariables = function () { return { bar: 'baz' }; }; - blueprint.generateFileMap = function(fileMapVariables) { + blueprint.generateFileMap = function (fileMapVariables) { expect(fileMapVariables).to.eql({ bar: 'baz' }); }; blueprint._locals(options); }); - it('should use the options.entity.name as its moduleName if its value is defined', async function() { + it('should use the options.entity.name as its moduleName if its value is defined', async function () { options.entity = { name: 'foo', }; @@ -1661,8 +1661,8 @@ describe('Blueprint', function() { expect(result).to.deep.include(expectation); }); - it('should update its fileMap values to match the generateFileMap result', async function() { - blueprint.generateFileMap = function() { + it('should update its fileMap values to match the generateFileMap result', async function () { + blueprint.generateFileMap = function () { return { foo: 'bar' }; }; @@ -1673,8 +1673,8 @@ describe('Blueprint', function() { expect(result).to.deep.include(expectation); }); - it('should return an object containing custom local values', async function() { - blueprint.locals = function() { + it('should return an object containing custom local values', async function () { + blueprint.locals = function () { return { foo: 'bar' }; }; diff --git a/tests/integration/tasks/build-test.js b/tests/integration/tasks/build-test.js index 7a59508723..f7c3012522 100644 --- a/tests/integration/tasks/build-test.js +++ b/tests/integration/tasks/build-test.js @@ -16,26 +16,26 @@ const willInterruptProcess = require('../../../lib/utilities/will-interrupt-proc let root = process.cwd(); let tmproot = path.join(root, 'tmp'); -describe('build task test', function() { +describe('build task test', function () { let project, ui, _process; - beforeEach(function() { + beforeEach(function () { _process = new MockProcess(); willInterruptProcess.capture(_process); return mkTmpDirIn(tmproot) - .then(function(tmpdir) { + .then(function (tmpdir) { process.chdir(tmpdir); }) - .then(function() { + .then(function () { return copyFixtureFiles('tasks/builder'); }) - .then(function() { + .then(function () { project = new MockProject(); ui = project.ui; }); }); - afterEach(function() { + afterEach(function () { willInterruptProcess.release(); process.chdir(root); delete process.env.BROCCOLI_VIZ; @@ -43,7 +43,7 @@ describe('build task test', function() { return fs.remove(tmproot); }); - it('can build', function() { + it('can build', function () { let outputPath = 'dist'; let task = new BuildTask({ analytics: new MockAnalytics(), @@ -62,7 +62,7 @@ describe('build task test', function() { }); }); - it('generates valid visualization output', function() { + it('generates valid visualization output', function () { process.env.BROCCOLI_VIZ = '1'; let outputPath = 'dist'; @@ -77,7 +77,7 @@ describe('build task test', function() { environment: 'development', }; - return task.run(runOptions).then(function() { + return task.run(runOptions).then(function () { let vizOutputPath = 'instrumentation.build.0.json'; expect(file(vizOutputPath)).to.exist; @@ -92,7 +92,7 @@ describe('build task test', function() { }); }); - it('it displays environment', function() { + it('it displays environment', function () { let outputPath = 'dist'; let task = new BuildTask({ analytics: new MockAnalytics(), diff --git a/tests/integration/utilities/clean-remove-test.js b/tests/integration/utilities/clean-remove-test.js index b56a141407..fdf29ee25e 100644 --- a/tests/integration/utilities/clean-remove-test.js +++ b/tests/integration/utilities/clean-remove-test.js @@ -6,13 +6,13 @@ const temp = require('temp'); const path = require('path'); const fs = require('fs-extra'); -describe('clean-remove', function() { +describe('clean-remove', function () { let tempDir; let originalCwd = process.cwd(); let fileInfo; let nestedPath = 'nested1/nested2'; - beforeEach(function() { + beforeEach(function () { tempDir = temp.mkdirSync('clean-remove'); process.chdir(tempDir); @@ -21,32 +21,32 @@ describe('clean-remove', function() { }; }); - afterEach(function() { + afterEach(function () { process.chdir(originalCwd); fs.removeSync(tempDir); }); - it('removes empty folders', function() { + it('removes empty folders', function () { let displayPath = path.join(nestedPath, 'file.txt'); fileInfo.outputPath = path.join(tempDir, displayPath); fileInfo.displayPath = displayPath; return fs .outputFile(displayPath, '') - .then(function() { - return fs.stat(displayPath).then(function(stats) { + .then(function () { + return fs.stat(displayPath).then(function (stats) { expect(stats).to.be.ok; }); }) - .then(function() { + .then(function () { return cleanRemove(fileInfo); }) - .then(function() { + .then(function () { return expect(fs.stat('nested1')).to.be.rejected; }); }); - it('preserves filled folders', function() { + it('preserves filled folders', function () { let removedDisplayPath = path.join(nestedPath, 'file.txt'); let preservedDisplayPath = path.join(nestedPath, 'file2.txt'); fileInfo.outputPath = path.join(tempDir, removedDisplayPath); @@ -54,22 +54,22 @@ describe('clean-remove', function() { return fs .outputFile(removedDisplayPath, '') - .then(function() { + .then(function () { return fs.outputFile(preservedDisplayPath, ''); }) - .then(function() { - return fs.stat(preservedDisplayPath).then(function(stats) { + .then(function () { + return fs.stat(preservedDisplayPath).then(function (stats) { expect(stats).to.be.ok; }); }) - .then(function() { + .then(function () { return cleanRemove(fileInfo); }) - .then(function() { + .then(function () { return expect(fs.stat(removedDisplayPath)).to.be.rejected; }) - .then(function() { - return fs.stat(preservedDisplayPath).then(function(stats) { + .then(function () { + return fs.stat(preservedDisplayPath).then(function (stats) { expect(stats).to.be.ok; }); }); diff --git a/tests/runner.js b/tests/runner.js index a1e624a6f3..13d0ba3e7c 100644 --- a/tests/runner.js +++ b/tests/runner.js @@ -53,12 +53,12 @@ function runMocha() { // ensure that at the end of every test, we are in the correct current // working directory - mocha.suite.afterEach(function() { + mocha.suite.afterEach(function () { expect(process.cwd()).to.equal(ROOT); }); console.time('Mocha Tests Running Time'); - mocha.run(failures => { + mocha.run((failures) => { console.timeEnd('Mocha Tests Running Time'); // eslint-disable-next-line no-process-exit @@ -68,7 +68,7 @@ function runMocha() { Promise.resolve() .then(() => runMocha()) - .catch(error => { + .catch((error) => { console.error(error); console.error(error.stack); diff --git a/tests/unit/analytics-test.js b/tests/unit/analytics-test.js index 01056595bd..6934db4088 100644 --- a/tests/unit/analytics-test.js +++ b/tests/unit/analytics-test.js @@ -7,8 +7,8 @@ const MockProject = require('../helpers/mock-project'); let command; let called = false; -describe('analytics', function() { - beforeEach(function() { +describe('analytics', function () { + beforeEach(function () { let analytics = { track() { called = true; @@ -21,7 +21,7 @@ describe('analytics', function() { }); let project = new MockProject(); - project.isEmberCLIProject = function() { + project.isEmberCLIProject = function () { return true; }; @@ -32,11 +32,11 @@ describe('analytics', function() { }); }); - afterEach(function() { + afterEach(function () { command = null; }); - it('track gets invoked on command.validateAndRun()', async function() { + it('track gets invoked on command.validateAndRun()', async function () { await command.validateAndRun([]); expect(called, 'expected analytics.track to be called').to.be.true; }); diff --git a/tests/unit/blueprints/addon-test.js b/tests/unit/blueprints/addon-test.js index b33570233e..c258df66f5 100644 --- a/tests/unit/blueprints/addon-test.js +++ b/tests/unit/blueprints/addon-test.js @@ -4,38 +4,38 @@ const Blueprint = require('../../../lib/models/blueprint'); const MockProject = require('../../helpers/mock-project'); const expect = require('chai').expect; -describe('blueprint - addon', function() { - describe('Blueprint.lookup', function() { +describe('blueprint - addon', function () { + describe('Blueprint.lookup', function () { let blueprint; - beforeEach(function() { + beforeEach(function () { blueprint = Blueprint.lookup('addon'); }); - describe('entityName', function() { + describe('entityName', function () { let mockProject; - beforeEach(function() { + beforeEach(function () { mockProject = new MockProject(); - mockProject.isEmberCLIProject = function() { + mockProject.isEmberCLIProject = function () { return true; }; blueprint.project = mockProject; }); - afterEach(function() { + afterEach(function () { mockProject = null; }); - it('throws error when current project is an existing ember-cli project', function() { + it('throws error when current project is an existing ember-cli project', function () { expect(() => blueprint.normalizeEntityName('foo')).to.throw( 'Generating an addon in an existing ember-cli project is not supported.' ); }); - it('works when current project is an existing ember-cli addon', function() { - mockProject.isEmberCLIAddon = function() { + it('works when current project is an existing ember-cli addon', function () { + mockProject.isEmberCLIAddon = function () { return true; }; @@ -44,15 +44,15 @@ describe('blueprint - addon', function() { ); }); - it('keeps existing behavior by calling Blueprint.normalizeEntityName', function() { + it('keeps existing behavior by calling Blueprint.normalizeEntityName', function () { expect(() => blueprint.normalizeEntityName('foo/')).to.throw(/trailing slash/); }); }); }); - describe('direct blueprint require', function() { + describe('direct blueprint require', function () { let blueprint; - beforeEach(function() { + beforeEach(function () { blueprint = require('../../../blueprints/addon'); blueprint.options = { entity: { name: 'my-cool-addon' }, @@ -63,8 +63,8 @@ describe('blueprint - addon', function() { blueprint.path = 'test-blueprint-path'; }); - describe('generatePackageJson', function() { - it('works', function() { + describe('generatePackageJson', function () { + it('works', function () { let output = blueprint.updatePackageJson(JSON.stringify({})); // string to test ordering expect(output).to.equal( @@ -91,25 +91,25 @@ describe('blueprint - addon', function() { ); }); - it('removes the `private` property', function() { + it('removes the `private` property', function () { let output = blueprint.updatePackageJson(JSON.stringify({})); expect(JSON.parse(output).private).to.be.undefined; }); - it('overwrites `name`', function() { + it('overwrites `name`', function () { let output = blueprint.updatePackageJson(JSON.stringify({ name: 'OMG' })); expect(JSON.parse(output).name).to.eql('my-cool-addon'); }); - it('overwrites `description`', function() { + it('overwrites `description`', function () { let output = blueprint.updatePackageJson(JSON.stringify({ description: 'OMG' })); let json = JSON.parse(output); expect(json.description).to.equal('The default blueprint for ember-cli addons.'); }); - it('moves `ember-cli-babel` from devDependencies to dependencies', function() { + it('moves `ember-cli-babel` from devDependencies to dependencies', function () { let output = blueprint.updatePackageJson( JSON.stringify({ devDependencies: { @@ -125,7 +125,7 @@ describe('blueprint - addon', function() { expect(json.devDependencies).to.not.have.property('ember-cli-babel'); }); - it('moves `ember-cli-htmlbars` from devDependencies to dependencies', function() { + it('moves `ember-cli-htmlbars` from devDependencies to dependencies', function () { let output = blueprint.updatePackageJson( JSON.stringify({ devDependencies: { @@ -141,7 +141,7 @@ describe('blueprint - addon', function() { expect(json.devDependencies).to.not.have.property('ember-cli-htmlbars'); }); - it('does not push multiple `ember-addon` keywords', function() { + it('does not push multiple `ember-addon` keywords', function () { let output = blueprint.updatePackageJson( JSON.stringify({ keywords: ['ember-addon'], @@ -151,7 +151,7 @@ describe('blueprint - addon', function() { expect(json.keywords).to.deep.equal(['ember-addon']); }); - it('overwrites any version of `ember-disable-prototype-extensions`', function() { + it('overwrites any version of `ember-disable-prototype-extensions`', function () { let output = blueprint.updatePackageJson( JSON.stringify({ devDependencies: { @@ -164,7 +164,7 @@ describe('blueprint - addon', function() { expect(json.devDependencies['ember-disable-prototype-extensions']).to.equal('^1.1.3'); }); - it('adds `scripts.test:all`', function() { + it('adds `scripts.test:all`', function () { let output = blueprint.updatePackageJson( JSON.stringify({ scripts: {}, @@ -175,7 +175,7 @@ describe('blueprint - addon', function() { expect(json.scripts['test:ember-compatibility']).to.equal('ember try:each'); }); - it('overwrites `ember-addon.configPath`', function() { + it('overwrites `ember-addon.configPath`', function () { let output = blueprint.updatePackageJson( JSON.stringify({ 'ember-addon': { @@ -188,7 +188,7 @@ describe('blueprint - addon', function() { expect(json['ember-addon'].configPath).to.equal('tests/dummy/config'); }); - it('preserves dependency ordering', function() { + it('preserves dependency ordering', function () { let output = blueprint.updatePackageJson( JSON.stringify({ dependencies: { diff --git a/tests/unit/blueprints/in-repo-addon-test.js b/tests/unit/blueprints/in-repo-addon-test.js index 291928b1c5..a378d44e05 100644 --- a/tests/unit/blueprints/in-repo-addon-test.js +++ b/tests/unit/blueprints/in-repo-addon-test.js @@ -12,22 +12,22 @@ const td = require('testdouble'); const expect = require('ember-cli-blueprint-test-helpers/chai').expect; const file = require('ember-cli-blueprint-test-helpers/chai').file; -describe('Acceptance: ember generate and destroy in-repo-addon', function() { +describe('Acceptance: ember generate and destroy in-repo-addon', function () { setupTestHooks(this, { cliPath: path.resolve(`${__dirname}/../../..`), }); - it('in-repo-addon fooBar', function() { + it('in-repo-addon fooBar', function () { let args = ['in-repo-addon', 'fooBar']; return emberNew() - .then(function() { + .then(function () { expect(fs.readJsonSync('package.json')['ember-addon']).to.be.undefined; }) - .then(function() { + .then(function () { return emberGenerate(args); }) - .then(function() { + .then(function () { expect(file('lib/foo-bar/package.json')).to.exist; expect(file('lib/foo-bar/index.js')).to.exist; @@ -40,10 +40,10 @@ describe('Acceptance: ember generate and destroy in-repo-addon', function() { paths: ['lib/foo-bar'], }); }) - .then(function() { + .then(function () { return emberDestroy(args); }) - .then(function() { + .then(function () { expect(file('lib/foo-bar/package.json')).to.not.exist; expect(file('lib/foo-bar/index.js')).to.not.exist; @@ -52,13 +52,13 @@ describe('Acceptance: ember generate and destroy in-repo-addon', function() { }); }); -describe('Unit: in-repo-addon blueprint', function() { +describe('Unit: in-repo-addon blueprint', function () { let blueprint; let readJsonSync; let writeFileSync; let options; - beforeEach(function() { + beforeEach(function () { blueprint = require('../../../blueprints/in-repo-addon'); blueprint.project = { root: 'test-project-root', @@ -74,11 +74,11 @@ describe('Unit: in-repo-addon blueprint', function() { writeFileSync = td.replace(blueprint, '_writeFileSync'); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('adds to paths', function() { + it('adds to paths', function () { td.when(readJsonSync(), { ignoreExtraArgs: true }).thenReturn({}); blueprint.afterInstall(options); @@ -100,7 +100,7 @@ describe('Unit: in-repo-addon blueprint', function() { ); }); - it('ignores if already exists', function() { + it('ignores if already exists', function () { td.when(readJsonSync(), { ignoreExtraArgs: true }).thenReturn({ 'ember-addon': { paths: ['lib/test-entity-name'], @@ -126,7 +126,7 @@ describe('Unit: in-repo-addon blueprint', function() { ); }); - it('removes from paths', function() { + it('removes from paths', function () { td.when(readJsonSync(), { ignoreExtraArgs: true }).thenReturn({ 'ember-addon': { paths: ['lib/test-entity-name', 'lib/test-entity-name-2'], @@ -152,7 +152,7 @@ describe('Unit: in-repo-addon blueprint', function() { ); }); - it('removes paths if last one', function() { + it('removes paths if last one', function () { td.when(readJsonSync(), { ignoreExtraArgs: true }).thenReturn({ 'ember-addon': { paths: ['lib/test-entity-name'], @@ -172,7 +172,7 @@ describe('Unit: in-repo-addon blueprint', function() { }\n'); }); - it('alphabetizes paths', function() { + it('alphabetizes paths', function () { td.when(readJsonSync(), { ignoreExtraArgs: true }).thenReturn({ 'ember-addon': { paths: ['lib/test-entity-name-2'], diff --git a/tests/unit/blueprints/lib-test.js b/tests/unit/blueprints/lib-test.js index 9411a6868b..e975d44fbc 100644 --- a/tests/unit/blueprints/lib-test.js +++ b/tests/unit/blueprints/lib-test.js @@ -10,28 +10,28 @@ let modifyPackages = blueprintHelpers.modifyPackages; const expect = require('ember-cli-blueprint-test-helpers/chai').expect; const dir = require('chai-files').dir; -describe('Acceptance: ember generate and destroy lib', function() { +describe('Acceptance: ember generate and destroy lib', function () { setupTestHooks(this, { cliPath: path.resolve(`${__dirname}/../../..`), }); - it('lib foo', async function() { + it('lib foo', async function () { let args = ['lib', 'foo']; await emberNew(); - await emberGenerateDestroy(args, file => { + await emberGenerateDestroy(args, (file) => { expect(dir('lib')).to.exist; expect(file('lib/.eslintrc.js')).to.not.exist; expect(file('lib/.jshintrc')).to.not.exist; }); }); - it('lib foo with ember-cli-jshint', async function() { + it('lib foo with ember-cli-jshint', async function () { let args = ['lib', 'foo']; await emberNew(); await modifyPackages([{ name: 'ember-cli-jshint', dev: true }]); - await emberGenerateDestroy(args, file => { + await emberGenerateDestroy(args, (file) => { expect(dir('lib')).to.exist; expect(file('lib/.jshintrc')).to.not.exist; }); diff --git a/tests/unit/blueprints/server-test.js b/tests/unit/blueprints/server-test.js index 11da650997..89aeabc549 100644 --- a/tests/unit/blueprints/server-test.js +++ b/tests/unit/blueprints/server-test.js @@ -11,12 +11,12 @@ const chai = require('ember-cli-blueprint-test-helpers/chai'); let expect = chai.expect; let file = chai.file; -describe('Acceptance: ember generate and destroy server', function() { +describe('Acceptance: ember generate and destroy server', function () { setupTestHooks(this, { cliPath: path.resolve(`${__dirname}/../../..`), }); - it('server', async function() { + it('server', async function () { let args = ['server']; await emberNew(); @@ -26,7 +26,7 @@ describe('Acceptance: ember generate and destroy server', function() { // TODO: assert that `morgan` and `glob` dependencies were installed }); - it('server with ember-cli-jshint', async function() { + it('server with ember-cli-jshint', async function () { let args = ['server']; await emberNew(); diff --git a/tests/unit/broccoli/addon/linting-test.js b/tests/unit/broccoli/addon/linting-test.js index 9ab050af68..e999de66e0 100644 --- a/tests/unit/broccoli/addon/linting-test.js +++ b/tests/unit/broccoli/addon/linting-test.js @@ -10,10 +10,10 @@ const Addon = require('../../../../lib/models/addon'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Addon - linting', function() { +describe('Addon - linting', function () { let input, output, addon, lintTrees; - beforeEach(async function() { + beforeEach(async function () { input = await createTempDir(); let MockAddon = Addon.extend({ name: 'first', @@ -36,12 +36,12 @@ describe('Addon - linting', function() { addon = new MockAddon(project, project); }); - afterEach(async function() { + afterEach(async function () { await input.dispose(); await output.dispose(); }); - it('calls lintTree on project addons for app directory', async function() { + it('calls lintTree on project addons for app directory', async function () { input.write({ app: { 'derp.js': '// slerpy', @@ -60,7 +60,7 @@ describe('Addon - linting', function() { }); }); - it('calls lintTree on project addons for addon directory', async function() { + it('calls lintTree on project addons for addon directory', async function () { input.write({ addon: { 'derp.js': '// slerpy', @@ -89,7 +89,7 @@ describe('Addon - linting', function() { }); }); - it('calls lintTree on project addons for addon directory with only templates', async function() { + it('calls lintTree on project addons for addon directory with only templates', async function () { input.write({ addon: { templates: { @@ -118,7 +118,7 @@ describe('Addon - linting', function() { }); }); - it('calls lintTree on project addons for addon directory with templates', async function() { + it('calls lintTree on project addons for addon directory with templates', async function () { input.write({ addon: { 'derp.js': '// slerpy', @@ -152,7 +152,7 @@ describe('Addon - linting', function() { }); }); - it('calls lintTree on project addons for addon-test-support directory', async function() { + it('calls lintTree on project addons for addon-test-support directory', async function () { input.write({ 'addon-test-support': { 'derp.js': '// slerpy', @@ -171,7 +171,7 @@ describe('Addon - linting', function() { }); }); - it('calls lintTree on project addons for test-support directory', async function() { + it('calls lintTree on project addons for test-support directory', async function () { input.write({ 'test-support': { 'derp.js': '// slerpy', @@ -190,8 +190,8 @@ describe('Addon - linting', function() { }); }); - it('calls lintTree for trees in an addon', async function() { - addon.project.addons[0].lintTree = function(type, tree) { + it('calls lintTree for trees in an addon', async function () { + addon.project.addons[0].lintTree = function (type, tree) { return tree; }; let addonRootContents = { diff --git a/tests/unit/broccoli/addon/module-name-test.js b/tests/unit/broccoli/addon/module-name-test.js index 2cfb10799f..f265f74dae 100644 --- a/tests/unit/broccoli/addon/module-name-test.js +++ b/tests/unit/broccoli/addon/module-name-test.js @@ -11,10 +11,10 @@ const Addon = require('../../../../lib/models/addon'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Addon - moduleName', function() { +describe('Addon - moduleName', function () { let input, output, addon; - beforeEach(async function() { + beforeEach(async function () { input = await createTempDir(); let MockAddon = Addon.extend({ root: input.path(), @@ -40,12 +40,12 @@ describe('Addon - moduleName', function() { ]; }); - afterEach(async function() { + afterEach(async function () { await input.dispose(); await output.dispose(); }); - it('uses the module name function', async function() { + it('uses the module name function', async function () { input.write({ addon: { 'herp.js': '// slerpy', diff --git a/tests/unit/broccoli/builder-test.js b/tests/unit/broccoli/builder-test.js index e3cf8b39b5..ffaba584c4 100644 --- a/tests/unit/broccoli/builder-test.js +++ b/tests/unit/broccoli/builder-test.js @@ -9,17 +9,17 @@ const Builder = require('../../../lib/models/builder'); const { createTempDir, fromBuilder } = broccoliTestHelper; const ROOT = process.cwd(); -describe('Builder - broccoli tests', function() { +describe('Builder - broccoli tests', function () { let projectRoot, builderOutputPath, output, project, builder; - beforeEach(async function() { + beforeEach(async function () { projectRoot = await createTempDir(); builderOutputPath = await createTempDir(); project = new MockProject({ root: projectRoot.path() }); }); - afterEach(async function() { + afterEach(async function () { // this is needed because lib/utilities/find-build-file.js does a // `process.chdir` when it looks for the `ember-cli-build.js` process.chdir(ROOT); @@ -29,7 +29,7 @@ describe('Builder - broccoli tests', function() { await output.dispose(); }); - it('falls back to broccoli-builder@0.18 when legacy plugins exist in build', async function() { + it('falls back to broccoli-builder@0.18 when legacy plugins exist in build', async function () { projectRoot.write({ 'ember-cli-build.js': ` const fs = require('fs'); diff --git a/tests/unit/broccoli/default-packager/additional-assets-test.js b/tests/unit/broccoli/default-packager/additional-assets-test.js index 8f034bd447..1583d674e2 100644 --- a/tests/unit/broccoli/default-packager/additional-assets-test.js +++ b/tests/unit/broccoli/default-packager/additional-assets-test.js @@ -10,7 +10,7 @@ const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; const setupRegistryFor = defaultPackagerHelpers.setupRegistryFor; -describe('Default Packager: Additional Assets', function() { +describe('Default Packager: Additional Assets', function () { let input, output; let MODULES = { @@ -47,7 +47,7 @@ describe('Default Packager: Additional Assets', function() { return { a: 1 }; }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -58,21 +58,21 @@ describe('Default Packager: Additional Assets', function() { addons: [], }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(MODULES); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches packaged javascript tree', async function() { + it('caches packaged javascript tree', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -82,7 +82,7 @@ describe('Default Packager: Additional Assets', function() { vendorJsFile: '/assets/vendor.js', }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -116,7 +116,7 @@ describe('Default Packager: Additional Assets', function() { ); }); - it('imports additional assets properly', async function() { + it('imports additional assets properly', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -126,7 +126,7 @@ describe('Default Packager: Additional Assets', function() { vendorJsFile: '/assets/vendor.js', }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); diff --git a/tests/unit/broccoli/default-packager/bower-test.js b/tests/unit/broccoli/default-packager/bower-test.js index 07c3bca25c..b6ecaf7ea5 100644 --- a/tests/unit/broccoli/default-packager/bower-test.js +++ b/tests/unit/broccoli/default-packager/bower-test.js @@ -7,7 +7,7 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Default Packager: Bower', function() { +describe('Default Packager: Bower', function () { let input; let BOWER_PACKAGES = { @@ -28,17 +28,17 @@ describe('Default Packager: Bower', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(BOWER_PACKAGES); }); - after(async function() { + after(async function () { await input.dispose(); }); - it('caches packaged bower tree', async function() { + it('caches packaged bower tree', async function () { let defaultPackager = new DefaultPackager(); expect(defaultPackager._cachedBower).to.equal(null); @@ -49,7 +49,7 @@ describe('Default Packager: Bower', function() { expect(defaultPackager._cachedBower._annotation).to.equal('Packaged Bower'); }); - it('packages bower files with default folder', async function() { + it('packages bower files with default folder', async function () { let defaultPackager = new DefaultPackager(); let packagedBower = await buildOutput(defaultPackager.packageBower(input.path())); @@ -60,7 +60,7 @@ describe('Default Packager: Bower', function() { }); }); - it('packages bower files with custom folder', async function() { + it('packages bower files with custom folder', async function () { let defaultPackager = new DefaultPackager(); let packagedBower = await buildOutput(defaultPackager.packageBower(input.path(), 'foobar')); diff --git a/tests/unit/broccoli/default-packager/config-test.js b/tests/unit/broccoli/default-packager/config-test.js index b6e3493aa3..27f7c2d1d0 100644 --- a/tests/unit/broccoli/default-packager/config-test.js +++ b/tests/unit/broccoli/default-packager/config-test.js @@ -7,7 +7,7 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Default Packager: Config', function() { +describe('Default Packager: Config', function () { let input, output; let name = 'the-best-app-ever'; let env = 'development'; @@ -27,21 +27,21 @@ describe('Default Packager: Config', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(CONFIG); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches packaged config tree', async function() { + it('caches packaged config tree', async function () { let defaultPackager = new DefaultPackager({ name, project, @@ -56,7 +56,7 @@ describe('Default Packager: Config', function() { expect(defaultPackager._cachedConfig._annotation).to.equal('Packaged Config'); }); - it('packages config files w/ tests disabled', async function() { + it('packages config files w/ tests disabled', async function () { let defaultPackager = new DefaultPackager({ name, project, @@ -79,7 +79,7 @@ describe('Default Packager: Config', function() { }); }); - it('packages config files w/ tests enabled', async function() { + it('packages config files w/ tests enabled', async function () { let defaultPackager = new DefaultPackager({ name, project, diff --git a/tests/unit/broccoli/default-packager/ember-cli-internal-test.js b/tests/unit/broccoli/default-packager/ember-cli-internal-test.js index 22c317bf5d..2d201efb6f 100644 --- a/tests/unit/broccoli/default-packager/ember-cli-internal-test.js +++ b/tests/unit/broccoli/default-packager/ember-cli-internal-test.js @@ -7,7 +7,7 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Default Packager: Ember CLI Internal', function() { +describe('Default Packager: Ember CLI Internal', function () { let input, output; let CONFIG = { @@ -29,21 +29,21 @@ describe('Default Packager: Ember CLI Internal', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(CONFIG); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches packaged ember cli internal tree', async function() { + it('caches packaged ember cli internal tree', async function () { let defaultPackager = new DefaultPackager({ env: 'development', name: 'the-best-app-ever', @@ -61,7 +61,7 @@ describe('Default Packager: Ember CLI Internal', function() { expect(defaultPackager._cachedEmberCliInternalTree._annotation).to.equal('Packaged Ember CLI Internal Files'); }); - it('packages internal files properly', async function() { + it('packages internal files properly', async function () { let defaultPackager = new DefaultPackager({ env: 'development', name: 'the-best-app-ever', @@ -93,7 +93,7 @@ describe('Default Packager: Ember CLI Internal', function() { ]); }); - it('populates the contents of internal files correctly', async function() { + it('populates the contents of internal files correctly', async function () { let defaultPackager = new DefaultPackager({ env: 'development', name: 'the-best-app-ever', @@ -144,7 +144,7 @@ describe('Default Packager: Ember CLI Internal', function() { expect(vendorSuffixFileContent).to.equal(''); }); - it('populates the contents of internal files correctly when `storeConfigInMeta` is enabled', async function() { + it('populates the contents of internal files correctly when `storeConfigInMeta` is enabled', async function () { let defaultPackager = new DefaultPackager({ env: 'development', name: 'the-best-app-ever', @@ -167,7 +167,7 @@ describe('Default Packager: Ember CLI Internal', function() { expect(appConfigFileContent).to.contain(`var config = JSON.parse(decodeURIComponent(rawConfig));`); }); - it('populates the contents of internal files correctly, including content from add-ons', async function() { + it('populates the contents of internal files correctly, including content from add-ons', async function () { let defaultPackager = new DefaultPackager({ env: 'development', name: 'the-best-app-ever', diff --git a/tests/unit/broccoli/default-packager/external-test.js b/tests/unit/broccoli/default-packager/external-test.js index 736d9c4cfb..c78c938982 100644 --- a/tests/unit/broccoli/default-packager/external-test.js +++ b/tests/unit/broccoli/default-packager/external-test.js @@ -7,7 +7,7 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Default Packager: External', function() { +describe('Default Packager: External', function () { let input, output; let EXTERNAL = { @@ -20,21 +20,21 @@ describe('Default Packager: External', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(EXTERNAL); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('applies transforms to an external tree', async function() { + it('applies transforms to an external tree', async function () { let customTransformsMap = new Map(); customTransformsMap.set('amd', { diff --git a/tests/unit/broccoli/default-packager/index-test.js b/tests/unit/broccoli/default-packager/index-test.js index af04f1c955..d1e08a20af 100644 --- a/tests/unit/broccoli/default-packager/index-test.js +++ b/tests/unit/broccoli/default-packager/index-test.js @@ -7,7 +7,7 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Default Packager: Index', function() { +describe('Default Packager: Index', function () { let input, output; let project = { @@ -28,7 +28,7 @@ describe('Default Packager: Index', function() { let META_TAG = '/best-url-ever/\n'; - before(async function() { + before(async function () { input = await createTempDir(); let indexContent = ` @@ -51,15 +51,15 @@ describe('Default Packager: Index', function() { }); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches processed index tree', async function() { + it('caches processed index tree', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -82,7 +82,7 @@ describe('Default Packager: Index', function() { expect(defaultPackager._cachedProcessedIndex).to.not.equal(null); }); - it('works with a custom path', async function() { + it('works with a custom path', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -108,7 +108,7 @@ describe('Default Packager: Index', function() { expect(indexContent).to.equal(META_TAG); }); - it('populates `index.html` according to settings', async function() { + it('populates `index.html` according to settings', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', diff --git a/tests/unit/broccoli/default-packager/javascript-test.js b/tests/unit/broccoli/default-packager/javascript-test.js index 0f9b26c2ed..dac2cc0a8b 100644 --- a/tests/unit/broccoli/default-packager/javascript-test.js +++ b/tests/unit/broccoli/default-packager/javascript-test.js @@ -10,7 +10,7 @@ const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; const setupRegistryFor = defaultPackagerHelpers.setupRegistryFor; -describe('Default Packager: Javascript', function() { +describe('Default Packager: Javascript', function () { let input, output; let scriptOutputFiles = { @@ -91,7 +91,7 @@ describe('Default Packager: Javascript', function() { return { a: 1 }; }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -102,21 +102,21 @@ describe('Default Packager: Javascript', function() { addons: [], }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(MODULES); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches packaged javascript tree', async function() { + it('caches packaged javascript tree', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -126,7 +126,7 @@ describe('Default Packager: Javascript', function() { vendorJsFile: '/assets/vendor.js', }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -148,7 +148,7 @@ describe('Default Packager: Javascript', function() { expect(defaultPackager._cachedJavascript._annotation).to.equal('Packaged Javascript'); }); - it('packages javascript files with sourcemaps on', async function() { + it('packages javascript files with sourcemaps on', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -158,7 +158,7 @@ describe('Default Packager: Javascript', function() { vendorJsFile: '/assets/vendor.js', }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -184,7 +184,7 @@ describe('Default Packager: Javascript', function() { ]); }); - it('packages javascript files with sourcemaps off', async function() { + it('packages javascript files with sourcemaps off', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -194,7 +194,7 @@ describe('Default Packager: Javascript', function() { vendorJsFile: '/assets/vendor.js', }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -219,11 +219,11 @@ describe('Default Packager: Javascript', function() { expect(Object.keys(outputFiles.assets)).to.deep.equal(['the-best-app-ever.js', 'vendor.js']); }); - it('processes javascript according to the registry', async function() { + it('processes javascript according to the registry', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', - registry: setupRegistryFor('js', function(tree) { + registry: setupRegistryFor('js', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/js/g, 'jsx'); @@ -255,14 +255,14 @@ describe('Default Packager: Javascript', function() { }); }); - it('runs pre/post-process add-on hooks', async function() { + it('runs pre/post-process add-on hooks', async function () { let addonPreprocessTreeHookCalled = false; let addonPostprocessTreeHookCalled = false; let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', - registry: setupRegistryFor('js', tree => tree), + registry: setupRegistryFor('js', (tree) => tree), // avoid using `testdouble.js` here on purpose; it does not have a "proxy" // option, where a function call would be registered and the original diff --git a/tests/unit/broccoli/default-packager/process-test.js b/tests/unit/broccoli/default-packager/process-test.js index 76cb7ac5d7..d9a6ae7391 100644 --- a/tests/unit/broccoli/default-packager/process-test.js +++ b/tests/unit/broccoli/default-packager/process-test.js @@ -10,7 +10,7 @@ const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; const setupRegistryFor = defaultPackagerHelpers.setupRegistryFor; -describe('Default Packager: Process Javascript', function() { +describe('Default Packager: Process Javascript', function () { let input, output; let scriptOutputFiles = { @@ -51,7 +51,7 @@ describe('Default Packager: Process Javascript', function() { return { a: 1 }; }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -71,23 +71,23 @@ describe('Default Packager: Process Javascript', function() { ], }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(MODULES); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { if (output) { await output.dispose(); } }); - it('caches packaged application tree', async function() { + it('caches packaged application tree', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -97,7 +97,7 @@ describe('Default Packager: Process Javascript', function() { vendorJsFile: '/assets/vendor.js', }, - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); diff --git a/tests/unit/broccoli/default-packager/public-test.js b/tests/unit/broccoli/default-packager/public-test.js index d7f716afee..b205eb341e 100644 --- a/tests/unit/broccoli/default-packager/public-test.js +++ b/tests/unit/broccoli/default-packager/public-test.js @@ -7,7 +7,7 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Default Packager: Public', function() { +describe('Default Packager: Public', function () { let input, output; let PUBLIC = { @@ -21,21 +21,21 @@ describe('Default Packager: Public', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(PUBLIC); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches packaged public tree', async function() { + it('caches packaged public tree', async function () { let defaultPackager = new DefaultPackager(); expect(defaultPackager._cachedPublic).to.equal(null); @@ -45,7 +45,7 @@ describe('Default Packager: Public', function() { expect(defaultPackager._cachedPublic).to.not.equal(null); }); - it('packages public files', async function() { + it('packages public files', async function () { let defaultPackager = new DefaultPackager(); output = await buildOutput(defaultPackager.packagePublic(input.path())); diff --git a/tests/unit/broccoli/default-packager/styles-test.js b/tests/unit/broccoli/default-packager/styles-test.js index f5f670a5f9..ccda790ff3 100644 --- a/tests/unit/broccoli/default-packager/styles-test.js +++ b/tests/unit/broccoli/default-packager/styles-test.js @@ -10,7 +10,7 @@ const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; const setupRegistryFor = defaultPackagerHelpers.setupRegistryFor; -describe('Default Packager: Styles', function() { +describe('Default Packager: Styles', function () { let input, output; let styleOutputFiles = { @@ -61,23 +61,23 @@ describe('Default Packager: Styles', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(MODULES); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { if (output) { await output.dispose(); } }); - it('caches packaged styles tree', async function() { + it('caches packaged styles tree', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -87,7 +87,7 @@ describe('Default Packager: Styles', function() { vendorCssFile: '/assets/vendor.css', }, - registry: setupRegistryFor('css', function(tree) { + registry: setupRegistryFor('css', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/scss$/g, 'css'); @@ -113,7 +113,7 @@ describe('Default Packager: Styles', function() { expect(defaultPackager._cachedProcessedStyles._annotation).to.equal('Packaged Styles'); }); - it('does not minify css files when minification is disabled', async function() { + it('does not minify css files when minification is disabled', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -151,7 +151,7 @@ describe('Default Packager: Styles', function() { expect(outputFiles.assets['the-best-app-ever.css'].trim()).to.equal('@import "extra.css";\nhtml { height: 100%; }'); }); - it('minifies css files when minification is enabled', async function() { + it('minifies css files when minification is enabled', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -189,7 +189,7 @@ describe('Default Packager: Styles', function() { expect(outputFiles.assets['the-best-app-ever.css'].trim()).to.match(/^@import \S+$/, 'css file is minified'); }); - it('processes css according to the registry', async function() { + it('processes css according to the registry', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -199,7 +199,7 @@ describe('Default Packager: Styles', function() { vendorCssFile: '/assets/vendor.css', }, - registry: setupRegistryFor('css', function(tree, inputPath, outputPath, options) { + registry: setupRegistryFor('css', function (tree, inputPath, outputPath, options) { return new Funnel(tree, { getDestinationPath(relativePath) { if (relativePath.includes('app.css')) { @@ -233,7 +233,7 @@ describe('Default Packager: Styles', function() { expect(Object.keys(outputFiles.assets)).to.deep.equal(['the-best-app-ever.zss', 'vendor.css']); }); - it('inlines css imports', async function() { + it('inlines css imports', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', env: 'development', @@ -270,7 +270,7 @@ describe('Default Packager: Styles', function() { expect(outputFiles.assets['the-best-app-ever.css'].trim()).to.equal('body{position:relative}html{height:100%}'); }); - it('runs pre/post-process add-on hooks', async function() { + it('runs pre/post-process add-on hooks', async function () { let addonPreprocessTreeHookCalled = false; let addonPostprocessTreeHookCalled = false; @@ -326,7 +326,7 @@ describe('Default Packager: Styles', function() { expect(addonPostprocessTreeHookCalled).to.equal(true); }); - it('prevents duplicate inclusion, maintains order: CSS', async function() { + it('prevents duplicate inclusion, maintains order: CSS', async function () { let importFilesMap = { '/assets/vendor.css': [ 'bower_components/1.css', diff --git a/tests/unit/broccoli/default-packager/templates-test.js b/tests/unit/broccoli/default-packager/templates-test.js index 16b3e080a6..6e16f29ecd 100644 --- a/tests/unit/broccoli/default-packager/templates-test.js +++ b/tests/unit/broccoli/default-packager/templates-test.js @@ -10,7 +10,7 @@ const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; const setupRegistryFor = defaultPackagerHelpers.setupRegistryFor; -describe('Default Packager: Templates', function() { +describe('Default Packager: Templates', function () { let input, output; let TEMPLATES = { @@ -24,29 +24,29 @@ describe('Default Packager: Templates', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(TEMPLATES); }); - after(async function() { + after(async function () { if (input) { await input.dispose(); } }); - afterEach(async function() { + afterEach(async function () { if (output) { await output.dispose(); } }); - it('caches processed templates tree', async function() { + it('caches processed templates tree', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -64,11 +64,11 @@ describe('Default Packager: Templates', function() { expect(defaultPackager._cachedProcessedTemplates).to.not.equal(null); }); - it('processes templates according to the registry', async function() { + it('processes templates according to the registry', async function () { let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); @@ -95,14 +95,14 @@ describe('Default Packager: Templates', function() { }); }); - it('runs pre/post-process add-on hooks', async function() { + it('runs pre/post-process add-on hooks', async function () { let addonPreprocessTreeHookCalled = false; let addonPostprocessTreeHookCalled = false; let defaultPackager = new DefaultPackager({ name: 'the-best-app-ever', - registry: setupRegistryFor('template', function(tree) { + registry: setupRegistryFor('template', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/hbs$/g, 'js'); diff --git a/tests/unit/broccoli/default-packager/tests-test.js b/tests/unit/broccoli/default-packager/tests-test.js index df6ee5a4de..e2265f36a7 100644 --- a/tests/unit/broccoli/default-packager/tests-test.js +++ b/tests/unit/broccoli/default-packager/tests-test.js @@ -11,7 +11,7 @@ const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; const setupRegistryFor = defaultPackagerHelpers.setupRegistryFor; -describe('Default Packager: Tests', function() { +describe('Default Packager: Tests', function () { let input, output; let name = 'the-best-app-ever'; let env = 'development'; @@ -108,27 +108,27 @@ describe('Default Packager: Tests', function() { // files as the input tree, but the contents will be // different lintTree(type, tree) { - return stew.map(tree, string => string.toUpperCase()); + return stew.map(tree, (string) => string.toUpperCase()); }, }, ], }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(TESTS); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches packaged tests tree', async function() { + it('caches packaged tests tree', async function () { let defaultPackager = new DefaultPackager({ project, name, @@ -149,7 +149,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: [], legacyTestFilesToAppend: [], - registry: setupRegistryFor('js', tree => tree), + registry: setupRegistryFor('js', (tree) => tree), }); expect(defaultPackager._cachedTests).to.equal(null); @@ -159,7 +159,7 @@ describe('Default Packager: Tests', function() { expect(defaultPackager._cachedTests).to.not.equal(null); }); - it('packages test files (with sourcemaps)', async function() { + it('packages test files (with sourcemaps)', async function () { let defaultPackager = new DefaultPackager({ project, name, @@ -180,7 +180,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: [], legacyTestFilesToAppend: [], - registry: setupRegistryFor('js', tree => tree), + registry: setupRegistryFor('js', (tree) => tree), }); output = await buildOutput(defaultPackager.packageTests(input.path())); @@ -206,7 +206,7 @@ describe('Default Packager: Tests', function() { expect(outputFiles.assets['tests.js']).to.include('EmberENV.TESTS_FILE_LOADED = true;'); }); - it('packages test files (without sourcemaps)', async function() { + it('packages test files (without sourcemaps)', async function () { let defaultPackager = new DefaultPackager({ project, name, @@ -228,7 +228,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: [], legacyTestFilesToAppend: [], - registry: setupRegistryFor('js', tree => tree), + registry: setupRegistryFor('js', (tree) => tree), }); output = await buildOutput(defaultPackager.packageTests(input.path())); @@ -249,7 +249,7 @@ describe('Default Packager: Tests', function() { expect(outputFiles.assets['tests.js']).to.include('EmberENV.TESTS_FILE_LOADED = true;'); }); - it('does not process `addon-test-support` folder', async function() { + it('does not process `addon-test-support` folder', async function () { let defaultPackager = new DefaultPackager({ project, name, @@ -270,7 +270,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: [], legacyTestFilesToAppend: [], - registry: setupRegistryFor('js', function(tree) { + registry: setupRegistryFor('js', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/js/g, 'js-test'); @@ -324,7 +324,7 @@ describe('Default Packager: Tests', function() { }); }); - it('processes tests files according to the registry', async function() { + it('processes tests files according to the registry', async function () { let defaultPackager = new DefaultPackager({ project, name, @@ -345,7 +345,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: [], legacyTestFilesToAppend: [], - registry: setupRegistryFor('js', function(tree) { + registry: setupRegistryFor('js', function (tree) { return new Funnel(tree, { getDestinationPath(relativePath) { return relativePath.replace(/js/g, 'js-test'); @@ -399,7 +399,7 @@ describe('Default Packager: Tests', function() { }); }); - it('emits dist/assets/tests.js by default', async function() { + it('emits dist/assets/tests.js by default', async function () { let emptyInput = await createTempDir(); let emptyTestFolder = { 'addon-tree-output': {}, @@ -471,7 +471,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: [], legacyTestFilesToAppend: [], - registry: setupRegistryFor('js', tree => tree), + registry: setupRegistryFor('js', (tree) => tree), }); output = await buildOutput(defaultPackager.packageTests(input.path())); @@ -492,7 +492,7 @@ describe('Default Packager: Tests', function() { emptyInput.dispose(); }); - it('lintTree results do not "win" over app tests', async function() { + it('lintTree results do not "win" over app tests', async function () { let defaultPackager = new DefaultPackager({ project, name, @@ -513,7 +513,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: [], legacyTestFilesToAppend: [], - registry: setupRegistryFor('js', tree => tree), + registry: setupRegistryFor('js', (tree) => tree), }); output = await buildOutput(defaultPackager.packageTests(input.path())); @@ -525,7 +525,7 @@ describe('Default Packager: Tests', function() { expect(outputFiles.assets['tests.js']).to.include('// login-test.js'); }); - it('maintains the concatenation order', async function() { + it('maintains the concatenation order', async function () { let defaultPackager = new DefaultPackager({ project, name, @@ -546,7 +546,7 @@ describe('Default Packager: Tests', function() { vendorTestStaticStyles: ['vendor/custom/a.css', 'vendor/custom/b.css'], legacyTestFilesToAppend: ['vendor/custom/a.js', 'vendor/custom/b.js'], - registry: setupRegistryFor('js', tree => tree), + registry: setupRegistryFor('js', (tree) => tree), }); output = await buildOutput(defaultPackager.packageTests(input.path())); diff --git a/tests/unit/broccoli/default-packager/vendor-test.js b/tests/unit/broccoli/default-packager/vendor-test.js index a75f48db5e..21e10cb5c6 100644 --- a/tests/unit/broccoli/default-packager/vendor-test.js +++ b/tests/unit/broccoli/default-packager/vendor-test.js @@ -7,7 +7,7 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('Default Packager: Vendor', function() { +describe('Default Packager: Vendor', function () { let input, output; let VENDOR_PACKAGES = { @@ -42,21 +42,21 @@ describe('Default Packager: Vendor', function() { }, }; - before(async function() { + before(async function () { input = await createTempDir(); input.write(VENDOR_PACKAGES); }); - after(async function() { + after(async function () { await input.dispose(); }); - afterEach(async function() { + afterEach(async function () { await output.dispose(); }); - it('caches packaged vendor tree', async function() { + it('caches packaged vendor tree', async function () { let defaultPackager = new DefaultPackager(); expect(defaultPackager._cachedVendor).to.equal(null); @@ -67,7 +67,7 @@ describe('Default Packager: Vendor', function() { expect(defaultPackager._cachedVendor._annotation).to.equal('Packaged Vendor'); }); - it('packages vendor files', async function() { + it('packages vendor files', async function () { let defaultPackager = new DefaultPackager(); output = await buildOutput(defaultPackager.packageVendor(input.path())); diff --git a/tests/unit/broccoli/ember-addon-test.js b/tests/unit/broccoli/ember-addon-test.js index 89c5da2ebd..87d55cd833 100644 --- a/tests/unit/broccoli/ember-addon-test.js +++ b/tests/unit/broccoli/ember-addon-test.js @@ -7,7 +7,7 @@ const EmberApp = require('../../../lib/broccoli/ember-app'); const expect = require('chai').expect; const MockCLI = require('../../helpers/mock-cli'); -describe('EmberAddon', function() { +describe('EmberAddon', function () { let project, emberAddon, projectPath; function setupProject(rootPath) { @@ -15,22 +15,22 @@ describe('EmberAddon', function() { let cli = new MockCLI(); project = new Project(rootPath, packageContents, cli.ui, cli); - project.require = function() { - return function() {}; + project.require = function () { + return function () {}; }; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = []; }; return project; } - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/simple'); project = setupProject(projectPath); }); - it('should merge options with defaults to depth', function() { + it('should merge options with defaults to depth', function () { emberAddon = new EmberAddon( { project, @@ -67,11 +67,11 @@ describe('EmberAddon', function() { }); }); - it('should contain env', function() { + it('should contain env', function () { expect(EmberAddon.env).to.be.a('function'); }); - it('should contain return the correct environment', function() { + it('should contain return the correct environment', function () { expect(EmberAddon.env()).to.eql(EmberApp.env()); }); }); diff --git a/tests/unit/broccoli/ember-app-test.js b/tests/unit/broccoli/ember-app-test.js index cdc380401d..9b1a4933a1 100644 --- a/tests/unit/broccoli/ember-app-test.js +++ b/tests/unit/broccoli/ember-app-test.js @@ -20,11 +20,11 @@ const Addon = require('../../../lib/models/addon'); function mockTemplateRegistry(app) { let oldLoad = app.registry.load; - app.registry.load = function(type) { + app.registry.load = function (type) { if (type === 'template') { return [ { - toTree: tree => tree, + toTree: (tree) => tree, }, ]; } @@ -32,7 +32,7 @@ function mockTemplateRegistry(app) { }; } -describe('EmberApp', function() { +describe('EmberApp', function () { let project, projectPath, app, addon; function setupProject(rootPath) { @@ -40,26 +40,26 @@ describe('EmberApp', function() { let cli = new MockCLI(); project = new Project(rootPath, packageContents, cli.ui, cli); - project.require = function() { - return function() {}; + project.require = function () { + return function () {}; }; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = []; }; return project; } - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/simple'); project = setupProject(projectPath); }); if (isExperimentEnabled('PACKAGER')) { - describe('packager hook', function() { + describe('packager hook', function () { let js, input, output; - before(async function() { + before(async function () { js = await createTempDir(); js.write({ fake: { @@ -68,22 +68,22 @@ describe('EmberApp', function() { }); }); - beforeEach(async function() { + beforeEach(async function () { input = await createTempDir(); }); - afterEach(async function() { + afterEach(async function () { await input.dispose(); if (output) { await output.dispose(); } }); - after(async function() { + after(async function () { await js.dispose(); }); - it('sets `_isPackageHookSupplied` to `false` if `package` hook is not a function', function() { + it('sets `_isPackageHookSupplied` to `false` if `package` hook is not a function', function () { let app = new EmberApp({ project, package: false, @@ -92,7 +92,7 @@ describe('EmberApp', function() { expect(app._isPackageHookSupplied).to.equal(false); }); - it('sets `_isPackageHookSupplied` to `false` if `package` hook is not supplied', function() { + it('sets `_isPackageHookSupplied` to `false` if `package` hook is not supplied', function () { let app = new EmberApp({ project, }); @@ -100,7 +100,7 @@ describe('EmberApp', function() { expect(app._isPackageHookSupplied).to.equal(false); }); - it('sets `_isPackageHookSupplied` to `true` if `package` hook is supplied', function() { + it('sets `_isPackageHookSupplied` to `true` if `package` hook is supplied', function () { let app = new EmberApp({ project, package: () => input.path(), @@ -109,7 +109,7 @@ describe('EmberApp', function() { expect(app._isPackageHookSupplied).to.equal(true); }); - it('overrides the output of the build', async function() { + it('overrides the output of the build', async function () { input.write({ fake: { dist: { @@ -137,7 +137,7 @@ describe('EmberApp', function() { }); }); - it('receives a full tree as an argument', async function() { + it('receives a full tree as an argument', async function () { let appStyles = await createTempDir(); appStyles.write({ 'app.css': '// css styles', @@ -152,7 +152,7 @@ describe('EmberApp', function() { let app = new EmberApp({ project, - package: tree => mergeTrees([tree, input.path()]), + package: (tree) => mergeTrees([tree, input.path()]), trees: { styles: appStyles.path(), }, @@ -193,7 +193,7 @@ describe('EmberApp', function() { }); }); - it('prints a warning if `package` is not a function and falls back to default packaging', async function() { + it('prints a warning if `package` is not a function and falls back to default packaging', async function () { let app = new EmberApp({ project, package: {}, @@ -227,10 +227,10 @@ describe('EmberApp', function() { ); }); - it('receives transpiled ES current app tree', async function() { + it('receives transpiled ES current app tree', async function () { let app = new EmberApp({ project, - package: tree => tree, + package: (tree) => tree, }); mockTemplateRegistry(app); @@ -262,8 +262,8 @@ describe('EmberApp', function() { }); } - describe('getStyles()', function() { - it('can handle empty styles folders', async function() { + describe('getStyles()', function () { + it('can handle empty styles folders', async function () { let appStyles = await createTempDir(); appStyles.write({ 'app.css': '// css styles', @@ -292,7 +292,7 @@ describe('EmberApp', function() { await output.dispose(); }); - it('can handle empty addon styles folders', async function() { + it('can handle empty addon styles folders', async function () { let appOptions = { project }; let app = new EmberApp(appOptions); @@ -313,7 +313,7 @@ describe('EmberApp', function() { await output.dispose(); }); - it('add `app/styles` folder from add-ons', async function() { + it('add `app/styles` folder from add-ons', async function () { let addonFooStyles = await createTempDir(); addonFooStyles.write({ @@ -354,7 +354,7 @@ describe('EmberApp', function() { await output.dispose(); }); - it('returns add-ons styles files', async function() { + it('returns add-ons styles files', async function () { let addonFooStyles = await createTempDir(); let addonBarStyles = await createTempDir(); @@ -376,7 +376,7 @@ describe('EmberApp', function() { let app = new EmberApp({ project, }); - app.addonTreesFor = function() { + app.addonTreesFor = function () { return [addonFooStyles.path(), addonBarStyles.path()]; }; @@ -399,7 +399,7 @@ describe('EmberApp', function() { await output.dispose(); }); - it('does not fail if add-ons do not export styles', async function() { + it('does not fail if add-ons do not export styles', async function () { let app = new EmberApp({ project, }); @@ -414,8 +414,8 @@ describe('EmberApp', function() { }); }); - describe('getPublic()', function() { - it('returns public files for app and add-ons', async function() { + describe('getPublic()', function () { + it('returns public files for app and add-ons', async function () { let input = await createTempDir(); let addonFooPublic = await createTempDir(); let addonBarPublic = await createTempDir(); @@ -436,7 +436,7 @@ describe('EmberApp', function() { }); app.trees.public = input.path(); - app.addonTreesFor = function() { + app.addonTreesFor = function () { return [addonFooPublic.path(), addonBarPublic.path()]; }; @@ -458,7 +458,7 @@ describe('EmberApp', function() { await output.dispose(); }); - it('does not fail if app or add-ons have the same `public` folder structure', async function() { + it('does not fail if app or add-ons have the same `public` folder structure', async function () { let input = await createTempDir(); let addonFooPublic = await createTempDir(); let addonBarPublic = await createTempDir(); @@ -480,7 +480,7 @@ describe('EmberApp', function() { }); app.trees.public = input.path(); - app.addonTreesFor = function() { + app.addonTreesFor = function () { return [addonFooPublic.path(), addonBarPublic.path()]; }; @@ -503,8 +503,8 @@ describe('EmberApp', function() { }); }); - describe('getAddonTemplates()', function() { - it('returns add-ons template files', async function() { + describe('getAddonTemplates()', function () { + it('returns add-ons template files', async function () { let input = await createTempDir(); let addonFooTemplates = await createTempDir(); let addonBarTemplates = await createTempDir(); @@ -520,7 +520,7 @@ describe('EmberApp', function() { project, }); app.trees.templates = input.path(); - app.addonTreesFor = function() { + app.addonTreesFor = function () { return [addonFooTemplates.path(), addonBarTemplates.path()]; }; @@ -539,8 +539,8 @@ describe('EmberApp', function() { }); }); - describe('getTests()', function() { - it('returns all test files `hinting` is enabled', async function() { + describe('getTests()', function () { + it('returns all test files `hinting` is enabled', async function () { let input = await createTempDir(); let addonLint = await createTempDir(); let addonFooTestSupport = await createTempDir(); @@ -574,7 +574,7 @@ describe('EmberApp', function() { return tree; }; - app.addonTreesFor = function(type) { + app.addonTreesFor = function (type) { if (type === 'test-support') { return [addonFooTestSupport.path(), addonBarTestSupport.path()]; } @@ -606,7 +606,7 @@ describe('EmberApp', function() { await output.dispose(); }); - it('returns test files w/o lint tests if `hinting` is disabled', async function() { + it('returns test files w/o lint tests if `hinting` is disabled', async function () { let input = await createTempDir(); let addonFooTestSupport = await createTempDir(); let addonBarTestSupport = await createTempDir(); @@ -629,7 +629,7 @@ describe('EmberApp', function() { hinting: false, }); app.trees.tests = input.path(); - app.addonTreesFor = function(type) { + app.addonTreesFor = function (type) { if (type === 'test-support') { return [addonFooTestSupport.path(), addonBarTestSupport.path()]; } @@ -657,9 +657,9 @@ describe('EmberApp', function() { }); }); - describe('constructor', function() { - it('should override project.configPath if configPath option is specified', function() { - project.configPath = function() { + describe('constructor', function () { + it('should override project.configPath if configPath option is specified', function () { + project.configPath = function () { return 'original value'; }; @@ -673,7 +673,7 @@ describe('EmberApp', function() { expect(project.configPath().slice(-expected.length)).to.equal(expected); }); - it('should set bowerDirectory for app', function() { + it('should set bowerDirectory for app', function () { let app = new EmberApp({ project, }); @@ -682,7 +682,7 @@ describe('EmberApp', function() { expect(app.bowerDirectory).to.equal('bower_components'); }); - it('should merge options with defaults to depth', function() { + it('should merge options with defaults to depth', function () { let app = new EmberApp( { project, @@ -719,7 +719,7 @@ describe('EmberApp', function() { }); }); - it('should do the right thing when merging default object options', function() { + it('should do the right thing when merging default object options', function () { let app = new EmberApp( { project, @@ -750,7 +750,7 @@ describe('EmberApp', function() { }); }); - it('should watch vendor if it exists', function() { + it('should watch vendor if it exists', function () { let app = new EmberApp({ project, }); @@ -758,7 +758,7 @@ describe('EmberApp', function() { expect(app.options.trees.vendor.__broccoliGetInfo__()).to.have.property('watched', true); }); - describe('Addons included hook', function() { + describe('Addons included hook', function () { let includedWasCalled; let setupPreprocessorRegistryWasCalled; let addonsAppIncluded, addonsApp; @@ -777,15 +777,15 @@ describe('EmberApp', function() { }, }; - beforeEach(function() { + beforeEach(function () { setupPreprocessorRegistryWasCalled = includedWasCalled = 0; addonsApp = null; addonsAppIncluded = null; - project.initializeAddons = function() {}; + project.initializeAddons = function () {}; project.addons = [addon]; }); - it('should set the app on the addons', function() { + it('should set the app on the addons', function () { expect(includedWasCalled).to.eql(0); let app = new EmberApp({ project, @@ -800,8 +800,8 @@ describe('EmberApp', function() { }); }); - describe('loader.js missing', function() { - it('does not error when loader.js is present in registry.availablePlugins', function() { + describe('loader.js missing', function () { + it('does not error when loader.js is present in registry.availablePlugins', function () { expect(() => { new EmberApp({ project, @@ -809,7 +809,7 @@ describe('EmberApp', function() { }).to.not.throw(/loader.js addon is missing/); }); - it('throws an error when loader.js is not present in registry.availablePlugins', function() { + it('throws an error when loader.js is not present in registry.availablePlugins', function () { expect(() => { new EmberApp({ project, @@ -821,7 +821,7 @@ describe('EmberApp', function() { }).to.throw(/loader.js addon is missing/); }); - it('does not throw an error if _ignoreMissingLoader is set', function() { + it('does not throw an error if _ignoreMissingLoader is set', function () { expect(() => { new EmberApp({ project, @@ -835,14 +835,14 @@ describe('EmberApp', function() { }); }); - describe('ember-resolver npm vs Bower', function() { - it('does not load ember-resolver.js as bower dep when ember-resolver is present in registry.availablePlugins', function() { + describe('ember-resolver npm vs Bower', function () { + it('does not load ember-resolver.js as bower dep when ember-resolver is present in registry.availablePlugins', function () { let app = new EmberApp({ project }); expect(app.vendorFiles['ember-resolver']).to.equal(undefined); }); - it('keeps ember-resolver.js in vendorFiles when npm ember-resolver is not installed, but is present in bower.json', function() { - project.bowerDependencies = function() { + it('keeps ember-resolver.js in vendorFiles when npm ember-resolver is not installed, but is present in bower.json', function () { + project.bowerDependencies = function () { return { ember: {}, 'ember-resolver': {} }; }; let app = new EmberApp({ @@ -857,8 +857,8 @@ describe('EmberApp', function() { ); }); - it('removes ember-resolver.js from vendorFiles when not in bower.json and npm ember-resolver not installed', function() { - project.bowerDependencies = function() { + it('removes ember-resolver.js from vendorFiles when not in bower.json and npm ember-resolver not installed', function () { + project.bowerDependencies = function () { return { ember: {} }; }; let app = new EmberApp({ @@ -873,8 +873,8 @@ describe('EmberApp', function() { }); }); - describe('options.babel.sourceMaps', function() { - it('disables babel sourcemaps by default', function() { + describe('options.babel.sourceMaps', function () { + it('disables babel sourcemaps by default', function () { let app = new EmberApp({ project, }); @@ -882,7 +882,7 @@ describe('EmberApp', function() { expect(app.options.babel.sourceMaps).to.be.false; }); - it('can enable babel sourcemaps with the option', function() { + it('can enable babel sourcemaps with the option', function () { let app = new EmberApp({ project, babel: { @@ -894,8 +894,8 @@ describe('EmberApp', function() { }); }); - describe('options.fingerprint.exclude', function() { - it('excludeds testem in fingerprint exclude', function() { + describe('options.fingerprint.exclude', function () { + it('excludeds testem in fingerprint exclude', function () { let app = new EmberApp({ project, fingerprint: { @@ -908,9 +908,9 @@ describe('EmberApp', function() { }); }); - describe('addons', function() { - describe('included hook', function() { - it('included hook is called properly on instantiation', function() { + describe('addons', function () { + describe('included hook', function () { + it('included hook is called properly on instantiation', function () { let called = false; let passedApp; @@ -922,7 +922,7 @@ describe('EmberApp', function() { treeFor() {}, }; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = [addon]; }; @@ -934,10 +934,10 @@ describe('EmberApp', function() { expect(passedApp).to.equal(app); }); - it('does not throw an error if the addon does not implement `included`', function() { + it('does not throw an error if the addon does not implement `included`', function () { delete addon.included; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = [addon]; }; @@ -949,14 +949,14 @@ describe('EmberApp', function() { }); }); - describe('addonTreesFor', function() { - beforeEach(function() { + describe('addonTreesFor', function () { + beforeEach(function () { addon = { included() {}, treeFor() {}, }; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = [addon]; }; @@ -965,15 +965,15 @@ describe('EmberApp', function() { }); }); - it('addonTreesFor returns an empty array if no addons return a tree', function() { + it('addonTreesFor returns an empty array if no addons return a tree', function () { expect(app.addonTreesFor('blah')).to.deep.equal([]); }); - it('addonTreesFor calls treesFor on the addon', function() { + it('addonTreesFor calls treesFor on the addon', function () { let sampleAddon = project.addons[0]; let actualTreeName; - sampleAddon.treeFor = function(name) { + sampleAddon.treeFor = function (name) { actualTreeName = name; return 'blazorz'; @@ -983,7 +983,7 @@ describe('EmberApp', function() { expect(actualTreeName).to.equal('blah'); }); - it('addonTreesFor does not throw an error if treeFor is not defined', function() { + it('addonTreesFor does not throw an error if treeFor is not defined', function () { delete addon.treeFor; app = new EmberApp({ @@ -995,8 +995,8 @@ describe('EmberApp', function() { }).not.to.throw(/addon must implement the `treeFor`/); }); - describe('addonTreesFor is called properly', function() { - beforeEach(function() { + describe('addonTreesFor is called properly', function () { + beforeEach(function () { app = new EmberApp({ project, }); @@ -1005,10 +1005,10 @@ describe('EmberApp', function() { td.when(app.addonTreesFor(), { ignoreExtraArgs: true }).thenReturn(['batman']); }); - it('getAppJavascript calls addonTreesFor', function() { + it('getAppJavascript calls addonTreesFor', function () { app.getAppJavascript(); - let args = td.explain(app.addonTreesFor).calls.map(function(call) { + let args = td.explain(app.addonTreesFor).calls.map(function (call) { return call.args[0]; }); @@ -1017,8 +1017,8 @@ describe('EmberApp', function() { }); }); - describe('toArray', function() { - it('excludes `tests` tree from resulting array if the tree is not present', function() { + describe('toArray', function () { + it('excludes `tests` tree from resulting array if the tree is not present', function () { app = new EmberApp({ project, trees: { @@ -1038,15 +1038,15 @@ describe('EmberApp', function() { }); }); - describe('toTree', function() { - beforeEach(function() { + describe('toTree', function () { + beforeEach(function () { addon = { included() {}, treeFor() {}, postprocessTree: td.function(), }; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = [addon]; }; @@ -1057,7 +1057,7 @@ describe('EmberApp', function() { }); }); - it('calls postProcessTree if defined', function() { + it('calls postProcessTree if defined', function () { app.toArray = td.function(); app._legacyPackage = td.function(); @@ -1067,7 +1067,7 @@ describe('EmberApp', function() { addon.postprocessTree( 'all', td.matchers.argThat( - t => t.constructor === BroccoliMergeTrees && t._inputNodes.length === 1 && t._inputNodes[0] === 'bar' + (t) => t.constructor === BroccoliMergeTrees && t._inputNodes.length === 1 && t._inputNodes[0] === 'bar' ) ) ).thenReturn('derp'); @@ -1075,7 +1075,7 @@ describe('EmberApp', function() { expect(app.toTree()).to.equal('derp'); }); - it('calls addonPostprocessTree', function() { + it('calls addonPostprocessTree', function () { app.toArray = td.function(); app.addonPostprocessTree = td.function(); app._legacyPackage = td.function(); @@ -1086,7 +1086,7 @@ describe('EmberApp', function() { app.addonPostprocessTree( 'all', td.matchers.argThat( - t => t.constructor === BroccoliMergeTrees && t._inputNodes.length === 1 && t._inputNodes[0] === 'bar' + (t) => t.constructor === BroccoliMergeTrees && t._inputNodes.length === 1 && t._inputNodes[0] === 'bar' ) ) ).thenReturn('blap'); @@ -1094,7 +1094,7 @@ describe('EmberApp', function() { expect(app.toTree()).to.equal('blap'); }); - it('calls each addon postprocessTree hook', function() { + it('calls each addon postprocessTree hook', function () { mockTemplateRegistry(app); app.index = td.function(); @@ -1110,7 +1110,7 @@ describe('EmberApp', function() { expect(app.toTree()).to.equal('blap'); - let args = td.explain(addon.postprocessTree).calls.map(function(call) { + let args = td.explain(addon.postprocessTree).calls.map(function (call) { return call.args[0]; }); @@ -1118,27 +1118,27 @@ describe('EmberApp', function() { }); }); - describe('addons can be disabled', function() { - beforeEach(function() { + describe('addons can be disabled', function () { + beforeEach(function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/env-addons'); const packageContents = require(path.join(projectPath, 'package.json')); let cli = new MockCLI(); project = new Project(projectPath, packageContents, cli.ui, cli); }); - afterEach(function() { + afterEach(function () { process.env.EMBER_ENV = undefined; }); - describe('isEnabled is called properly', function() { - describe('with environment', function() { + describe('isEnabled is called properly', function () { + describe('with environment', function () { let emberFooEnvAddonFixture; - beforeEach(function() { + beforeEach(function () { emberFooEnvAddonFixture = require(path.resolve(projectPath, 'node_modules/ember-foo-env-addon/index.js')); }); - it('development', function() { + it('development', function () { process.env.EMBER_ENV = 'development'; let app = new EmberApp({ project }); @@ -1148,7 +1148,7 @@ describe('EmberApp', function() { expect(app.project.addons.length).to.equal(8); }); - it('foo', function() { + it('foo', function () { process.env.EMBER_ENV = 'foo'; let app = new EmberApp({ project }); @@ -1160,8 +1160,8 @@ describe('EmberApp', function() { }); }); - describe('blacklist', function() { - it('prevents addons to be added to the project', function() { + describe('blacklist', function () { + it('prevents addons to be added to the project', function () { process.env.EMBER_ENV = 'foo'; let app = new EmberApp({ @@ -1176,7 +1176,7 @@ describe('EmberApp', function() { expect(app.project.addons.length).to.equal(8); }); - it('throws if unavailable addon is specified', function() { + it('throws if unavailable addon is specified', function () { function load() { process.env.EMBER_ENV = 'foo'; @@ -1192,8 +1192,8 @@ describe('EmberApp', function() { }); }); - describe('whitelist', function() { - it('prevents non-whitelisted addons to be added to the project', function() { + describe('whitelist', function () { + it('prevents non-whitelisted addons to be added to the project', function () { process.env.EMBER_ENV = 'foo'; let app = new EmberApp({ @@ -1208,7 +1208,7 @@ describe('EmberApp', function() { expect(app.project.addons.length).to.equal(1); }); - it('throws if unavailable addon is specified', function() { + it('throws if unavailable addon is specified', function () { function load() { process.env.EMBER_ENV = 'foo'; app = new EmberApp({ @@ -1223,8 +1223,8 @@ describe('EmberApp', function() { }); }); - describe('blacklist wins over whitelist', function() { - it('prevents addon to be added to the project', function() { + describe('blacklist wins over whitelist', function () { + it('prevents addon to be added to the project', function () { process.env.EMBER_ENV = 'foo'; app = new EmberApp({ project, @@ -1239,13 +1239,13 @@ describe('EmberApp', function() { }); }); - describe('addonLintTree', function() { - beforeEach(function() { + describe('addonLintTree', function () { + beforeEach(function () { addon = { lintTree: td.function(), }; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = [addon]; }; @@ -1254,11 +1254,11 @@ describe('EmberApp', function() { }); }); - it('does not throw an error if lintTree is not defined', function() { + it('does not throw an error if lintTree is not defined', function () { app.addonLintTree(); }); - it('calls lintTree on the addon', function() { + it('calls lintTree on the addon', function () { app.addonLintTree('blah', 'blam'); td.verify(addon.lintTree('blah', 'blam')); @@ -1266,25 +1266,25 @@ describe('EmberApp', function() { }); }); - describe('import', function() { - beforeEach(function() { + describe('import', function () { + beforeEach(function () { app = new EmberApp({ project, }); }); - afterEach(function() { + afterEach(function () { process.env.EMBER_ENV = undefined; }); - it('appends dependencies to vendor by default', function() { + it('appends dependencies to vendor by default', function () { app.import('vendor/moment.js'); let outputFile = app._scriptOutputFiles['/assets/vendor.js']; expect(outputFile).to.be.instanceof(Array); expect(outputFile.indexOf('vendor/moment.js')).to.equal(outputFile.length - 1); }); - it('appends dependencies', function() { + it('appends dependencies', function () { app.import('vendor/moment.js', { type: 'vendor' }); let outputFile = app._scriptOutputFiles['/assets/vendor.js']; @@ -1293,7 +1293,7 @@ describe('EmberApp', function() { expect(outputFile.indexOf('vendor/moment.js')).to.equal(outputFile.length - 1); }); - it('prepends dependencies', function() { + it('prepends dependencies', function () { app.import('vendor/es5-shim.js', { type: 'vendor', prepend: true }); let outputFile = app._scriptOutputFiles['/assets/vendor.js']; @@ -1302,7 +1302,7 @@ describe('EmberApp', function() { expect(outputFile.indexOf('vendor/es5-shim.js')).to.equal(0); }); - it('prepends dependencies to outputFile', function() { + it('prepends dependencies to outputFile', function () { app.import('vendor/moment.js', { outputFile: 'moment.js', prepend: true }); let outputFile = app._scriptOutputFiles['moment.js']; @@ -1311,7 +1311,7 @@ describe('EmberApp', function() { expect(outputFile.indexOf('vendor/moment.js')).to.equal(0); }); - it('appends dependencies to outputFile', function() { + it('appends dependencies to outputFile', function () { app.import('vendor/moment.js', { outputFile: 'moment.js' }); let outputFile = app._scriptOutputFiles['moment.js']; @@ -1320,7 +1320,7 @@ describe('EmberApp', function() { expect(outputFile.indexOf('vendor/moment.js')).to.equal(outputFile.length - 1); }); - it('defaults to development if production is not set', function() { + it('defaults to development if production is not set', function () { process.env.EMBER_ENV = 'production'; app.import({ development: 'vendor/jquery.js', @@ -1330,7 +1330,7 @@ describe('EmberApp', function() { expect(outputFile.indexOf('vendor/jquery.js')).to.equal(outputFile.length - 1); }); - it('honors explicitly set to null in environment', function() { + it('honors explicitly set to null in environment', function () { process.env.EMBER_ENV = 'production'; // set EMBER_ENV before creating the project @@ -1346,7 +1346,7 @@ describe('EmberApp', function() { expect(app._scriptOutputFiles['/assets/vendor.js']).to.not.contain('vendor/jquery.js'); }); - it('normalizes asset path correctly', function() { + it('normalizes asset path correctly', function () { app.import('vendor\\path\\to\\lib.js', { type: 'vendor' }); app.import('vendor/path/to/lib2.js', { type: 'vendor' }); @@ -1354,7 +1354,7 @@ describe('EmberApp', function() { expect(app._scriptOutputFiles['/assets/vendor.js']).to.contain('vendor/path/to/lib2.js'); }); - it('option.using throws exception given invalid inputs', function() { + it('option.using throws exception given invalid inputs', function () { // `using` is looped over if given, we should ensure this throws an exception with proper error message expect(() => { app.import('vendor/path/to/lib1.js', { using: 1 }); @@ -1374,11 +1374,11 @@ describe('EmberApp', function() { }); }); - describe('vendorFiles', function() { + describe('vendorFiles', function () { let defaultVendorFiles = ['jquery.js', 'ember.js', 'app-shims.js']; - describe('handlebars.js', function() { - it('does not app.import handlebars if not present in bower.json', function() { + describe('handlebars.js', function () { + it('does not app.import handlebars if not present in bower.json', function () { let app = new EmberApp({ project, }); @@ -1386,7 +1386,7 @@ describe('EmberApp', function() { expect(app.vendorFiles).not.to.include.keys('handlebars.js'); }); - it('includes handlebars if present in bower.json', function() { + it('includes handlebars if present in bower.json', function () { projectPath = path.resolve(__dirname, '../../fixtures/project-with-handlebars'); project = setupProject(projectPath); @@ -1397,7 +1397,7 @@ describe('EmberApp', function() { expect(app.vendorFiles).to.include.keys('handlebars.js'); }); - it('includes handlebars if present in provided `vendorFiles`', function() { + it('includes handlebars if present in provided `vendorFiles`', function () { let app = new EmberApp({ project, vendorFiles: { @@ -1409,14 +1409,14 @@ describe('EmberApp', function() { }); }); - it('defines vendorFiles by default', function() { + it('defines vendorFiles by default', function () { app = new EmberApp({ project, }); expect(Object.keys(app.vendorFiles)).to.deep.equal(defaultVendorFiles); }); - it('redefines a location of a vendor asset', function() { + it('redefines a location of a vendor asset', function () { app = new EmberApp({ project, @@ -1427,7 +1427,7 @@ describe('EmberApp', function() { expect(app.vendorFiles['ember.js']).to.equal('vendor/ember.js'); }); - it('defines vendorFiles in order even when option for it is passed', function() { + it('defines vendorFiles in order even when option for it is passed', function () { app = new EmberApp({ project, @@ -1438,17 +1438,17 @@ describe('EmberApp', function() { expect(Object.keys(app.vendorFiles)).to.deep.equal(defaultVendorFiles); }); - it('does not include jquery if the app has `@ember/jquery` installed', function() { - project.initializeAddons = function() { + it('does not include jquery if the app has `@ember/jquery` installed', function () { + project.initializeAddons = function () { this.addons = [{ name: '@ember/jquery' }]; }; app = new EmberApp({ project }); - let filesWithoutJQuery = defaultVendorFiles.filter(e => e !== 'jquery.js'); + let filesWithoutJQuery = defaultVendorFiles.filter((e) => e !== 'jquery.js'); expect(Object.keys(app.vendorFiles)).to.deep.equal(filesWithoutJQuery); }); - it('does not include jquery if the app has `@ember/optional-features` with the `jquery-integration` FF turned off', function() { - project.initializeAddons = function() { + it('does not include jquery if the app has `@ember/optional-features` with the `jquery-integration` FF turned off', function () { + project.initializeAddons = function () { this.addons = [ { name: 'ember-source', @@ -1463,11 +1463,11 @@ describe('EmberApp', function() { ]; }; app = new EmberApp({ project, vendorFiles: { 'ember-testing.js': null } }); - let filesWithoutJQuery = defaultVendorFiles.filter(e => e !== 'jquery.js'); + let filesWithoutJQuery = defaultVendorFiles.filter((e) => e !== 'jquery.js'); expect(Object.keys(app.vendorFiles)).to.deep.equal(filesWithoutJQuery); }); - it('removes dependency in vendorFiles', function() { + it('removes dependency in vendorFiles', function () { app = new EmberApp({ project, @@ -1481,7 +1481,7 @@ describe('EmberApp', function() { expect(vendorFiles).to.not.contain('handlebars.js'); }); - it('defaults to ember.debug.js if exists in bower_components', function() { + it('defaults to ember.debug.js if exists in bower_components', function () { let root = path.resolve(__dirname, '../../fixtures/app/with-default-ember-debug'); app = new EmberApp({ @@ -1492,7 +1492,7 @@ describe('EmberApp', function() { expect(files.development).to.equal('bower_components/ember/ember.debug.js'); }); - it('switches the default ember.debug.js to ember.js if it does not exist', function() { + it('switches the default ember.debug.js to ember.js if it does not exist', function () { let root = path.resolve(__dirname, '../../fixtures/app/without-ember-debug'); app = new EmberApp({ @@ -1503,7 +1503,7 @@ describe('EmberApp', function() { expect(files.development).to.equal('bower_components/ember/ember.js'); }); - it('does not clobber an explicitly configured ember development file', function() { + it('does not clobber an explicitly configured ember development file', function () { app = new EmberApp({ project, @@ -1518,7 +1518,7 @@ describe('EmberApp', function() { }); }); - it('fails with invalid type', function() { + it('fails with invalid type', function () { let app = new EmberApp({ project, }); @@ -1530,8 +1530,8 @@ describe('EmberApp', function() { ); }); - describe('_initOptions', function() { - it('sets the tests directory as watched when tests are enabled', function() { + describe('_initOptions', function () { + it('sets the tests directory as watched when tests are enabled', function () { let app = new EmberApp({ project, }); @@ -1542,7 +1542,7 @@ describe('EmberApp', function() { expect(app.options.trees.tests).to.be.an.instanceOf(WatchedDir); }); - it('sets the tests directory as unwatched when tests are disabled', function() { + it('sets the tests directory as unwatched when tests are disabled', function () { let app = new EmberApp({ project, }); @@ -1555,8 +1555,8 @@ describe('EmberApp', function() { }); }); - describe('_resolveLocal', function() { - it('resolves a path relative to the project root', function() { + describe('_resolveLocal', function () { + it('resolves a path relative to the project root', function () { let app = new EmberApp({ project, }); @@ -1566,17 +1566,17 @@ describe('EmberApp', function() { }); }); - describe('_concatFiles()', function() { - beforeEach(function() { + describe('_concatFiles()', function () { + beforeEach(function () { app = new EmberApp({ project }); }); - describe('concat order', function() { - beforeEach(function() { + describe('concat order', function () { + beforeEach(function () { mockTemplateRegistry(app); }); - it('correctly orders concats from app.styles()', function() { + it('correctly orders concats from app.styles()', function () { app.import('files/b.css'); app.import('files/c.css'); app.import('files/a.css', { prepend: true }); @@ -1590,7 +1590,7 @@ describe('EmberApp', function() { ]); }); - it('correctly orders concats from app.testFiles()', function() { + it('correctly orders concats from app.testFiles()', function () { app.import('files/b.js', { type: 'test' }); app.import('files/c.js', { type: 'test' }); app.import('files/a.js', { type: 'test' }); @@ -1612,16 +1612,16 @@ describe('EmberApp', function() { }); }); - describe('deprecations', function() { - it('shows ember-cli-shims deprecation', function() { + describe('deprecations', function () { + it('shows ember-cli-shims deprecation', function () { let root = path.resolve(__dirname, '../../fixtures/app/npm'); let project = setupProject(root); - project.require = function() { + project.require = function () { return { version: '5.0.0', }; }; - project.initializeAddons = function() { + project.initializeAddons = function () { this.addons = [ { name: 'ember-cli-babel', @@ -1639,9 +1639,9 @@ describe('EmberApp', function() { ); }); - describe('jQuery integration', function() { - it('shows deprecation', function() { - project.initializeAddons = function() { + describe('jQuery integration', function () { + it('shows deprecation', function () { + project.initializeAddons = function () { this.addons = [{ name: 'ember-source', paths: {} }]; }; app = new EmberApp({ project }); @@ -1651,8 +1651,8 @@ describe('EmberApp', function() { ); }); - it('does not show deprecation if the app has `@ember/jquery` installed', function() { - project.initializeAddons = function() { + it('does not show deprecation if the app has `@ember/jquery` installed', function () { + project.initializeAddons = function () { this.addons = [{ name: 'ember-source', paths: {} }, { name: '@ember/jquery' }]; }; app = new EmberApp({ project }); @@ -1661,8 +1661,8 @@ describe('EmberApp', function() { ); }); - it('does not show deprecation if the app has `@ember/optional-features` with the `jquery-integration` FF turned off', function() { - project.initializeAddons = function() { + it('does not show deprecation if the app has `@ember/optional-features` with the `jquery-integration` FF turned off', function () { + project.initializeAddons = function () { this.addons = [ { name: 'ember-source', paths: {} }, { diff --git a/tests/unit/broccoli/ember-app/app-and-dependencies-test.js b/tests/unit/broccoli/ember-app/app-and-dependencies-test.js index 68ea0659cc..cf5c2714fb 100644 --- a/tests/unit/broccoli/ember-app/app-and-dependencies-test.js +++ b/tests/unit/broccoli/ember-app/app-and-dependencies-test.js @@ -11,10 +11,10 @@ const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; const walkSync = require('walk-sync'); -describe('EmberApp#appAndDependencies', function() { +describe('EmberApp#appAndDependencies', function () { let input, output; - beforeEach(async function() { + beforeEach(async function () { process.env.EMBER_ENV = 'development'; input = await createTempDir(); @@ -48,7 +48,7 @@ describe('EmberApp#appAndDependencies', function() { }); }); - afterEach(async function() { + afterEach(async function () { delete process.env.EMBER_ENV; await input.dispose(); @@ -89,7 +89,7 @@ describe('EmberApp#appAndDependencies', function() { }); } - it('moduleNormalizerDisabled', async function() { + it('moduleNormalizerDisabled', async function () { input.write({ node_modules: { 'my-addon': { @@ -120,7 +120,7 @@ describe('EmberApp#appAndDependencies', function() { let addon = app.project.findAddonByName('my-addon'); - addon.treeForAddon = tree => { + addon.treeForAddon = (tree) => { const Funnel = require('broccoli-funnel'); return new Funnel(tree, { destDir: 'modules/my-addon', diff --git a/tests/unit/broccoli/ember-app/import-test.js b/tests/unit/broccoli/ember-app/import-test.js index a5dabdcfed..dd9606e299 100644 --- a/tests/unit/broccoli/ember-app/import-test.js +++ b/tests/unit/broccoli/ember-app/import-test.js @@ -15,7 +15,7 @@ const getDependencyFor = defaultPackagerHelpers.getDependencyFor; const setupProject = defaultPackagerHelpers.setupProject; const validateDefaultPackagedDist = defaultPackagerHelpers.validateDefaultPackagedDist; -describe('EmberApp: Bower Dependencies', function() { +describe('EmberApp: Bower Dependencies', function () { let applicationDirectory, output; let moment = getDependencyFor('moment', { @@ -24,11 +24,11 @@ describe('EmberApp: Bower Dependencies', function() { 'moment.min.js': 'window.moment = "verysmallmoment"', }); - beforeEach(async function() { + beforeEach(async function () { applicationDirectory = await createTempDir(); }); - afterEach(async function() { + afterEach(async function () { await applicationDirectory.dispose(); await output.dispose(); }); @@ -37,7 +37,7 @@ describe('EmberApp: Bower Dependencies', function() { * Both Ember.js and jQuery are packaged by default (when distriburted * through bower). `ember-source` takes precedent over bower though. */ - it('are not packaged unless explicitly imported', async function() { + it('are not packaged unless explicitly imported', async function () { // Given applicationDirectory.write( getDefaultUnpackagedDist('the-best-app-ever', { @@ -65,7 +65,7 @@ describe('EmberApp: Bower Dependencies', function() { expect(results.assets['vendor.js']).to.not.contain('window.moment'); }); - it('are packaged when explicitly imported', async function() { + it('are packaged when explicitly imported', async function () { // Given applicationDirectory.write( getDefaultUnpackagedDist('the-best-app-ever', { @@ -93,7 +93,7 @@ describe('EmberApp: Bower Dependencies', function() { expect(results.assets['vendor.js']).to.contain('window.moment'); }); - it('are packaged when explicitly imported for production', async function() { + it('are packaged when explicitly imported for production', async function () { // Given applicationDirectory.write( getDefaultUnpackagedDist('the-best-app-ever', { @@ -124,7 +124,7 @@ describe('EmberApp: Bower Dependencies', function() { expect(results.assets['vendor.js']).to.contain('verysmallmoment'); }); - it('are packaged when explicitly imported for development', async function() { + it('are packaged when explicitly imported for development', async function () { // Given applicationDirectory.write( getDefaultUnpackagedDist('the-best-app-ever', { diff --git a/tests/unit/broccoli/merge-trees-test.js b/tests/unit/broccoli/merge-trees-test.js index b491413e46..b9f23f53a1 100644 --- a/tests/unit/broccoli/merge-trees-test.js +++ b/tests/unit/broccoli/merge-trees-test.js @@ -4,30 +4,30 @@ const expect = require('chai').expect; const mergeTrees = require('../../../lib/broccoli/merge-trees'); -describe('broccoli/merge-trees', function() { +describe('broccoli/merge-trees', function () { let originalUpstreamMergeTrees; - beforeEach(function() { + beforeEach(function () { originalUpstreamMergeTrees = mergeTrees._upstreamMergeTrees; - mergeTrees._upstreamMergeTrees = function() { + mergeTrees._upstreamMergeTrees = function () { return {}; }; }); - afterEach(function() { + afterEach(function () { // reset the shared EMPTY_MERGE_TREE to ensure // we end up back in a consistent state mergeTrees._overrideEmptyTree(null); mergeTrees._upstreamMergeTrees = originalUpstreamMergeTrees; }); - it('returns the first item when merging single item array', function() { + it('returns the first item when merging single item array', function () { let actual = mergeTrees(['foo']); expect(actual).to.equal('foo'); }); - it('returns a constant "empty tree" when passed an empty array', function() { + it('returns a constant "empty tree" when passed an empty array', function () { let expected = {}; mergeTrees._overrideEmptyTree(expected); @@ -39,11 +39,11 @@ describe('broccoli/merge-trees', function() { expect(second).to.equal(expected); }); - it('passes all inputTrees through when non-empty', function() { + it('passes all inputTrees through when non-empty', function () { let expected = ['foo', 'bar']; let actual; - mergeTrees._upstreamMergeTrees = function(inputTrees) { + mergeTrees._upstreamMergeTrees = function (inputTrees) { actual = inputTrees; return {}; }; @@ -52,13 +52,13 @@ describe('broccoli/merge-trees', function() { expect(actual).to.deep.equal(expected); }); - it('filters out empty trees from inputs', function() { + it('filters out empty trees from inputs', function () { let expected = ['bar', 'baz']; let actual; mergeTrees._overrideEmptyTree('foo'); - mergeTrees._upstreamMergeTrees = function(inputTrees) { + mergeTrees._upstreamMergeTrees = function (inputTrees) { actual = inputTrees; return {}; }; @@ -67,13 +67,13 @@ describe('broccoli/merge-trees', function() { expect(actual).to.deep.equal(expected); }); - it('removes duplicate trees with the last duplicate being the remainder', function() { + it('removes duplicate trees with the last duplicate being the remainder', function () { let treeA = {}; let treeB = {}; let expected = [treeB, treeA]; let actual; - mergeTrees._upstreamMergeTrees = function(inputTrees) { + mergeTrees._upstreamMergeTrees = function (inputTrees) { actual = inputTrees; return {}; }; diff --git a/tests/unit/broccoli/template-precompilation-test.js b/tests/unit/broccoli/template-precompilation-test.js index 619a9b9915..1a321a5193 100644 --- a/tests/unit/broccoli/template-precompilation-test.js +++ b/tests/unit/broccoli/template-precompilation-test.js @@ -15,7 +15,7 @@ const EmberApp = require('../../../lib/broccoli/ember-app'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('template preprocessors', function() { +describe('template preprocessors', function () { let input, output, addon; class FakeTemplateColocator extends BroccoliPlugin { @@ -33,7 +33,7 @@ describe('template preprocessors', function() { let root = entries[0]; let files = walkSync(path.join(inputPath, root), { directories: false }); - files.forEach(file => { + files.forEach((file) => { let fullInputPath = path.join(inputPath, root, file); let fullOutputPath = path.join(this.outputPath, root, file); @@ -55,8 +55,8 @@ describe('template preprocessors', function() { } } - describe('Addon', function() { - beforeEach(async function() { + describe('Addon', function () { + beforeEach(async function () { input = await createTempDir(); let MockAddon = Addon.extend({ root: input.path(), @@ -77,12 +77,12 @@ describe('template preprocessors', function() { }); }); - afterEach(async function() { + afterEach(async function () { await input.dispose(); await output.dispose(); }); - it('the template preprocessor receives access to all files', async function() { + it('the template preprocessor receives access to all files', async function () { addon.registry.add('template', { name: 'fake-template-compiler', ext: 'hbs', @@ -116,22 +116,22 @@ describe('template preprocessors', function() { }); }); - describe('EmberApp', function() { + describe('EmberApp', function () { let project; - beforeEach(async function() { + beforeEach(async function () { input = await createTempDir(); let cli = new MockCLI(); let pkg = { name: 'fake-app-test', devDependencies: { 'ember-cli': '*' } }; project = new Project(input.path(), pkg, cli.ui, cli); }); - afterEach(async function() { + afterEach(async function () { await input.dispose(); await output.dispose(); }); - it('the template preprocessor receives access to all files', async function() { + it('the template preprocessor receives access to all files', async function () { input.write({ app: { components: { diff --git a/tests/unit/cli/cli-test.js b/tests/unit/cli/cli-test.js index 25623dc2df..680a0f2cdb 100644 --- a/tests/unit/cli/cli-test.js +++ b/tests/unit/cli/cli-test.js @@ -33,7 +33,7 @@ function ember(args) { settings: {}, project, }) - .then(function(value) { + .then(function (value) { td.verify(stopInstr('init'), { times: 1 }); td.verify(startInstr('command'), { times: 1 }); td.verify(stopInstr('command', td.matchers.anything(), td.matchers.isA(Array)), { times: 1 }); @@ -64,8 +64,8 @@ function stubRun(name) { return td.replace(commands[name].prototype, 'run', td.function()); } -describe('Unit: CLI', function() { - beforeEach(function() { +describe('Unit: CLI', function () { + beforeEach(function () { willInterruptProcess = require('../../../lib/utilities/will-interrupt-process'); td.replace(willInterruptProcess, 'addHandler', td.function()); td.replace(willInterruptProcess, 'removeHandler', td.function()); @@ -88,7 +88,7 @@ describe('Unit: CLI', function() { }; }); - afterEach(function() { + afterEach(function () { td.reset(); delete process.env.EMBER_ENV; @@ -97,10 +97,10 @@ describe('Unit: CLI', function() { this.timeout(10000); - it('ember', function() { + it('ember', function () { let help = stubValidateAndRun('help'); - return ember().then(function() { + return ember().then(function () { td.verify(help(), { ignoreExtraArgs: true, times: 1 }); let output = ui.output.trim(); expect(output).to.equal('', 'expected no extra output'); @@ -120,7 +120,7 @@ describe('Unit: CLI', function() { }); */ - it('callHelp', function() { + it('callHelp', function () { let cli = new CLI({ ui, analytics, @@ -155,7 +155,7 @@ describe('Unit: CLI', function() { td.verify(init(), { ignoreExtraArgs: true, times: 0 }); }); - it('errors correctly if the init hook errors', function() { + it('errors correctly if the init hook errors', function () { stubValidateAndRun('help'); let cli = new CLI({ @@ -179,7 +179,7 @@ describe('Unit: CLI', function() { settings: {}, project, }) - .then(function() { + .then(function () { td.verify(startInstr('command'), { times: 0 }); td.verify(stopInstr('command'), { times: 0 }); td.verify(startInstr('shutdown'), { times: 1 }); @@ -187,7 +187,7 @@ describe('Unit: CLI', function() { }); }); - it('"run" method must throw error if no evironment provided', function() { + it('"run" method must throw error if no evironment provided', function () { stubValidateAndRun('help'); let cli = new CLI({ @@ -202,7 +202,7 @@ describe('Unit: CLI', function() { .then(() => { wasResolved = true; }) - .catch(err => { + .catch((err) => { expect(err.toString()).to.be.equal('Error: Unable to execute "run" command without environment argument'); }) .finally(() => { @@ -210,7 +210,7 @@ describe('Unit: CLI', function() { }); }); - it('errors correctly if "run" method not called before "maybeMakeCommand" execution', function() { + it('errors correctly if "run" method not called before "maybeMakeCommand" execution', function () { stubValidateAndRun('help'); let cli = new CLI({ @@ -228,8 +228,8 @@ describe('Unit: CLI', function() { } }); - describe('custom addon command', function() { - it('beforeRun can return a promise', function() { + describe('custom addon command', function () { + it('beforeRun can return a promise', function () { let CustomCommand = Command.extend({ name: 'custom', @@ -242,8 +242,8 @@ describe('Unit: CLI', function() { beforeRun() { let command = this; - return new Promise(function(resolve) { - setTimeout(function() { + return new Promise(function (resolve) { + setTimeout(function () { command._beforeRunFinished = true; resolve(); }, 5); @@ -257,7 +257,7 @@ describe('Unit: CLI', function() { }, }); - project.eachAddonCommand = function(callback) { + project.eachAddonCommand = function (callback) { callback('custom-addon', { custom: CustomCommand, }); @@ -267,13 +267,13 @@ describe('Unit: CLI', function() { }); }); - describe('command interruption handler', function() { + describe('command interruption handler', function () { let onCommandInterrupt; - beforeEach(function() { + beforeEach(function () { onCommandInterrupt = td.matchers.isA(Function); }); - it('sets up handler before command run', function() { + it('sets up handler before command run', function () { const CustomCommand = Command.extend({ name: 'custom', @@ -288,7 +288,7 @@ describe('Unit: CLI', function() { }, }); - project.eachAddonCommand = function(callback) { + project.eachAddonCommand = function (callback) { callback('custom-addon', { CustomCommand, }); @@ -297,32 +297,32 @@ describe('Unit: CLI', function() { return ember(['custom']); }); - it('cleans up handler after command finished', function() { + it('cleans up handler after command finished', function () { stubValidateAndRun('serve'); - return ember(['serve']).finally(function() { + return ember(['serve']).finally(function () { td.verify(willInterruptProcess.removeHandler(onCommandInterrupt)); }); }); }); - describe('help', function() { - ['--help', '-h'].forEach(function(command) { - it(`ember ${command}`, function() { + describe('help', function () { + ['--help', '-h'].forEach(function (command) { + it(`ember ${command}`, function () { let help = stubValidateAndRun('help'); - return ember([command]).then(function() { + return ember([command]).then(function () { td.verify(help(), { ignoreExtraArgs: true, times: 1 }); let output = ui.output.trim(); expect(output).to.equal('', 'expected no extra output'); }); }); - it(`ember new ${command}`, function() { + it(`ember new ${command}`, function () { let help = stubCallHelp(); stubValidateAndRunHelp('new'); - return ember(['new', command]).then(function() { + return ember(['new', command]).then(function () { td.verify(help(), { ignoreExtraArgs: true, times: 1 }); let output = ui.output.trim(); expect(output).to.equal('', 'expected no extra output'); @@ -331,11 +331,11 @@ describe('Unit: CLI', function() { }); }); - ['--version', '-v'].forEach(function(command) { - it(`ember ${command}`, function() { + ['--version', '-v'].forEach(function (command) { + it(`ember ${command}`, function () { let version = stubValidateAndRun('version'); - return ember([command]).then(function() { + return ember([command]).then(function () { let output = ui.output.trim(); expect(output).to.equal('', 'expected no extra output'); td.verify(version(), { ignoreExtraArgs: true, times: 1 }); @@ -343,32 +343,32 @@ describe('Unit: CLI', function() { }); }); - describe('server', function() { - ['server', 's'].forEach(function(command) { - it(`ember ${command} --port 9999`, function() { + describe('server', function () { + ['server', 's'].forEach(function (command) { + it(`ember ${command} --port 9999`, function () { let server = stubRun('serve'); - return ember([command, '--port', '9999']).then(function() { + return ember([command, '--port', '9999']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.port, 'port').to.equal(9999); }); }); - it(`ember ${command} --host localhost`, function() { + it(`ember ${command} --host localhost`, function () { let server = stubRun('serve'); - return ember(['server', '--host', 'localhost']).then(function() { + return ember(['server', '--host', 'localhost']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.host, 'host').to.equal('localhost'); }); }); - it(`ember ${command} --port 9292 --host localhost`, function() { + it(`ember ${command} --port 9292 --host localhost`, function () { let server = stubRun('serve'); - return ember([command, '--port', '9292', '--host', 'localhost']).then(function() { + return ember([command, '--port', '9292', '--host', 'localhost']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.host, 'host').to.equal('localhost'); @@ -376,71 +376,71 @@ describe('Unit: CLI', function() { }); }); - it(`ember ${command} --proxy http://localhost:3000/`, function() { + it(`ember ${command} --proxy http://localhost:3000/`, function () { let server = stubRun('serve'); - return ember([command, '--proxy', 'http://localhost:3000/']).then(function() { + return ember([command, '--proxy', 'http://localhost:3000/']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.proxy, 'proxy').to.equal('http://localhost:3000/'); }); }); - it(`ember ${command} --proxy https://localhost:3009/ --insecure-proxy`, function() { + it(`ember ${command} --proxy https://localhost:3009/ --insecure-proxy`, function () { let server = stubRun('serve'); - return ember([command, '--insecure-proxy']).then(function() { + return ember([command, '--insecure-proxy']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.insecureProxy, 'insecureProxy').to.equal(true); }); }); - it(`ember ${command} --proxy https://localhost:3009/ --no-insecure-proxy`, function() { + it(`ember ${command} --proxy https://localhost:3009/ --no-insecure-proxy`, function () { let server = stubRun('serve'); - return ember([command, '--no-insecure-proxy']).then(function() { + return ember([command, '--no-insecure-proxy']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.insecureProxy, 'insecureProxy').to.equal(false); }); }); - it(`ember ${command} --watcher events`, function() { + it(`ember ${command} --watcher events`, function () { let server = stubRun('serve'); - return ember([command, '--watcher', 'events']).then(function() { + return ember([command, '--watcher', 'events']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.watcher, 'watcher').to.match(/node|polling|watchman/); }); }); - it(`ember ${command} --watcher polling`, function() { + it(`ember ${command} --watcher polling`, function () { let server = stubRun('serve'); - return ember([command, '--watcher', 'polling']).then(function() { + return ember([command, '--watcher', 'polling']).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.watcher, 'watcher').to.equal('polling'); }); }); - it(`ember ${command}`, function() { + it(`ember ${command}`, function () { let server = stubRun('serve'); - return ember([command]).then(function() { + return ember([command]).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.watcher, 'watcher').to.match(/node|polling|watchman/); }); }); - ['production', 'development', 'foo'].forEach(function(env) { - it(`ember ${command} --environment ${env}`, function() { + ['production', 'development', 'foo'].forEach(function (env) { + it(`ember ${command} --environment ${env}`, function () { let server = stubRun('serve'); - return ember([command, '--environment', env]).then(function() { + return ember([command, '--environment', env]).then(function () { let captor = td.matchers.captor(); td.verify(server(captor.capture()), { ignoreExtraArgs: true, times: 1 }); expect(captor.value.environment, 'environment').to.equal(env); @@ -448,12 +448,12 @@ describe('Unit: CLI', function() { }); }); - ['development', 'foo'].forEach(function(env) { - it(`ember ${command} --environment ${env}`, function() { + ['development', 'foo'].forEach(function (env) { + it(`ember ${command} --environment ${env}`, function () { let server = stubRun('serve'); process.env.EMBER_ENV = 'production'; - return ember([command, '--environment', env]).then(function() { + return ember([command, '--environment', env]).then(function () { td.verify(server(), { ignoreExtraArgs: true, times: 1 }); expect(process.env.EMBER_ENV).to.equal('production', 'uses EMBER_ENV over environment'); @@ -461,13 +461,13 @@ describe('Unit: CLI', function() { }); }); - ['production', 'development', 'foo'].forEach(function(env) { - it(`EMBER_ENV=${env} ember ${command}`, function() { + ['production', 'development', 'foo'].forEach(function (env) { + it(`EMBER_ENV=${env} ember ${command}`, function () { let server = stubRun('serve'); process.env.EMBER_ENV = env; - return ember([command]).then(function() { + return ember([command]).then(function () { td.verify(server(), { ignoreExtraArgs: true, times: 1 }); expect(process.env.EMBER_ENV).to.equal(env, 'correct environment'); @@ -477,12 +477,12 @@ describe('Unit: CLI', function() { }); }); - describe('generate', function() { - ['generate', 'g'].forEach(function(command) { - it(`ember ${command} foo bar baz`, function() { + describe('generate', function () { + ['generate', 'g'].forEach(function (command) { + it(`ember ${command} foo bar baz`, function () { let generate = stubRun('generate'); - return ember([command, 'foo', 'bar', 'baz']).then(function() { + return ember([command, 'foo', 'bar', 'baz']).then(function () { let captor = td.matchers.captor(); td.verify(generate(captor.capture(), ['foo', 'bar', 'baz']), { times: 1 }); @@ -494,20 +494,20 @@ describe('Unit: CLI', function() { }); }); - describe('init', function() { - ['init'].forEach(function(command) { - it(`ember ${command}`, function() { + describe('init', function () { + ['init'].forEach(function (command) { + it(`ember ${command}`, function () { let init = stubValidateAndRun('init'); - return ember([command]).then(function() { + return ember([command]).then(function () { td.verify(init(), { ignoreExtraArgs: true, times: 1 }); }); }); - it(`ember ${command} `, function() { + it(`ember ${command} `, function () { let init = stubRun('init'); - return ember([command, 'my-blog']).then(function() { + return ember([command, 'my-blog']).then(function () { let captor = td.matchers.captor(); td.verify(init(captor.capture(), ['my-blog']), { times: 1 }); @@ -519,34 +519,34 @@ describe('Unit: CLI', function() { }); }); - describe('new', function() { - it('ember new', function() { + describe('new', function () { + it('ember new', function () { isWithinProject = false; let newCommand = stubRun('new'); - return ember(['new']).then(function() { + return ember(['new']).then(function () { td.verify(newCommand(), { ignoreExtraArgs: true, times: 1 }); }); }); - it('ember new MyApp', function() { + it('ember new MyApp', function () { isWithinProject = false; let newCommand = stubRun('new'); - return ember(['new', 'MyApp']).then(function() { + return ember(['new', 'MyApp']).then(function () { td.verify(newCommand(td.matchers.anything(), ['MyApp']), { times: 1 }); }); }); }); - describe('build', function() { - ['build', 'b'].forEach(function(command) { - it(`ember ${command}`, function() { + describe('build', function () { + ['build', 'b'].forEach(function (command) { + it(`ember ${command}`, function () { let build = stubRun('build'); - return ember([command]).then(function() { + return ember([command]).then(function () { let captor = td.matchers.captor(); td.verify(build(captor.capture()), { ignoreExtraArgs: true, times: 1 }); @@ -556,10 +556,10 @@ describe('Unit: CLI', function() { }); }); - it(`ember ${command} --disable-analytics`, function() { + it(`ember ${command} --disable-analytics`, function () { let build = stubRun('build'); - return ember([command, '--disable-analytics']).then(function() { + return ember([command, '--disable-analytics']).then(function () { let captor = td.matchers.captor(); td.verify(build(captor.capture()), { ignoreExtraArgs: true, times: 1 }); @@ -568,10 +568,10 @@ describe('Unit: CLI', function() { }); }); - it(`ember ${command} --watch`, function() { + it(`ember ${command} --watch`, function () { let build = stubRun('build'); - return ember([command, '--watch']).then(function() { + return ember([command, '--watch']).then(function () { let captor = td.matchers.captor(); td.verify(build(captor.capture()), { ignoreExtraArgs: true, times: 1 }); @@ -580,10 +580,10 @@ describe('Unit: CLI', function() { }); }); - it(`ember ${command} --suppress-sizes`, function() { + it(`ember ${command} --suppress-sizes`, function () { let build = stubRun('build'); - return ember([command, '--suppress-sizes']).then(function() { + return ember([command, '--suppress-sizes']).then(function () { let captor = td.matchers.captor(); td.verify(build(captor.capture()), { ignoreExtraArgs: true, times: 1 }); @@ -592,11 +592,11 @@ describe('Unit: CLI', function() { }); }); - ['production', 'development', 'baz'].forEach(function(env) { - it(`ember ${command} --environment ${env}`, function() { + ['production', 'development', 'baz'].forEach(function (env) { + it(`ember ${command} --environment ${env}`, function () { let build = stubRun('build'); - return ember([command, '--environment', env]).then(function() { + return ember([command, '--environment', env]).then(function () { let captor = td.matchers.captor(); td.verify(build(captor.capture()), { ignoreExtraArgs: true, times: 1 }); @@ -606,13 +606,13 @@ describe('Unit: CLI', function() { }); }); - ['development', 'baz'].forEach(function(env) { - it(`EMBER_ENV=production ember ${command} --environment ${env}`, function() { + ['development', 'baz'].forEach(function (env) { + it(`EMBER_ENV=production ember ${command} --environment ${env}`, function () { let build = stubRun('build'); process.env.EMBER_ENV = 'production'; - return ember([command, '--environment', env]).then(function() { + return ember([command, '--environment', env]).then(function () { td.verify(build(), { ignoreExtraArgs: true, times: 1 }); expect(process.env.EMBER_ENV).to.equal('production', 'uses EMBER_ENV over environment'); @@ -620,13 +620,13 @@ describe('Unit: CLI', function() { }); }); - ['production', 'development', 'baz'].forEach(function(env) { - it(`EMBER_ENV=${env} ember ${command} `, function() { + ['production', 'development', 'baz'].forEach(function (env) { + it(`EMBER_ENV=${env} ember ${command} `, function () { let build = stubRun('build'); process.env.EMBER_ENV = env; - return ember([command]).then(function() { + return ember([command]).then(function () { td.verify(build(), { ignoreExtraArgs: true, times: 1 }); expect(process.env.EMBER_ENV).to.equal(env, 'correct environment'); @@ -636,11 +636,11 @@ describe('Unit: CLI', function() { }); }); - it('ember ', function() { + it('ember ', function () { let help = stubValidateAndRun('help'); let serve = stubValidateAndRun('serve'); - return ember(['serve']).then(function() { + return ember(['serve']).then(function () { td.verify(help(), { ignoreExtraArgs: true, times: 0 }); td.verify(serve(), { ignoreExtraArgs: true, times: 1 }); @@ -649,11 +649,11 @@ describe('Unit: CLI', function() { }); }); - it.skip('ember ', function() { + it.skip('ember ', function () { let help = stubValidateAndRun('help'); let serve = stubValidateAndRun('serve'); - return ember(['serve', 'lorem', 'ipsum', 'dolor', '--flag1=one']).then(function() { + return ember(['serve', 'lorem', 'ipsum', 'dolor', '--flag1=one']).then(function () { let args = serve.calledWith[0][0].cliArgs; expect(help.called).to.equal(0, 'expected the help command NOT to be run'); @@ -667,10 +667,10 @@ describe('Unit: CLI', function() { }); }); - it('ember ', function() { + it('ember ', function () { let help = stubValidateAndRun('help'); - return expect(ember(['unknownCommand'])).to.be.rejected.then(error => { + return expect(ember(['unknownCommand'])).to.be.rejected.then((error) => { expect(help.called, 'help command was executed').to.not.be.ok; expect(error.name).to.equal('SilentError'); expect(error.message).to.equal( @@ -679,12 +679,12 @@ describe('Unit: CLI', function() { }); }); - describe.skip('default options config file', function() { - it('reads default options from .ember-cli file', function() { + describe.skip('default options config file', function () { + it('reads default options from .ember-cli file', function () { let defaults = ['--output', process.cwd()]; let build = stubValidateAndRun('build'); - return ember(['build'], defaults).then(function() { + return ember(['build'], defaults).then(function () { let options = build.calledWith[0][1].cliOptions; expect(options.output).to.equal(process.cwd()); @@ -692,8 +692,8 @@ describe('Unit: CLI', function() { }); }); - describe('logError', function() { - it('returns error status code in production', function() { + describe('logError', function () { + it('returns error status code in production', function () { let cli = new CLI({ ui: new MockUI(), testing: false, @@ -702,7 +702,7 @@ describe('Unit: CLI', function() { expect(cli.logError('foo')).to.equal(1); }); - it('does not throw an error in production', function() { + it('does not throw an error in production', function () { let cli = new CLI({ ui: new MockUI(), testing: false, @@ -713,7 +713,7 @@ describe('Unit: CLI', function() { expect(invokeError).to.not.throw(); }); - it('throws error in testing', function() { + it('throws error in testing', function () { let cli = new CLI({ ui: new MockUI(), testing: true, @@ -725,21 +725,21 @@ describe('Unit: CLI', function() { }); }); - describe('Global command options', function() { - let verboseCommand = function(args) { + describe('Global command options', function () { + let verboseCommand = function (args) { return ember(['fake-command', '--verbose'].concat(args)); }; - describe('--verbose', function() { - describe('option parsing', function() { - afterEach(function() { + describe('--verbose', function () { + describe('option parsing', function () { + afterEach(function () { delete process.env.EMBER_VERBOSE_FAKE_OPTION_1; delete process.env.EMBER_VERBOSE_FAKE_OPTION_2; }); // eslint-disable-next-line no-template-curly-in-string - it('sets process.env.EMBER_VERBOSE_${NAME} for each space delimited option', function() { - return expect(verboseCommand(['fake_option_1', 'fake_option_2'])).to.be.rejected.then(error => { + it('sets process.env.EMBER_VERBOSE_${NAME} for each space delimited option', function () { + return expect(verboseCommand(['fake_option_1', 'fake_option_2'])).to.be.rejected.then((error) => { expect(process.env.EMBER_VERBOSE_FAKE_OPTION_1).to.be.ok; expect(process.env.EMBER_VERBOSE_FAKE_OPTION_2).to.be.ok; expect(error.name).to.equal('SilentError'); @@ -749,9 +749,9 @@ describe('Unit: CLI', function() { }); }); - it('ignores verbose options after --', function() { + it('ignores verbose options after --', function () { return expect(verboseCommand(['fake_option_1', '--fake-option', 'fake_option_2'])).to.be.rejected.then( - error => { + (error) => { expect(process.env.EMBER_VERBOSE_FAKE_OPTION_1).to.be.ok; expect(process.env.EMBER_VERBOSE_FAKE_OPTION_2).to.not.be.ok; expect(error.name).to.equal('SilentError'); @@ -762,8 +762,8 @@ describe('Unit: CLI', function() { ); }); - it('ignores verbose options after -', function() { - return expect(verboseCommand(['fake_option_1', '-f', 'fake_option_2'])).to.be.rejected.then(error => { + it('ignores verbose options after -', function () { + return expect(verboseCommand(['fake_option_1', '-f', 'fake_option_2'])).to.be.rejected.then((error) => { expect(process.env.EMBER_VERBOSE_FAKE_OPTION_1).to.be.ok; expect(process.env.EMBER_VERBOSE_FAKE_OPTION_2).to.not.be.ok; expect(error.name).to.equal('SilentError'); diff --git a/tests/unit/cli/lookup-command-test.js b/tests/unit/cli/lookup-command-test.js index c2d0e1d708..d256ed4c98 100644 --- a/tests/unit/cli/lookup-command-test.js +++ b/tests/unit/cli/lookup-command-test.js @@ -23,7 +23,7 @@ let commands = { function AddonServeCommand() { return this; } -AddonServeCommand.prototype.includedCommands = function() { +AddonServeCommand.prototype.includedCommands = function () { return { Serve: { name: 'serve', @@ -32,7 +32,7 @@ AddonServeCommand.prototype.includedCommands = function() { }; }; -describe('cli/lookup-command.js', function() { +describe('cli/lookup-command.js', function () { let ui; let project = { isEmberCLIProject() { @@ -45,18 +45,18 @@ describe('cli/lookup-command.js', function() { eachAddonCommand: Project.prototype.eachAddonCommand, }; - before(function() { + before(function () { ui = new MockUI(); }); - it('lookupCommand() should find commands by name and aliases.', function() { + it('lookupCommand() should find commands by name and aliases.', function () { // Valid commands expect(lookupCommand(commands, 'serve')).to.exist; expect(lookupCommand(commands, 's')).to.exist; }); - it('lookupCommand() should find commands that addons add by name and aliases.', function() { + it('lookupCommand() should find commands that addons add by name and aliases.', function () { let command, Command; Command = lookupCommand(commands, 'addon-command', [], { @@ -119,7 +119,7 @@ describe('cli/lookup-command.js', function() { expect(command.name).to.equal('class-addon-command'); }); - it('lookupCommand() should write out a warning when overriding a core command', function() { + it('lookupCommand() should write out a warning when overriding a core command', function () { project = { isEmberCLIProject() { return true; @@ -141,7 +141,7 @@ describe('cli/lookup-command.js', function() { ); }); - it('lookupCommand() should write out a warning when overriding a core command and allow it if intentional', function() { + it('lookupCommand() should write out a warning when overriding a core command and allow it if intentional', function () { project = { isEmberCLIProject() { return true; @@ -163,7 +163,7 @@ describe('cli/lookup-command.js', function() { ); }); - it('lookupCommand() should return UnknownCommand object when command name is not present.', function() { + it('lookupCommand() should return UnknownCommand object when command name is not present.', function () { let Command = lookupCommand(commands, 'something-else', [], { project, ui, diff --git a/tests/unit/commands/addon-test.js b/tests/unit/commands/addon-test.js index c58f1dce72..28ec08aee2 100644 --- a/tests/unit/commands/addon-test.js +++ b/tests/unit/commands/addon-test.js @@ -7,10 +7,10 @@ const AddonCommand = require('../../../lib/commands/addon'); const Blueprint = require('../../../lib/models/blueprint'); const td = require('testdouble'); -describe('addon command', function() { +describe('addon command', function () { let command; - beforeEach(function() { + beforeEach(function () { let options = commandOptions({ project: { isEmberCLIProject() { @@ -25,61 +25,61 @@ describe('addon command', function() { command = new AddonCommand(options); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it("doesn't allow to create an addon named `test`", function() { - return expect(command.validateAndRun(['test'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon named `test`", function () { + return expect(command.validateAndRun(['test'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `test`.'); }); }); - it("doesn't allow to create an addon named `ember`", function() { - return expect(command.validateAndRun(['ember'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon named `ember`", function () { + return expect(command.validateAndRun(['ember'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `ember`.'); }); }); - it("doesn't allow to create an addon named `Ember`", function() { - return expect(command.validateAndRun(['Ember'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon named `Ember`", function () { + return expect(command.validateAndRun(['Ember'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `Ember`.'); }); }); - it("doesn't allow to create an addon named `ember-cli`", function() { - return expect(command.validateAndRun(['ember-cli'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon named `ember-cli`", function () { + return expect(command.validateAndRun(['ember-cli'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `ember-cli`.'); }); }); - it("doesn't allow to create an addon named `vendor`", function() { - return expect(command.validateAndRun(['vendor'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon named `vendor`", function () { + return expect(command.validateAndRun(['vendor'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `vendor`.'); }); }); - it("doesn't allow to create an addon with a period in the name", function() { - return expect(command.validateAndRun(['zomg.awesome'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon with a period in the name", function () { + return expect(command.validateAndRun(['zomg.awesome'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `zomg.awesome`.'); }); }); - it("doesn't allow to create an addon with a name beginning with a number", function() { - return expect(command.validateAndRun(['123-my-bagel'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon with a name beginning with a number", function () { + return expect(command.validateAndRun(['123-my-bagel'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `123-my-bagel`.'); }); }); - it("doesn't allow to create an addon when the name is a period", function() { - return expect(command.validateAndRun(['.'])).to.be.rejected.then(error => { + it("doesn't allow to create an addon when the name is a period", function () { + return expect(command.validateAndRun(['.'])).to.be.rejected.then((error) => { expect(error.message).to.equal( `Trying to generate an addon structure in this directory? Use \`ember init\` instead.` ); }); }); - it('registers blueprint options in beforeRun', function() { + it('registers blueprint options in beforeRun', function () { td.replace(Blueprint, 'lookup', td.function()); td.when(Blueprint.lookup('addon'), { ignoreExtraArgs: true }).thenReturn({ diff --git a/tests/unit/commands/build-test.js b/tests/unit/commands/build-test.js index da53db5832..851c7d8413 100644 --- a/tests/unit/commands/build-test.js +++ b/tests/unit/commands/build-test.js @@ -6,11 +6,11 @@ const Task = require('../../../lib/models/task'); const BuildCommand = require('../../../lib/commands/build'); const td = require('testdouble'); -describe('build command', function() { +describe('build command', function () { let tasks, options, command; let buildTaskInstance, buildWatchTaskInstance; - beforeEach(function() { + beforeEach(function () { tasks = { Build: Task.extend({ init() { @@ -47,24 +47,24 @@ describe('build command', function() { td.when(tasks.BuildWatch.prototype.run(), { ignoreExtraArgs: true, times: 1 }).thenResolve(); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('Build task is provided with the project instance', function() { - return command.validateAndRun([]).then(function() { + it('Build task is provided with the project instance', function () { + return command.validateAndRun([]).then(function () { expect(buildTaskInstance.project).to.equal(options.project, 'has correct project instance'); }); }); - it('BuildWatch task is provided with the project instance', function() { - return command.validateAndRun(['--watch']).then(function() { + it('BuildWatch task is provided with the project instance', function () { + return command.validateAndRun(['--watch']).then(function () { expect(buildWatchTaskInstance.project).to.equal(options.project, 'has correct project instance'); }); }); - it('BuildWatch task is provided with a watcher option', function() { - return command.validateAndRun(['--watch', '--watcher poller']).then(function() { + it('BuildWatch task is provided with a watcher option', function () { + return command.validateAndRun(['--watch', '--watcher poller']).then(function () { let buildWatchRun = tasks.BuildWatch.prototype.run; let captor = td.matchers.captor(); @@ -73,24 +73,24 @@ describe('build command', function() { }); }); - it('Asset Size Printer task is not run after Build task in non-production environment', function() { - return new BuildCommand(options).validateAndRun([]).then(function() { + it('Asset Size Printer task is not run after Build task in non-production environment', function () { + return new BuildCommand(options).validateAndRun([]).then(function () { let showSizesRun = tasks.ShowAssetSizes.prototype.run; td.verify(showSizesRun(), { ignoreExtraArgs: true, times: 0 }); }); }); - it('Asset Size Printer task is run after Build task in production environment', function() { - return new BuildCommand(options).validateAndRun(['--environment=production']).then(function() { + it('Asset Size Printer task is run after Build task in production environment', function () { + return new BuildCommand(options).validateAndRun(['--environment=production']).then(function () { let showSizesRun = tasks.ShowAssetSizes.prototype.run; td.verify(showSizesRun(), { ignoreExtraArgs: true, times: 1 }); }); }); - it('Asset Size Printer task is not run if suppress sizes option is provided', function() { - return new BuildCommand(options).validateAndRun(['--suppress-sizes']).then(function() { + it('Asset Size Printer task is not run if suppress sizes option is provided', function () { + return new BuildCommand(options).validateAndRun(['--suppress-sizes']).then(function () { let showSizesRun = tasks.ShowAssetSizes.prototype.run; td.verify(showSizesRun(), { ignoreExtraArgs: true, times: 0 }); diff --git a/tests/unit/commands/destroy-test.js b/tests/unit/commands/destroy-test.js index 5e43956b75..ff2e2f05c7 100644 --- a/tests/unit/commands/destroy-test.js +++ b/tests/unit/commands/destroy-test.js @@ -8,13 +8,13 @@ const commandOptions = require('../../factories/command-options'); const Task = require('../../../lib/models/task'); const DestroyCommand = require('../../../lib/commands/destroy'); -describe('destroy command', function() { +describe('destroy command', function () { let options, command, project; - beforeEach(function() { + beforeEach(function () { project = new MockProject(); - project.isEmberCLIProject = function() { + project.isEmberCLIProject = function () { return true; }; @@ -33,16 +33,16 @@ describe('destroy command', function() { command = new DestroyCommand(options); }); - it('runs DestroyFromBlueprint with expected options', function() { - return command.validateAndRun(['controller', 'foo']).then(function(options) { + it('runs DestroyFromBlueprint with expected options', function () { + return command.validateAndRun(['controller', 'foo']).then(function (options) { expect(options.dryRun).to.be.false; expect(options.verbose).to.be.false; expect(options.args).to.deep.equal(['controller', 'foo']); }); }); - it('complains if no entity name is given', function() { - return expect(command.validateAndRun(['controller'])).to.be.rejected.then(error => { + it('complains if no entity name is given', function () { + return expect(command.validateAndRun(['controller'])).to.be.rejected.then((error) => { expect(error.message).to.equal( 'The `ember destroy` command requires an ' + 'entity name to be specified. ' + @@ -51,8 +51,8 @@ describe('destroy command', function() { }); }); - it('complains if no blueprint name is given', function() { - return expect(command.validateAndRun([])).to.be.rejected.then(error => { + it('complains if no blueprint name is given', function () { + return expect(command.validateAndRun([])).to.be.rejected.then((error) => { expect(error.message).to.equal( 'The `ember destroy` command requires a ' + 'blueprint name to be specified. ' + @@ -61,13 +61,13 @@ describe('destroy command', function() { }); }); - it('does not throw errors when beforeRun is invoked without the blueprint name', function() { + it('does not throw errors when beforeRun is invoked without the blueprint name', function () { expect(() => { command.beforeRun([]); }).to.not.throw(); }); - it('rethrows errors from beforeRun', function() { + it('rethrows errors from beforeRun', function () { project.blueprintLookupPaths = undefined; expect(() => { @@ -75,8 +75,8 @@ describe('destroy command', function() { }).to.throw(/(is not a function)|(has no method)/); }); - describe('help', function() { - it('prints extra info', function() { + describe('help', function () { + it('prints extra info', function () { command.printDetailedHelp(); let output = options.ui.output; diff --git a/tests/unit/commands/generate-test.js b/tests/unit/commands/generate-test.js index 1f9f072968..6a978151c8 100644 --- a/tests/unit/commands/generate-test.js +++ b/tests/unit/commands/generate-test.js @@ -12,20 +12,20 @@ const td = require('testdouble'); const ROOT = process.cwd(); const { createTempDir } = require('broccoli-test-helper'); -describe('generate command', function() { +describe('generate command', function () { let input, options, command; - beforeEach(async function() { + beforeEach(async function () { input = await createTempDir(); process.chdir(input.path()); let project = new MockProject({ root: input.path() }); - project.isEmberCLIProject = function() { + project.isEmberCLIProject = function () { return true; }; - project.blueprintLookupPaths = function() { + project.blueprintLookupPaths = function () { return []; }; @@ -45,44 +45,44 @@ describe('generate command', function() { command = new GenerateCommand(options); }); - afterEach(async function() { + afterEach(async function () { td.reset(); process.chdir(ROOT); await input.dispose(); }); - it('runs GenerateFromBlueprint but with null nodeModulesPath with npm', function() { - command.project.hasDependencies = function() { + it('runs GenerateFromBlueprint but with null nodeModulesPath with npm', function () { + command.project.hasDependencies = function () { return false; }; - return expect(command.validateAndRun(['controller', 'foo'])).to.be.rejected.then(reason => { + return expect(command.validateAndRun(['controller', 'foo'])).to.be.rejected.then((reason) => { expect(reason.message).to.eql( 'Required packages are missing, run `npm install` from this directory to install them.' ); }); }); - it('runs GenerateFromBlueprint but with null nodeModulesPath with yarn', function() { + it('runs GenerateFromBlueprint but with null nodeModulesPath with yarn', function () { // force usage of `yarn` by adding yarn.lock file input.write({ 'yarn.lock': '', }); - command.project.hasDependencies = function() { + command.project.hasDependencies = function () { return false; }; - return expect(command.validateAndRun(['controller', 'foo'])).to.be.rejected.then(reason => { + return expect(command.validateAndRun(['controller', 'foo'])).to.be.rejected.then((reason) => { expect(reason.message).to.eql( 'Required packages are missing, run `yarn install` from this directory to install them.' ); }); }); - it('runs GenerateFromBlueprint with expected options', function() { - return command.validateAndRun(['controller', 'foo']).then(function(options) { + it('runs GenerateFromBlueprint with expected options', function () { + return command.validateAndRun(['controller', 'foo']).then(function (options) { expect(options.pod).to.be.false; expect(options.dryRun).to.be.false; expect(options.verbose).to.be.false; @@ -90,14 +90,14 @@ describe('generate command', function() { }); }); - it('does not throw errors when beforeRun is invoked without the blueprint name', function() { + it('does not throw errors when beforeRun is invoked without the blueprint name', function () { expect(() => { command.beforeRun([]); }).to.not.throw(); }); - it('complains if no blueprint name is given', function() { - return expect(command.validateAndRun([])).to.be.rejected.then(error => { + it('complains if no blueprint name is given', function () { + return expect(command.validateAndRun([])).to.be.rejected.then((error) => { expect(error.message).to.equal( 'The `ember generate` command requires a ' + 'blueprint name to be specified. ' + @@ -106,12 +106,12 @@ describe('generate command', function() { }); }); - describe('help', function() { - beforeEach(function() { + describe('help', function () { + beforeEach(function () { td.replace(Blueprint, 'list', td.function()); }); - it('lists available blueprints', function() { + it('lists available blueprints', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', @@ -148,7 +148,7 @@ ${EOL}`); expect(output).to.equal(testString); }); - it('lists available blueprints json', function() { + it('lists available blueprints json', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', @@ -195,7 +195,7 @@ ${EOL}`); ]); }); - it('works with single blueprint', function() { + it('works with single blueprint', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', @@ -227,7 +227,7 @@ ${EOL}`); expect(output).to.equal(testString); }); - it('works with single blueprint json', function() { + it('works with single blueprint json', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', @@ -266,7 +266,7 @@ ${EOL}`); ]); }); - it('handles missing blueprint', function() { + it('handles missing blueprint', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', @@ -291,7 +291,7 @@ ${EOL}`); expect(output).to.equal(testString); }); - it('handles missing blueprint json', function() { + it('handles missing blueprint json', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', @@ -317,7 +317,7 @@ ${EOL}`); ]); }); - it('ignores overridden blueprints when verbose false', function() { + it('ignores overridden blueprints when verbose false', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', @@ -345,7 +345,7 @@ ${EOL}`); expect(output).to.equal(testString); }); - it('shows overridden blueprints when verbose true', function() { + it('shows overridden blueprints when verbose true', function () { td.when(Blueprint.list(), { ignoreExtraArgs: true }).thenReturn([ { source: 'my-app', diff --git a/tests/unit/commands/help-test.js b/tests/unit/commands/help-test.js index c315e0459d..b271495d99 100644 --- a/tests/unit/commands/help-test.js +++ b/tests/unit/commands/help-test.js @@ -9,16 +9,16 @@ const td = require('testdouble'); let HelpCommand = require('../../../lib/commands/help'); -describe('help command', function() { +describe('help command', function () { let options; - beforeEach(function() { + beforeEach(function () { options = commandOptions(); }); - describe('common to both', function() { - it('finds command on disk', function() { - let Command1 = function() {}; + describe('common to both', function () { + it('finds command on disk', function () { + let Command1 = function () {}; Command1.prototype.printBasicHelp = td.function(); Command1.prototype.printDetailedHelp = td.function(); @@ -29,7 +29,7 @@ describe('help command', function() { let command = new HelpCommand(options); let wasCalled; - command._lookupCommand = function() { + command._lookupCommand = function () { expect(arguments[0]).to.equal(options.commands); expect(arguments[1]).to.equal('command-2'); wasCalled = true; @@ -42,10 +42,10 @@ describe('help command', function() { expect(wasCalled).to.be.true; }); - it('looks up multiple commands', function() { - let Command1 = function() {}; - let Command2 = function() {}; - let Command3 = function() {}; + it('looks up multiple commands', function () { + let Command1 = function () {}; + let Command2 = function () {}; + let Command3 = function () {}; Command1.prototype.printBasicHelp = td.function(); Command2.prototype.printBasicHelp = td.function(); Command3.prototype.printBasicHelp = td.function(); @@ -72,10 +72,10 @@ describe('help command', function() { }); }); - describe('unique to text printing', function() { - it('lists commands', function() { - let Command1 = function() {}; - let Command2 = function() {}; + describe('unique to text printing', function () { + it('lists commands', function () { + let Command1 = function () {}; + let Command2 = function () {}; Command1.prototype.printBasicHelp = td.function(); Command2.prototype.printBasicHelp = td.function(); Command1.prototype.printDetailedHelp = td.function(); @@ -96,9 +96,9 @@ describe('help command', function() { td.verify(Command2.prototype.printDetailedHelp(), { ignoreExtraArgs: true, times: 0 }); }); - it('works with single command', function() { - let Command1 = function() {}; - let Command2 = function() {}; + it('works with single command', function () { + let Command1 = function () {}; + let Command2 = function () {}; Command1.prototype.printBasicHelp = td.function(); Command2.prototype.printBasicHelp = td.function(); Command1.prototype.printDetailedHelp = td.function(); @@ -119,8 +119,8 @@ describe('help command', function() { td.verify(Command2.prototype.printDetailedHelp(), { ignoreExtraArgs: true, times: 0 }); }); - it('works with single command alias', function() { - let Command1 = function() {}; + it('works with single command alias', function () { + let Command1 = function () {}; Command1.prototype.aliases = ['my-alias']; Command1.prototype.printBasicHelp = td.function(); Command1.prototype.printDetailedHelp = td.function(); @@ -136,8 +136,8 @@ describe('help command', function() { td.verify(Command1.prototype.printBasicHelp(), { ignoreExtraArgs: true, times: 1 }); }); - it('passes extra commands to `generate`', function() { - let Generate = function() {}; + it('passes extra commands to `generate`', function () { + let Generate = function () {}; Generate.prototype.printBasicHelp = td.function(); Generate.prototype.printDetailedHelp = td.function(); @@ -158,8 +158,8 @@ describe('help command', function() { expect(captor.value.rawArgs).to.deep.equal(['something', 'else']); }); - it('handles no extra commands to `generate`', function() { - let Generate = function() {}; + it('handles no extra commands to `generate`', function () { + let Generate = function () {}; Generate.prototype.printBasicHelp = td.function(); Generate.prototype.printDetailedHelp = td.function(); @@ -180,8 +180,8 @@ describe('help command', function() { expect(captor.value.rawArgs).to.be.undefined; }); - it('passes extra commands to `generate` alias', function() { - let Generate = function() {}; + it('passes extra commands to `generate` alias', function () { + let Generate = function () {}; Generate.prototype.aliases = ['g']; Generate.prototype.printBasicHelp = td.function(); Generate.prototype.printDetailedHelp = td.function(); @@ -203,8 +203,8 @@ describe('help command', function() { expect(captor.value.rawArgs).to.deep.equal(['something', 'else']); }); - it('handles missing command', function() { - let Command1 = function() {}; + it('handles missing command', function () { + let Command1 = function () {}; options.commands = { Command1, @@ -224,11 +224,11 @@ ${EOL}\ expect(output).to.include(testString); }); - it('respects skipHelp when listing', function() { - let Command1 = function() { + it('respects skipHelp when listing', function () { + let Command1 = function () { this.skipHelp = true; }; - let Command2 = function() {}; + let Command2 = function () {}; Command1.prototype.printBasicHelp = td.function(); Command2.prototype.printBasicHelp = td.function(); @@ -245,8 +245,8 @@ ${EOL}\ td.verify(Command2.prototype.printBasicHelp(), { ignoreExtraArgs: true, times: 1 }); }); - it('ignores skipHelp when single', function() { - let Command1 = function() { + it('ignores skipHelp when single', function () { + let Command1 = function () { this.skipHelp = true; }; Command1.prototype.printBasicHelp = td.function(); @@ -263,13 +263,13 @@ ${EOL}\ td.verify(Command1.prototype.printBasicHelp(), { ignoreExtraArgs: true, times: 1 }); }); - it('lists addons', function() { - let Command1 = function() {}; - let Command2 = function() {}; + it('lists addons', function () { + let Command1 = function () {}; + let Command2 = function () {}; Command1.prototype.printBasicHelp = td.function(); Command2.prototype.printBasicHelp = td.function(); - options.project.eachAddonCommand = function(callback) { + options.project.eachAddonCommand = function (callback) { callback('my-addon', { Command1, Command2, @@ -291,13 +291,13 @@ Available commands from my-addon:${EOL}`); td.verify(Command2.prototype.printBasicHelp(), { ignoreExtraArgs: true, times: 1 }); }); - it('finds single addon command', function() { - let Command1 = function() {}; - let Command2 = function() {}; + it('finds single addon command', function () { + let Command1 = function () {}; + let Command2 = function () {}; Command1.prototype.printBasicHelp = td.function(); Command1.prototype.printDetailedHelp = td.function(); - options.project.eachAddonCommand = function(callback) { + options.project.eachAddonCommand = function (callback) { callback('my-addon', { Command1, Command2, @@ -312,13 +312,13 @@ Available commands from my-addon:${EOL}`); }); }); - describe('unique to json printing', function() { - beforeEach(function() { + describe('unique to json printing', function () { + beforeEach(function () { options.json = true; }); - it('lists commands', function() { - let Command1 = function() { + it('lists commands', function () { + let Command1 = function () { return { getJson() { return { @@ -328,7 +328,7 @@ Available commands from my-addon:${EOL}`); }; }; - let Command2 = function() { + let Command2 = function () { return { getJson() { return { @@ -356,8 +356,8 @@ Available commands from my-addon:${EOL}`); ]); }); - it('handles special option `Path`', function() { - let Command1 = function() { + it('handles special option `Path`', function () { + let Command1 = function () { return { getJson() { return { @@ -382,14 +382,14 @@ Available commands from my-addon:${EOL}`); ]); }); - it('respects skipHelp when listing', function() { - let Command1 = function() { + it('respects skipHelp when listing', function () { + let Command1 = function () { return { skipHelp: true, }; }; - let Command2 = function() { + let Command2 = function () { return { getJson() { return { @@ -414,8 +414,8 @@ Available commands from my-addon:${EOL}`); ]); }); - it('lists addons', function() { - let Command1 = function() { + it('lists addons', function () { + let Command1 = function () { return { getJson() { return { @@ -425,7 +425,7 @@ Available commands from my-addon:${EOL}`); }; }; - let Command2 = function() { + let Command2 = function () { return { getJson() { return { @@ -435,7 +435,7 @@ Available commands from my-addon:${EOL}`); }; }; - options.project.eachAddonCommand = function(callback) { + options.project.eachAddonCommand = function (callback) { callback('my-addon', { Command1, Command2 }); }; diff --git a/tests/unit/commands/init-test.js b/tests/unit/commands/init-test.js index 6e9ec2a290..7b5cfeac01 100644 --- a/tests/unit/commands/init-test.js +++ b/tests/unit/commands/init-test.js @@ -14,10 +14,10 @@ const InitCommand = require('../../../lib/commands/init'); const MockCLI = require('../../helpers/mock-cli'); const td = require('testdouble'); -describe('init command', function() { +describe('init command', function () { let ui, analytics, tasks, command, workingDir; - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); analytics = new MockAnalytics(); tasks = { @@ -32,7 +32,7 @@ describe('init command', function() { fs.mkdirSync(workingDir); }); - afterEach(function() { + afterEach(function () { fs.removeSync(workingDir); td.reset(); }); @@ -50,25 +50,25 @@ describe('init command', function() { command = new InitCommand(options); } - it("doesn't allow to create an application named `test`", function() { + it("doesn't allow to create an application named `test`", function () { buildCommand({ name: 'test' }); - return expect(command.validateAndRun([])).to.be.rejected.then(error => { + return expect(command.validateAndRun([])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `test`.'); }); }); - it("doesn't allow to create an application without project name", function() { + it("doesn't allow to create an application without project name", function () { buildCommand({ name: undefined }); - return expect(command.validateAndRun([])).to.be.rejected.then(error => { + return expect(command.validateAndRun([])).to.be.rejected.then((error) => { expect(error.message).to.equal( 'The `ember init` command requires a package.json in current folder with name attribute or a specified name via arguments. For more details, use `ember help`.' ); }); }); - it('Uses the name of the closest project to when calling installBlueprint', function() { + it('Uses the name of the closest project to when calling installBlueprint', function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts.rawName).to.equal('some-random-name'); @@ -78,12 +78,12 @@ describe('init command', function() { buildCommand(); - return command.validateAndRun([]).catch(function(reason) { + return command.validateAndRun([]).catch(function (reason) { expect(reason).to.equal('Called run'); }); }); - it('Uses the provided app name over the closest found project', function() { + it('Uses the provided app name over the closest found project', function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts.rawName).to.equal('provided-name'); @@ -93,12 +93,12 @@ describe('init command', function() { buildCommand(); - return command.validateAndRun(['--name=provided-name']).catch(function(reason) { + return command.validateAndRun(['--name=provided-name']).catch(function (reason) { expect(reason).to.equal('Called run'); }); }); - it('Uses process.cwd if no package is found when calling installBlueprint', function() { + it('Uses process.cwd if no package is found when calling installBlueprint', function () { // change the working dir so `process.cwd` can't be an invalid path for base directories // named `ember-cli`. @@ -117,15 +117,15 @@ describe('init command', function() { return command .validateAndRun([]) - .catch(function(reason) { + .catch(function (reason) { expect(reason).to.equal('Called run'); }) - .then(function() { + .then(function () { process.chdir(currentWorkingDir); }); }); - it("doesn't use --dry-run or any other command option as the name", function() { + it("doesn't use --dry-run or any other command option as the name", function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts.rawName).to.equal('some-random-name'); @@ -135,12 +135,12 @@ describe('init command', function() { buildCommand(); - return command.validateAndRun(['--dry-run']).catch(function(reason) { + return command.validateAndRun(['--dry-run']).catch(function (reason) { expect(reason).to.equal('Called run'); }); }); - it("doesn't use . as the name", function() { + it("doesn't use . as the name", function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts.rawName).to.equal('some-random-name'); @@ -150,12 +150,12 @@ describe('init command', function() { buildCommand(); - return command.validateAndRun(['.']).catch(function(reason) { + return command.validateAndRun(['.']).catch(function (reason) { expect(reason).to.equal('Called run'); }); }); - it('Uses the "app" blueprint by default', function() { + it('Uses the "app" blueprint by default', function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts.blueprint).to.equal('app'); @@ -165,12 +165,12 @@ describe('init command', function() { buildCommand(); - return command.validateAndRun(['--name=provided-name']).catch(function(reason) { + return command.validateAndRun(['--name=provided-name']).catch(function (reason) { expect(reason).to.equal('Called run'); }); }); - it('Uses arguments to select files to init', function() { + it('Uses arguments to select files to init', function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts.blueprint).to.equal('app'); @@ -180,12 +180,12 @@ describe('init command', function() { buildCommand(); - return command.validateAndRun(['package.json', '--name=provided-name']).catch(function(reason) { + return command.validateAndRun(['package.json', '--name=provided-name']).catch(function (reason) { expect(reason).to.equal('Called run'); }); }); - it('Uses the "addon" blueprint for addons', function() { + it('Uses the "addon" blueprint for addons', function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts.blueprint).to.equal('addon'); @@ -195,12 +195,12 @@ describe('init command', function() { buildCommand({ keywords: ['ember-addon'], name: 'some-random-name' }); - return command.validateAndRun(['--name=provided-name']).catch(function(reason) { + return command.validateAndRun(['--name=provided-name']).catch(function (reason) { expect(reason).to.equal('Called run'); }); }); - it('Registers blueprint options in beforeRun', function() { + it('Registers blueprint options in beforeRun', function () { td.replace(Blueprint, 'lookup', td.function()); td.when(Blueprint.lookup('app'), { ignoreExtraArgs: true }).thenReturn({ availableOptions: [{ name: 'custom-blueprint-option', type: String }], @@ -212,7 +212,7 @@ describe('init command', function() { expect(map(command.availableOptions, 'name')).to.contain('custom-blueprint-option'); }); - it('Passes command options through to the install blueprint task', function() { + it('Passes command options through to the install blueprint task', function () { tasks.InstallBlueprint = Task.extend({ run(blueprintOpts) { expect(blueprintOpts).to.contain.keys('customOption'); @@ -223,7 +223,7 @@ describe('init command', function() { buildCommand(); - return expect(command.validateAndRun(['--custom-option=customValue'])).to.be.rejected.then(reason => { + return expect(command.validateAndRun(['--custom-option=customValue'])).to.be.rejected.then((reason) => { expect(reason).to.equal('Called run'); }); }); diff --git a/tests/unit/commands/install-test.js b/tests/unit/commands/install-test.js index f1a8645610..9f606575c4 100644 --- a/tests/unit/commands/install-test.js +++ b/tests/unit/commands/install-test.js @@ -8,19 +8,19 @@ const AddonInstall = require('../../../lib/tasks/addon-install'); const InstallCommand = require('../../../lib/commands/install'); const td = require('testdouble'); -describe('install command', function() { +describe('install command', function () { let generateBlueprintInstance, npmInstance; let command, tasks; - beforeEach(function() { + beforeEach(function () { let project = new MockProject(); - project.isEmberCLIProject = function() { + project.isEmberCLIProject = function () { return true; }; - project.initializeAddons = function() {}; - project.reloadAddons = function() { + project.initializeAddons = function () {}; + project.reloadAddons = function () { this.addons = [ { pkg: { @@ -79,12 +79,12 @@ describe('install command', function() { command = new InstallCommand(options); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('initializes npm install and generate blueprint task with ui, project and analytics', function() { - return command.validateAndRun(['ember-data']).then(function() { + it('initializes npm install and generate blueprint task with ui, project and analytics', function () { + return command.validateAndRun(['ember-data']).then(function () { expect(npmInstance.ui, 'ui was set').to.be.ok; expect(npmInstance.project, 'project was set').to.be.ok; expect(npmInstance.analytics, 'analytics was set').to.be.ok; @@ -95,9 +95,9 @@ describe('install command', function() { }); }); - describe('with args', function() { - it('runs the npm install task with given name and save-dev true', function() { - return command.validateAndRun(['ember-data']).then(function() { + describe('with args', function () { + it('runs the npm install task with given name and save-dev true', function () { + return command.validateAndRun(['ember-data']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -113,14 +113,14 @@ describe('install command', function() { }); }); - it('runs the npm install task with given name and save-dev true in an addon', function() { - command.project.isEmberCLIProject = function() { + it('runs the npm install task with given name and save-dev true in an addon', function () { + command.project.isEmberCLIProject = function () { return false; }; - command.project.isEmberCLIAddon = function() { + command.project.isEmberCLIAddon = function () { return true; }; - return command.validateAndRun(['ember-data']).then(function() { + return command.validateAndRun(['ember-data']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -136,8 +136,8 @@ describe('install command', function() { }); }); - it('runs the npm install task with given name and save true with the --save option', function() { - return command.validateAndRun(['ember-data', '--save']).then(function() { + it('runs the npm install task with given name and save true with the --save option', function () { + return command.validateAndRun(['ember-data', '--save']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -153,14 +153,14 @@ describe('install command', function() { }); }); - it('runs the npm install task with given name and save true in an addon with the --save option', function() { - command.project.isEmberCLIProject = function() { + it('runs the npm install task with given name and save true in an addon with the --save option', function () { + command.project.isEmberCLIProject = function () { return false; }; - command.project.isEmberCLIAddon = function() { + command.project.isEmberCLIAddon = function () { return true; }; - return command.validateAndRun(['ember-data', '--save']).then(function() { + return command.validateAndRun(['ember-data', '--save']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -176,8 +176,8 @@ describe('install command', function() { }); }); - it('runs the package name blueprint task with given name and args', function() { - return command.validateAndRun(['ember-data']).then(function() { + it('runs the package name blueprint task with given name and args', function () { + return command.validateAndRun(['ember-data']).then(function () { let generateRun = tasks.GenerateFromBlueprint.prototype.run; let captor = td.matchers.captor(); td.verify(generateRun(captor.capture())); @@ -186,8 +186,8 @@ describe('install command', function() { }); }); - it('fails to install second argument for unknown addon', function() { - return expect(command.validateAndRun(['ember-cli-cordova', 'com.ember.test'])).to.be.rejected.then(error => { + it('fails to install second argument for unknown addon', function () { + return expect(command.validateAndRun(['ember-cli-cordova', 'com.ember.test'])).to.be.rejected.then((error) => { let generateRun = tasks.GenerateFromBlueprint.prototype.run; let captor = td.matchers.captor(); td.verify(generateRun(captor.capture())); @@ -203,8 +203,8 @@ describe('install command', function() { }); }); - it('runs npmInstall once and installs three addons', function() { - return command.validateAndRun(['ember-data', 'ember-cli-cordova', 'ember-cli-qunit']).then(function() { + it('runs npmInstall once and installs three addons', function () { + return command.validateAndRun(['ember-data', 'ember-cli-cordova', 'ember-cli-qunit']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -219,15 +219,15 @@ describe('install command', function() { ); let generateRun = tasks.GenerateFromBlueprint.prototype.run; - let generateRunArgs = td.explain(generateRun).calls.map(function(call) { + let generateRunArgs = td.explain(generateRun).calls.map(function (call) { return call.args[0].args[0]; }); expect(generateRunArgs).to.deep.equal(['ember-data', 'cordova-starter-kit', 'ember-cli-qunit']); }); }); - it('ember-cli/ember-cli-qunit: runs npmInstall but does not install the addon blueprint', function() { - return command.validateAndRun(['ember-cli/ember-cli-qunit']).then(function() { + it('ember-cli/ember-cli-qunit: runs npmInstall but does not install the addon blueprint', function () { + return command.validateAndRun(['ember-cli/ember-cli-qunit']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -246,8 +246,8 @@ describe('install command', function() { }); }); - it('ember-cli-qunit@1.2.0: runs npmInstall and installs the addon blueprint', function() { - return command.validateAndRun(['ember-cli-qunit@1.2.0']).then(function() { + it('ember-cli-qunit@1.2.0: runs npmInstall and installs the addon blueprint', function () { + return command.validateAndRun(['ember-cli-qunit@1.2.0']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -262,15 +262,15 @@ describe('install command', function() { ); let generateRun = tasks.GenerateFromBlueprint.prototype.run; - let generateRunArgs = td.explain(generateRun).calls.map(function(call) { + let generateRunArgs = td.explain(generateRun).calls.map(function (call) { return call.args[0].args[0]; }); expect(generateRunArgs).to.deep.equal(['ember-cli-qunit']); }); }); - it('@ember-cli/ember-cli-qunit: runs npmInstall and installs the addon blueprint', function() { - return command.validateAndRun(['@ember-cli/ember-cli-qunit']).then(function() { + it('@ember-cli/ember-cli-qunit: runs npmInstall and installs the addon blueprint', function () { + return command.validateAndRun(['@ember-cli/ember-cli-qunit']).then(function () { let npmRun = tasks.NpmInstall.prototype.run; td.verify( @@ -285,15 +285,15 @@ describe('install command', function() { ); let generateRun = tasks.GenerateFromBlueprint.prototype.run; - let generateRunArgs = td.explain(generateRun).calls.map(function(call) { + let generateRunArgs = td.explain(generateRun).calls.map(function (call) { return call.args[0].args[0]; }); expect(generateRunArgs).to.deep.equal(['@ember-cli/ember-cli-qunit']); }); }); - it("gives helpful message if it can't find the addon", function() { - return expect(command.validateAndRun(['unknown-addon'])).to.be.rejected.then(error => { + it("gives helpful message if it can't find the addon", function () { + return expect(command.validateAndRun(['unknown-addon'])).to.be.rejected.then((error) => { expect(error.message).to.equal( 'Install failed. Could not find addon with name: unknown-addon', 'expected error to have helpful message' @@ -302,9 +302,9 @@ describe('install command', function() { }); }); - describe('without args', function() { - it('gives a helpful message if no arguments are passed', function() { - return expect(command.validateAndRun([])).to.be.rejected.then(error => { + describe('without args', function () { + it('gives a helpful message if no arguments are passed', function () { + return expect(command.validateAndRun([])).to.be.rejected.then((error) => { expect(error.message).to.equal( 'The `install` command must take an argument with the name ' + 'of an ember-cli addon. For installing all npm and bower ' + diff --git a/tests/unit/commands/new-test.js b/tests/unit/commands/new-test.js index 38bf268055..39c43123a2 100644 --- a/tests/unit/commands/new-test.js +++ b/tests/unit/commands/new-test.js @@ -9,10 +9,10 @@ const Command = require('../../../lib/models/command'); const Task = require('../../../lib/models/task'); const td = require('testdouble'); -describe('new command', function() { +describe('new command', function () { let command; - beforeEach(function() { + beforeEach(function () { let options = commandOptions({ project: { isEmberCLIProject() { @@ -29,61 +29,61 @@ describe('new command', function() { td.replace(Blueprint, 'lookup', td.function()); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it("doesn't allow to create an application named `test`", function() { - return expect(command.validateAndRun(['test'])).to.be.rejected.then(error => { + it("doesn't allow to create an application named `test`", function () { + return expect(command.validateAndRun(['test'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `test`.'); }); }); - it("doesn't allow to create an application named `ember`", function() { - return expect(command.validateAndRun(['ember'])).to.be.rejected.then(error => { + it("doesn't allow to create an application named `ember`", function () { + return expect(command.validateAndRun(['ember'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `ember`.'); }); }); - it("doesn't allow to create an application named `Ember`", function() { - return expect(command.validateAndRun(['Ember'])).to.be.rejected.then(error => { + it("doesn't allow to create an application named `Ember`", function () { + return expect(command.validateAndRun(['Ember'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `Ember`.'); }); }); - it("doesn't allow to create an application named `ember-cli`", function() { - return expect(command.validateAndRun(['ember-cli'])).to.be.rejected.then(error => { + it("doesn't allow to create an application named `ember-cli`", function () { + return expect(command.validateAndRun(['ember-cli'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `ember-cli`.'); }); }); - it("doesn't allow to create an application named `vendor`", function() { - return expect(command.validateAndRun(['vendor'])).to.be.rejected.then(error => { + it("doesn't allow to create an application named `vendor`", function () { + return expect(command.validateAndRun(['vendor'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `vendor`.'); }); }); - it("doesn't allow to create an application with a period in the name", function() { - return expect(command.validateAndRun(['zomg.awesome'])).to.be.rejected.then(error => { + it("doesn't allow to create an application with a period in the name", function () { + return expect(command.validateAndRun(['zomg.awesome'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `zomg.awesome`.'); }); }); - it("doesn't allow to create an application with a name beginning with a number", function() { - return expect(command.validateAndRun(['123-my-bagel'])).to.be.rejected.then(error => { + it("doesn't allow to create an application with a name beginning with a number", function () { + return expect(command.validateAndRun(['123-my-bagel'])).to.be.rejected.then((error) => { expect(error.message).to.equal('We currently do not support a name of `123-my-bagel`.'); }); }); - it('shows a suggestion messages when the application name is a period', function() { - return expect(command.validateAndRun(['.'])).to.be.rejected.then(error => { + it('shows a suggestion messages when the application name is a period', function () { + return expect(command.validateAndRun(['.'])).to.be.rejected.then((error) => { expect(error.message).to.equal( `Trying to generate an application structure in this directory? Use \`ember init\` instead.` ); }); }); - it('registers blueprint options in beforeRun', function() { + it('registers blueprint options in beforeRun', function () { td.when(Blueprint.lookup('app'), { ignoreExtraArgs: true }).thenReturn({ availableOptions: [{ name: 'custom-blueprint-option', type: String }], }); @@ -92,7 +92,7 @@ describe('new command', function() { expect(map(command.availableOptions, 'name')).to.contain('custom-blueprint-option'); }); - it('passes command options through to init command', function() { + it('passes command options through to init command', function () { command.tasks.CreateAndStepIntoDirectory = Task.extend({ run() { return Promise.resolve(); @@ -111,7 +111,7 @@ describe('new command', function() { availableOptions: [{ name: 'custom-blueprint-option', type: String }], }); - return command.validateAndRun(['foo', '--custom-option=customValue']).then(function(reason) { + return command.validateAndRun(['foo', '--custom-option=customValue']).then(function (reason) { expect(reason).to.equal('Called run'); }); }); diff --git a/tests/unit/commands/serve-test.js b/tests/unit/commands/serve-test.js index 6248deb7e4..a292aab7a8 100644 --- a/tests/unit/commands/serve-test.js +++ b/tests/unit/commands/serve-test.js @@ -12,10 +12,10 @@ const getPort = util.promisify(PortFinder.getPort); const ServeCommand = require('../../../lib/commands/serve'); -describe('serve command', function() { +describe('serve command', function () { let tasks, options, command; - beforeEach(function() { + beforeEach(function () { tasks = { Serve: Task.extend(), }; @@ -29,12 +29,12 @@ describe('serve command', function() { command = new ServeCommand(options); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('has correct default options', function() { - return command.validateAndRun(['--port', '0']).then(function() { + it('has correct default options', function () { + return command.validateAndRun(['--port', '0']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.port).to.be.gte(4200, 'has correct port'); @@ -42,9 +42,9 @@ describe('serve command', function() { }); }); - it('setting --port without --live-reload-port', function() { - return getPort().then(function(port) { - return command.validateAndRun(['--port', `${port}`]).then(function() { + it('setting --port without --live-reload-port', function () { + return getPort().then(function (port) { + return command.validateAndRun(['--port', `${port}`]).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.port).to.equal(port, 'has correct port'); @@ -53,9 +53,9 @@ describe('serve command', function() { }); }); - it('setting both --port and --live-reload-port', function() { - return getPort().then(function(port) { - return command.validateAndRun(['--port', `${port}`, '--live-reload-port', '8005']).then(function() { + it('setting both --port and --live-reload-port', function () { + return getPort().then(function (port) { + return command.validateAndRun(['--port', `${port}`, '--live-reload-port', '8005']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.port).to.equal(port, 'has correct port'); @@ -71,24 +71,24 @@ describe('serve command', function() { // Works correctly on Travis and has been left for context as it does test // a valid code path. - let testServer = function(opts, test) { - let server = require('http').createServer(function() {}); - return new Promise(function(resolve) { - server.listen(opts.port, opts.host, function() { + let testServer = function (opts, test) { + let server = require('http').createServer(function () {}); + return new Promise(function (resolve) { + server.listen(opts.port, opts.host, function () { resolve(test(opts, server)); }); - }).finally(function() { - return new Promise(function(resolve) { - server.close(function() { + }).finally(function () { + return new Promise(function (resolve) { + server.close(function () { resolve(); }); }); }); }; - it('should throw error when -p PORT is taken', function() { - return testServer({ port: '32773' }, function() { - return expect(command.validateAndRun(['--port', '32773'])).to.be.rejected.then(err => { + it('should throw error when -p PORT is taken', function () { + return testServer({ port: '32773' }, function () { + return expect(command.validateAndRun(['--port', '32773'])).to.be.rejected.then((err) => { td.verify(tasks.Serve.prototype.run(), { ignoreExtraArgs: true, times: 0 }); expect(err.message).to.contain('is already in use.'); }); @@ -96,8 +96,8 @@ describe('serve command', function() { }); } - it('allows OS to choose port', function() { - return command.validateAndRun(['--port', '0']).then(function() { + it('allows OS to choose port', function () { + return command.validateAndRun(['--port', '0']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.port).to.be.within(7020, 65535, 'has correct port'); @@ -105,122 +105,124 @@ describe('serve command', function() { }); }); - it('has correct liveLoadPort', function() { - return command.validateAndRun(['--port', '0', '--live-reload-port', '4001']).then(function() { + it('has correct liveLoadPort', function () { + return command.validateAndRun(['--port', '0', '--live-reload-port', '4001']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.liveReloadPort).to.be.gte(4001, 'has correct liveReload port'); }); }); - it('has correct liveReloadLoadHost', function() { - return command.validateAndRun(['--port', '0', '--live-reload-host', '127.0.0.1']).then(function() { + it('has correct liveReloadLoadHost', function () { + return command.validateAndRun(['--port', '0', '--live-reload-host', '127.0.0.1']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.liveReloadHost).to.equal('127.0.0.1', 'has correct liveReload host'); }); }); - it('has correct liveLoadBaseUrl', function() { - return command.validateAndRun(['--port', '0', '--live-reload-base-url', 'http://127.0.0.1:4200/']).then(function() { - let captor = td.matchers.captor(); - td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); - expect(captor.value.liveReloadBaseUrl).to.equal('http://127.0.0.1:4200/', 'has correct liveReload baseUrl'); - }); + it('has correct liveLoadBaseUrl', function () { + return command + .validateAndRun(['--port', '0', '--live-reload-base-url', 'http://127.0.0.1:4200/']) + .then(function () { + let captor = td.matchers.captor(); + td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); + expect(captor.value.liveReloadBaseUrl).to.equal('http://127.0.0.1:4200/', 'has correct liveReload baseUrl'); + }); }); - it('has correct proxy', function() { - return command.validateAndRun(['--port', '0', '--proxy', 'http://localhost:3000/']).then(function() { + it('has correct proxy', function () { + return command.validateAndRun(['--port', '0', '--proxy', 'http://localhost:3000/']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.proxy).to.equal('http://localhost:3000/', 'has correct port'); }); }); - it('has correct secure proxy option', function() { - return command.validateAndRun(['--port', '0', '--secure-proxy', 'false']).then(function() { + it('has correct secure proxy option', function () { + return command.validateAndRun(['--port', '0', '--secure-proxy', 'false']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.secureProxy).to.equal(false, 'has correct insecure proxy option'); }); }); - it('has correct default value for secure proxy', function() { - return command.validateAndRun(['--port', '0']).then(function() { + it('has correct default value for secure proxy', function () { + return command.validateAndRun(['--port', '0']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.secureProxy).to.equal(true, 'has correct secure proxy option when not set'); }); }); - it('requires proxy URL to include protocol', function() { - return expect(command.validateAndRun(['--port', '0', '--proxy', 'localhost:3000'])).to.be.rejected.then(error => { + it('requires proxy URL to include protocol', function () { + return expect(command.validateAndRun(['--port', '0', '--proxy', 'localhost:3000'])).to.be.rejected.then((error) => { expect(error.message).to.equal( `You need to include a protocol with the proxy URL.${EOL}Try --proxy http://localhost:3000` ); }); }); - it('has correct default value for transparent proxy', function() { - return command.validateAndRun(['--port', '0']).then(function() { + it('has correct default value for transparent proxy', function () { + return command.validateAndRun(['--port', '0']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.transparentProxy).to.equal(true, 'has correct transparent proxy option when not set'); }); }); - it('host alias does not conflict with help alias', function() { - return command.validateAndRun(['--port', '0', '-H', 'localhost']).then(function() { + it('host alias does not conflict with help alias', function () { + return command.validateAndRun(['--port', '0', '-H', 'localhost']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.host).to.equal('localhost', 'has correct hostname'); }); }); - it('has correct value for proxy-in-timeout', function() { - return command.validateAndRun(['--port', '0', '--proxy-in-timeout', '300000']).then(function() { + it('has correct value for proxy-in-timeout', function () { + return command.validateAndRun(['--port', '0', '--proxy-in-timeout', '300000']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.proxyInTimeout).to.equal(300000, 'has correct incoming proxy timeout option'); }); }); - it('has correct default value for proxy-in-timeout', function() { - return command.validateAndRun(['--port', '0']).then(function() { + it('has correct default value for proxy-in-timeout', function () { + return command.validateAndRun(['--port', '0']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.proxyInTimeout).to.equal(120000, 'has correct incoming proxy timeout option when not set'); }); }); - it('has correct value for proxy-out-timeout', function() { - return command.validateAndRun(['--port', '0', '--proxy-out-timeout', '30000']).then(function() { + it('has correct value for proxy-out-timeout', function () { + return command.validateAndRun(['--port', '0', '--proxy-out-timeout', '30000']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.proxyOutTimeout).to.equal(30000, 'has correct outgoing proxy timeout option'); }); }); - it('has correct default value for proxy-out-timeout', function() { - return command.validateAndRun(['--port', '0']).then(function() { + it('has correct default value for proxy-out-timeout', function () { + return command.validateAndRun(['--port', '0']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Serve.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.proxyOutTimeout).to.equal(0, 'has correct outgoing proxy timeout option when not set'); }); }); - it('throws a meaningful error when run outside the project', function() { - command.project.hasDependencies = function() { + it('throws a meaningful error when run outside the project', function () { + command.project.hasDependencies = function () { return false; }; - command.project.isEmberCLIProject = function() { + command.project.isEmberCLIProject = function () { return false; }; command.isWithinProject = false; - return expect(command.validateAndRun(['--port', '0'])).to.be.rejected.then(error => { + return expect(command.validateAndRun(['--port', '0'])).to.be.rejected.then((error) => { expect(error.message).to.match(/You have to be inside an ember-cli project/); }); }); diff --git a/tests/unit/commands/show-asset-sizes-test.js b/tests/unit/commands/show-asset-sizes-test.js index 47751e63cc..31c32b518d 100644 --- a/tests/unit/commands/show-asset-sizes-test.js +++ b/tests/unit/commands/show-asset-sizes-test.js @@ -6,16 +6,16 @@ const Task = require('../../../lib/models/task'); const path = require('path'); const td = require('testdouble'); -describe('asset-sizes command', function() { +describe('asset-sizes command', function () { let ShowCommand; let tasks; let options; - before(function() { + before(function () { ShowCommand = require('../../../lib/commands/asset-sizes'); }); - beforeEach(function() { + beforeEach(function () { tasks = { ShowAssetSizes: Task.extend({}), }; @@ -28,24 +28,24 @@ describe('asset-sizes command', function() { td.replace(tasks.ShowAssetSizes.prototype, 'run', td.function()); }); - after(function() { + after(function () { ShowCommand = null; }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('has correct default value for output path', function() { - return new ShowCommand(options).validateAndRun().then(function() { + it('has correct default value for output path', function () { + return new ShowCommand(options).validateAndRun().then(function () { let captor = td.matchers.captor(); td.verify(tasks.ShowAssetSizes.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.outputPath).to.equal('dist/', 'has correct output path option when not set'); }); }); - it('has correct options', function() { - return new ShowCommand(options).validateAndRun(['--output-path', path.join('some', 'path')]).then(function() { + it('has correct options', function () { + return new ShowCommand(options).validateAndRun(['--output-path', path.join('some', 'path')]).then(function () { let captor = td.matchers.captor(); td.verify(tasks.ShowAssetSizes.prototype.run(captor.capture()), { times: 1 }); expect(captor.value.outputPath).to.equal(path.join(process.cwd(), 'some', 'path'), 'has correct asset path'); @@ -53,6 +53,6 @@ describe('asset-sizes command', function() { }); }); -describe.skip('default options config file', function() { - it('reads default options from .ember-cli file', function() {}); +describe.skip('default options config file', function () { + it('reads default options from .ember-cli file', function () {}); }); diff --git a/tests/unit/commands/test-test.js b/tests/unit/commands/test-test.js index 25c38b20f3..ebf2ff9f63 100644 --- a/tests/unit/commands/test-test.js +++ b/tests/unit/commands/test-test.js @@ -9,12 +9,12 @@ const Task = require('../../../lib/models/task'); const TestCommand = require('../../../lib/commands/test'); const td = require('testdouble'); -describe('test command', function() { +describe('test command', function () { this.timeout(30000); let tasks, options, command; - beforeEach(function() { + beforeEach(function () { tasks = { Build: Task.extend(), Test: Task.extend(), @@ -23,7 +23,7 @@ describe('test command', function() { let project = new MockProject(); - project.isEmberCLIProject = function() { + project.isEmberCLIProject = function () { return true; }; @@ -41,7 +41,7 @@ describe('test command', function() { td.when(tasks.TestServer.prototype.run(), { ignoreExtraArgs: true }).thenReturn(Promise.resolve()); }); - afterEach(function() { + afterEach(function () { td.reset(); }); @@ -49,17 +49,17 @@ describe('test command', function() { command = new TestCommand(options); } - describe('default', function() { - beforeEach(function() { + describe('default', function () { + beforeEach(function () { buildCommand(); }); - it('builds and runs test', function() { + it('builds and runs test', function () { return command.validateAndRun([]); }); - it('has the correct options', function() { - return command.validateAndRun([]).then(function() { + it('has the correct options', function () { + return command.validateAndRun([]).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Build.prototype.run(captor.capture())); @@ -72,8 +72,8 @@ describe('test command', function() { }); }); - it('passes through custom configFile option', function() { - return command.validateAndRun(['--config-file=some-random/path.json']).then(function() { + it('passes through custom configFile option', function () { + return command.validateAndRun(['--config-file=some-random/path.json']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -81,8 +81,8 @@ describe('test command', function() { }); }); - it('does not pass any port options', function() { - return command.validateAndRun([]).then(function() { + it('does not pass any port options', function () { + return command.validateAndRun([]).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -90,8 +90,8 @@ describe('test command', function() { }); }); - it('passes through a custom test port option', function() { - return command.validateAndRun(['--test-port=5679']).then(function() { + it('passes through a custom test port option', function () { + return command.validateAndRun(['--test-port=5679']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -99,8 +99,8 @@ describe('test command', function() { }); }); - it('passes through a custom test port option of 0 to allow OS to choose open system port', function() { - return command.validateAndRun(['--test-port=0']).then(function() { + it('passes through a custom test port option of 0 to allow OS to choose open system port', function () { + return command.validateAndRun(['--test-port=0']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -108,8 +108,8 @@ describe('test command', function() { }); }); - it('only passes through the port option', function() { - return command.validateAndRun(['--port=5678']).then(function() { + it('only passes through the port option', function () { + return command.validateAndRun(['--port=5678']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -117,8 +117,8 @@ describe('test command', function() { }); }); - it('passes both the port and the test port options', function() { - return command.validateAndRun(['--port=5678', '--test-port=5900']).then(function() { + it('passes both the port and the test port options', function () { + return command.validateAndRun(['--port=5678', '--test-port=5900']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -126,8 +126,8 @@ describe('test command', function() { }); }); - it('passes through custom host option', function() { - return command.validateAndRun(['--host=greatwebsite.com']).then(function() { + it('passes through custom host option', function () { + return command.validateAndRun(['--host=greatwebsite.com']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -135,8 +135,8 @@ describe('test command', function() { }); }); - it('passes through output path option', function() { - return command.validateAndRun(['--output-path=some/path']).then(function() { + it('passes through output path option', function () { + return command.validateAndRun(['--output-path=some/path']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -144,8 +144,8 @@ describe('test command', function() { }); }); - it('passes through custom reporter option', function() { - return command.validateAndRun(['--reporter=xunit']).then(function() { + it('passes through custom reporter option', function () { + return command.validateAndRun(['--reporter=xunit']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Test.prototype.run(captor.capture())); @@ -153,8 +153,8 @@ describe('test command', function() { }); }); - it('has the correct options when called with a build path and does not run a build task', function() { - return command.validateAndRun(['--path=tests']).then(function() { + it('has the correct options when called with a build path and does not run a build task', function () { + return command.validateAndRun(['--path=tests']).then(function () { let captor = td.matchers.captor(); td.verify(tasks.Build.prototype.run(td.matchers.anything()), { times: 0 }); @@ -169,8 +169,8 @@ describe('test command', function() { }); }); - it('throws an error if the build path does not exist', function() { - return expect(command.validateAndRun(['--path=bad/path/to/build'])).to.be.rejected.then(error => { + it('throws an error if the build path does not exist', function () { + return expect(command.validateAndRun(['--path=bad/path/to/build'])).to.be.rejected.then((error) => { let expectedPath = path.resolve('bad/path/to/build'); expect(error.message).to.equal( `The path ${expectedPath} does not exist. Please specify a valid build directory to test.` @@ -179,9 +179,9 @@ describe('test command', function() { }); }); - describe('--server option', function() { + describe('--server option', function () { let buildCleanupWasCalled; - beforeEach(function() { + beforeEach(function () { buildCleanupWasCalled = false; options.Builder = CoreObject.extend({ cleanup() { @@ -193,74 +193,74 @@ describe('test command', function() { buildCommand(); }); - it('builds a watcher with verbose set to false', function() { + it('builds a watcher with verbose set to false', function () { return command .validateAndRun(['--server']) - .then(function() { + .then(function () { let captor = td.matchers.captor(); td.verify(tasks.TestServer.prototype.run(captor.capture())); expect(captor.value.watcher.verbose).to.be.false; }) - .finally(function() { + .finally(function () { expect(buildCleanupWasCalled).to.be.true; }); }); - it('builds a watcher with options.watcher set to value provided', function() { + it('builds a watcher with options.watcher set to value provided', function () { return command .validateAndRun(['--server', '--watcher=polling']) - .then(function() { + .then(function () { let captor = td.matchers.captor(); td.verify(tasks.TestServer.prototype.run(captor.capture())); expect(captor.value.watcher.options.watcher).to.equal('polling'); }) - .finally(function() { + .finally(function () { expect(buildCleanupWasCalled).to.be.true; }); }); - it('DOES NOT throw an error if using a build path', function() { + it('DOES NOT throw an error if using a build path', function () { expect(command.validateAndRun(['--server', '--path=tests'])).to.be.ok; }); }); - describe('_generateCustomConfigs', function() { + describe('_generateCustomConfigs', function () { let runOptions; - beforeEach(function() { + beforeEach(function () { buildCommand(); runOptions = {}; }); - it('should return an object even if passed param is empty object', function() { + it('should return an object even if passed param is empty object', function () { let result = command._generateCustomConfigs(runOptions); expect(result).to.be.an('object'); }); - it('when launch option is present, should be reflected in returned config', function() { + it('when launch option is present, should be reflected in returned config', function () { runOptions.launch = 'fooLauncher'; let result = command._generateCustomConfigs(runOptions); expect(result.launch).to.equal('fooLauncher'); }); - it('when query option is present, should be reflected in returned config', function() { + it('when query option is present, should be reflected in returned config', function () { runOptions.query = 'someQuery=test'; let result = command._generateCustomConfigs(runOptions); expect(result.queryString).to.equal(runOptions.query); }); - it('when provided test-page the new file returned contains the value in test_page', function() { + it('when provided test-page the new file returned contains the value in test_page', function () { runOptions['test-page'] = 'foo/test.html?foo'; let result = command._generateCustomConfigs(runOptions); expect(result.testPage).to.be.equal('foo/test.html?foo&'); }); - it('when provided test-page with filter, module, and query the new file returned contains those values in test_page', function() { + it('when provided test-page with filter, module, and query the new file returned contains those values in test_page', function () { runOptions.module = 'fooModule'; runOptions.filter = 'bar'; runOptions.query = 'someQuery=test'; @@ -270,7 +270,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('foo/test.html?foo&module=fooModule&filter=bar&someQuery=test'); }); - it('when provided test-page with filter and module the new file returned contains both option values in test_page', function() { + it('when provided test-page with filter and module the new file returned contains both option values in test_page', function () { runOptions.module = 'fooModule'; runOptions.filter = 'bar'; runOptions['test-page'] = 'foo/test.html?foo'; @@ -279,7 +279,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('foo/test.html?foo&module=fooModule&filter=bar'); }); - it('when provided test-page with filter and query the new file returned contains both option values in test_page', function() { + it('when provided test-page with filter and query the new file returned contains both option values in test_page', function () { runOptions.query = 'someQuery=test'; runOptions.filter = 'bar'; runOptions['test-page'] = 'foo/test.html?foo'; @@ -288,7 +288,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('foo/test.html?foo&filter=bar&someQuery=test'); }); - it('when provided test-page with module and query the new file returned contains both option values in test_page', function() { + it('when provided test-page with module and query the new file returned contains both option values in test_page', function () { runOptions.module = 'fooModule'; runOptions.query = 'someQuery=test'; runOptions['test-page'] = 'foo/test.html?foo'; @@ -297,14 +297,14 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('foo/test.html?foo&module=fooModule&someQuery=test'); }); - it('when provided launch the new file returned contains the value in launch', function() { + it('when provided launch the new file returned contains the value in launch', function () { runOptions.launch = 'fooLauncher'; let contents = command._generateCustomConfigs(runOptions); expect(contents['launch']).to.be.equal('fooLauncher'); }); - it('when provided filter is all lowercase to match the test name', function() { + it('when provided filter is all lowercase to match the test name', function () { runOptions['test-page'] = 'tests/index.html'; runOptions.filter = 'BAR'; let contents = command._generateCustomConfigs(runOptions); @@ -312,10 +312,10 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('tests/index.html?filter=bar'); }); - it('when module and filter option is present uses buildTestPageQueryString for test_page queryString', function() { + it('when module and filter option is present uses buildTestPageQueryString for test_page queryString', function () { runOptions.filter = 'bar'; runOptions['test-page'] = 'tests/index.html'; - command.buildTestPageQueryString = function(options) { + command.buildTestPageQueryString = function (options) { expect(options).to.deep.equal(runOptions); return 'blah=zorz'; @@ -326,7 +326,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('tests/index.html?blah=zorz'); }); - it('new file returned contains the filter option value in test_page', function() { + it('new file returned contains the filter option value in test_page', function () { runOptions.filter = 'foo'; runOptions['test-page'] = 'tests/index.html'; let contents = command._generateCustomConfigs(runOptions); @@ -334,7 +334,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('tests/index.html?filter=foo'); }); - it('adds with a `&` if query string contains `?` already', function() { + it('adds with a `&` if query string contains `?` already', function () { runOptions.filter = 'foo'; runOptions['test-page'] = 'tests/index.html?hidepassed'; let contents = command._generateCustomConfigs(runOptions); @@ -342,7 +342,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('tests/index.html?hidepassed&filter=foo'); }); - it('new file returned contains the module option value in test_page', function() { + it('new file returned contains the module option value in test_page', function () { runOptions.module = 'fooModule'; runOptions['test-page'] = 'tests/index.html'; let contents = command._generateCustomConfigs(runOptions); @@ -350,7 +350,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('tests/index.html?module=fooModule'); }); - it('new file returned contains the query option value in test_page', function() { + it('new file returned contains the query option value in test_page', function () { runOptions.query = 'someQuery=test'; runOptions['test-page'] = 'tests/index.html'; let contents = command._generateCustomConfigs(runOptions); @@ -358,7 +358,7 @@ describe('test command', function() { expect(contents.testPage).to.be.equal('tests/index.html?someQuery=test'); }); - it('new file returned contains the query option value with multiple queries in test_page', function() { + it('new file returned contains the query option value with multiple queries in test_page', function () { runOptions.query = 'someQuery=test&something&else=false'; runOptions['test-page'] = 'tests/index.html'; let contents = command._generateCustomConfigs(runOptions); diff --git a/tests/unit/commands/uninstall-npm-test.js b/tests/unit/commands/uninstall-npm-test.js index 0b295f933c..31333c3411 100644 --- a/tests/unit/commands/uninstall-npm-test.js +++ b/tests/unit/commands/uninstall-npm-test.js @@ -5,15 +5,15 @@ const MockProject = require('../../helpers/mock-project'); const commandOptions = require('../../factories/command-options'); const UninstallNpmCommand = require('../../../lib/commands/uninstall-npm'); -describe('uninstall:npm command', function() { +describe('uninstall:npm command', function () { let command; let msg = 'This command has been removed. Please use `npm uninstall ' + ' --save-dev` instead.'; - beforeEach(function() { + beforeEach(function () { let project = new MockProject(); - project.isEmberCLIProject = function() { + project.isEmberCLIProject = function () { return true; }; @@ -24,14 +24,14 @@ describe('uninstall:npm command', function() { command = new UninstallNpmCommand(options); }); - it('throws a friendly silent error with no args', function() { - return expect(command.validateAndRun([])).to.be.rejected.then(error => { + it('throws a friendly silent error with no args', function () { + return expect(command.validateAndRun([])).to.be.rejected.then((error) => { expect(error.message).to.equal(msg, 'expect error to have a helpful message'); }); }); - it('throws a friendly silent error with args', function() { - return expect(command.validateAndRun(['moment', 'lodash'])).to.be.rejected.then(error => { + it('throws a friendly silent error with args', function () { + return expect(command.validateAndRun(['moment', 'lodash'])).to.be.rejected.then((error) => { expect(error.message).to.equal(msg, 'expect error to have a helpful message'); }); }); diff --git a/tests/unit/commands/version-test.js b/tests/unit/commands/version-test.js index 8cccdbd58e..7e768ca20a 100644 --- a/tests/unit/commands/version-test.js +++ b/tests/unit/commands/version-test.js @@ -5,10 +5,10 @@ const EOL = require('os').EOL; const commandOptions = require('../../factories/command-options'); const VersionCommand = require('../../../lib/commands/version'); -describe('version command', function() { +describe('version command', function () { let options, command; - beforeEach(function() { + beforeEach(function () { options = commandOptions({ project: { isEmberCLIProject() { @@ -20,8 +20,8 @@ describe('version command', function() { command = new VersionCommand(options); }); - it('reports node, npm, and os versions', function() { - return command.validateAndRun().then(function() { + it('reports node, npm, and os versions', function () { + return command.validateAndRun().then(function () { let lines = options.ui.output.split(EOL); expect(someLineStartsWith(lines, 'ember-cli:'), 'contains the version of ember-cli').to.be.ok; expect(someLineStartsWith(lines, 'node:'), 'contains the version of node').to.be.ok; @@ -29,8 +29,8 @@ describe('version command', function() { }); }); - it('supports a --verbose flag', function() { - return command.validateAndRun(['--verbose']).then(function() { + it('supports a --verbose flag', function () { + return command.validateAndRun(['--verbose']).then(function () { let lines = options.ui.output.split(EOL); expect(someLineStartsWith(lines, 'node:'), 'contains the version of node').to.be.ok; expect(someLineStartsWith(lines, 'os:'), 'contains the version of os').to.be.ok; @@ -40,7 +40,7 @@ describe('version command', function() { }); function someLineStartsWith(lines, search) { - return lines.some(function(line) { + return lines.some(function (line) { return line.indexOf(search) === 0; }); } diff --git a/tests/unit/docs-lint-test.js b/tests/unit/docs-lint-test.js index a25ead32ab..e35c48ee83 100644 --- a/tests/unit/docs-lint-test.js +++ b/tests/unit/docs-lint-test.js @@ -11,8 +11,8 @@ if (!process.env['IS_CHILD']) { const execa = require('execa'); - describe('YUIDoc', function() { - it('parses without warnings', async function() { + describe('YUIDoc', function () { + it('parses without warnings', async function () { await execa('node', [`--unhandled-rejections=strict`, __filename], { env: { IS_CHILD: true, @@ -34,7 +34,7 @@ let yuiDoc = new Y.YUIDoc(options); let json = yuiDoc.run(); let warnings = {}; -json.warnings.forEach(function(warning) { +json.warnings.forEach(function (warning) { let tmp = warning.line.split(':'); let file = tmp[0].trim(); let line = tmp[1]; @@ -50,9 +50,9 @@ json.warnings.forEach(function(warning) { }); let message = ''; -Object.keys(warnings).forEach(function(file) { +Object.keys(warnings).forEach(function (file) { message += `\t${file} – YUIDoc issues found:${EOL}${EOL}`; - warnings[file].forEach(function(warning) { + warnings[file].forEach(function (warning) { message += `\t\tline ${warning.line}: ${warning.message}${EOL}`; }); }); diff --git a/tests/unit/errors/silent-test.js b/tests/unit/errors/silent-test.js index e87e6b5eec..7b83d7e946 100644 --- a/tests/unit/errors/silent-test.js +++ b/tests/unit/errors/silent-test.js @@ -3,8 +3,8 @@ const SilentError = require('silent-error'); const expect = require('chai').expect; -describe('SilentError', function() { - it('return silent-error and print a deprecation', function() { +describe('SilentError', function () { + it('return silent-error and print a deprecation', function () { const SilentErrorLib = require('../../../lib/errors/silent'); expect(SilentErrorLib, 'returns silent-error').to.equal(SilentError); }); diff --git a/tests/unit/experiments-test.js b/tests/unit/experiments-test.js index 1f087937e4..9128547de4 100644 --- a/tests/unit/experiments-test.js +++ b/tests/unit/experiments-test.js @@ -21,11 +21,11 @@ function resetProcessEnv(originalProcessEnv) { const ORIGINAL_CONSOLE = Object.assign({}, console); -describe('experiments', function() { - describe('isExperimentEnabled', function() { +describe('experiments', function () { + describe('isExperimentEnabled', function () { let originalProcessEnv, warnings; - beforeEach(function() { + beforeEach(function () { originalProcessEnv = Object.assign({}, process.env); // reset all experiment flags for these tests, they will be restored in @@ -34,16 +34,16 @@ describe('experiments', function() { delete process.env.EMBER_CLI_PACKAGER; warnings = []; - console.warn = warning => warnings.push(warning); + console.warn = (warning) => warnings.push(warning); }); - afterEach(function() { + afterEach(function () { resetProcessEnv(originalProcessEnv); Object.assign(console, ORIGINAL_CONSOLE); _deprecatedExperimentsDeprecationsIssued.length = 0; }); - it('should return true for all experiments when `EMBER_CLI_ENABLE_ALL_EXPERIMENTS` is set', function() { + it('should return true for all experiments when `EMBER_CLI_ENABLE_ALL_EXPERIMENTS` is set', function () { process.env.EMBER_CLI_ENABLE_ALL_EXPERIMENTS = true; expect(isExperimentEnabled('PACKAGER')).to.be.true; @@ -51,7 +51,7 @@ describe('experiments', function() { expect(warnings).to.deep.equal([]); }); - it('setting an already disabled feature to false does not enable it', function() { + it('setting an already disabled feature to false does not enable it', function () { process.env.EMBER_CLI_PACKAGER = 'false'; expect(isExperimentEnabled('PACKAGER')).to.be.false; diff --git a/tests/unit/models/addon-test.js b/tests/unit/models/addon-test.js index 5b39b6dfa1..4098150535 100644 --- a/tests/unit/models/addon-test.js +++ b/tests/unit/models/addon-test.js @@ -19,11 +19,11 @@ let tmproot = path.join(root, 'tmp'); let fixturePath = path.resolve(__dirname, '../../fixtures/addon'); -describe('models/addon.js', function() { +describe('models/addon.js', function () { let addon, project, projectPath; - describe('root property', function() { - it('is required', function() { + describe('root property', function () { + it('is required', function () { expect(() => { let TheAddon = Addon.extend({ root: undefined }); new TheAddon(); @@ -31,8 +31,8 @@ describe('models/addon.js', function() { }); }); - describe('old core object compat', function() { - it('treeGenerator works without .project', function() { + describe('old core object compat', function () { + it('treeGenerator works without .project', function () { let warning; let TheAddon = Addon.extend({ name: 'such name', @@ -49,10 +49,10 @@ describe('models/addon.js', function() { }); }); - describe('treePaths and treeForMethods', function() { + describe('treePaths and treeForMethods', function () { let FirstAddon, SecondAddon; - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(fixturePath, 'simple'); const packageContents = require(path.join(projectPath, 'package.json')); let cli = new MockCLI(); @@ -82,10 +82,10 @@ describe('models/addon.js', function() { }); }); - describe('.jshintAddonTree', function() { + describe('.jshintAddonTree', function () { let addon; - beforeEach(function() { + beforeEach(function () { addon = new FirstAddon(project, project); // TODO: fix config story... @@ -96,11 +96,11 @@ describe('models/addon.js', function() { }, }; - addon.jshintTrees = function() {}; + addon.jshintTrees = function () {}; }); - it('lints the files before preprocessing', function() { - addon.preprocessJs = function() { + it('lints the files before preprocessing', function () { + addon.preprocessJs = function () { throw new Error('should not preprocess files'); }; @@ -111,7 +111,7 @@ describe('models/addon.js', function() { }); }); - it('modifying a treePath does not affect other addons', function() { + it('modifying a treePath does not affect other addons', function () { let first = new FirstAddon(project); let second = new SecondAddon(project); @@ -119,7 +119,7 @@ describe('models/addon.js', function() { expect(second.treePaths.vendor).to.equal('blammo'); }); - it('modifying a treeForMethod does not affect other addons', function() { + it('modifying a treeForMethod does not affect other addons', function () { let first = new FirstAddon(project); let second = new SecondAddon(project); @@ -128,9 +128,9 @@ describe('models/addon.js', function() { }); }); - describe('initialized addon', function() { + describe('initialized addon', function () { this.timeout(40000); - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(fixturePath, 'simple'); const packageContents = require(path.join(projectPath, 'package.json')); let ui = new MockUI(); @@ -139,57 +139,57 @@ describe('models/addon.js', function() { project.initializeAddons(); }); - describe('generated addon', function() { - beforeEach(function() { + describe('generated addon', function () { + beforeEach(function () { addon = findWhere(project.addons, { name: 'ember-generated-with-export-addon' }); // Clear the caches delete addon._moduleName; }); - it('sets its project', function() { + it('sets its project', function () { expect(addon.project.name).to.equal(project.name); }); - it('sets its parent', function() { + it('sets its parent', function () { expect(addon.parent.name).to.equal(project.name); }); - it('sets the root', function() { + it('sets the root', function () { expect(addon.root).to.not.equal(undefined); }); - it('sets the pkg', function() { + it('sets the pkg', function () { expect(addon.pkg).to.not.equal(undefined); }); - describe('trees for its treePaths', function() { - it('app', function() { + describe('trees for its treePaths', function () { + it('app', function () { let tree = addon.treeFor('app'); expect(typeof (tree.read || tree.rebuild)).to.equal('function'); }); - it('styles', function() { + it('styles', function () { let tree = addon.treeFor('styles'); expect(typeof (tree.read || tree.rebuild)).to.equal('function'); }); - it('templates', function() { + it('templates', function () { let tree = addon.treeFor('templates'); expect(typeof (tree.read || tree.rebuild)).to.equal('function'); }); - it('addon-templates', function() { + it('addon-templates', function () { let tree = addon.treeFor('addon-templates'); expect(typeof (tree.read || tree.rebuild)).to.equal('function'); }); - it('vendor', function() { + it('vendor', function () { let tree = addon.treeFor('vendor'); expect(typeof (tree.read || tree.rebuild)).to.equal('function'); }); - it('addon', function() { + it('addon', function () { let app = { importWhitelist: {}, options: {}, @@ -216,38 +216,38 @@ describe('models/addon.js', function() { }); }); - describe('custom treeFor methods', function() { - it('can define treeForApp', function() { + describe('custom treeFor methods', function () { + it('can define treeForApp', function () { addon.treeForApp = td.function(); addon.treeFor('app'); td.verify(addon.treeForApp(), { ignoreExtraArgs: true }); }); - it('can define treeForStyles', function() { + it('can define treeForStyles', function () { addon.treeForStyles = td.function(); addon.treeFor('styles'); td.verify(addon.treeForStyles(), { ignoreExtraArgs: true }); }); - it('can define treeForVendor', function() { + it('can define treeForVendor', function () { addon.treeForVendor = td.function(); addon.treeFor('vendor'); td.verify(addon.treeForVendor(), { ignoreExtraArgs: true }); }); - it('can define treeForTemplates', function() { + it('can define treeForTemplates', function () { addon.treeForTemplates = td.function(); addon.treeFor('templates'); td.verify(addon.treeForTemplates(), { ignoreExtraArgs: true }); }); - it('can define treeForAddonTemplates', function() { + it('can define treeForAddonTemplates', function () { addon.treeForAddonTemplates = td.function(); addon.treeFor('addon-templates'); td.verify(addon.treeForAddonTemplates(), { ignoreExtraArgs: true }); }); - it('can define treeForPublic', function() { + it('can define treeForPublic', function () { addon.treeForPublic = td.function(); addon.treeFor('public'); td.verify(addon.treeForPublic(), { ignoreExtraArgs: true }); @@ -255,12 +255,12 @@ describe('models/addon.js', function() { }); }); - describe('addon with dependencies', function() { - beforeEach(function() { + describe('addon with dependencies', function () { + beforeEach(function () { addon = findWhere(project.addons, { name: 'ember-addon-with-dependencies' }); }); - it("returns a listing of all dependencies in the addon's package.json", function() { + it("returns a listing of all dependencies in the addon's package.json", function () { let expected = { 'ember-cli': 'latest', 'something-else': 'latest', @@ -270,7 +270,7 @@ describe('models/addon.js', function() { }); }); - it('must define a `name` property', function() { + it('must define a `name` property', function () { let Foo = Addon.extend({ root: 'foo' }); expect(() => { @@ -278,10 +278,10 @@ describe('models/addon.js', function() { }).to.throw(/An addon must define a `name` property./); }); - describe('isDevelopingAddon', function() { + describe('isDevelopingAddon', function () { let originalEnvValue, addon, project; - beforeEach(function() { + beforeEach(function () { let MyAddon = Addon.extend({ name: 'test-project', root: 'foo', @@ -298,7 +298,7 @@ describe('models/addon.js', function() { originalEnvValue = process.env.EMBER_ADDON_ENV; }); - afterEach(function() { + afterEach(function () { if (originalEnvValue === undefined) { delete process.env.EMBER_ADDON_ENV; } else { @@ -308,13 +308,13 @@ describe('models/addon.js', function() { delete process.env.EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH; }); - it('returns true when `EMBER_ADDON_ENV` is set to development', function() { + it('returns true when `EMBER_ADDON_ENV` is set to development', function () { process.env.EMBER_ADDON_ENV = 'development'; expect(addon.isDevelopingAddon(), 'addon is being developed').to.eql(true); }); - it('throws when the addon name is prefixed in package.json and not in index.js', function() { + it('throws when the addon name is prefixed in package.json and not in index.js', function () { process.env.EMBER_ADDON_ENV = 'development'; project.root = 'foo'; project.name = () => '@foo/my-addon'; @@ -322,7 +322,7 @@ describe('models/addon.js', function() { expect(() => addon.isDevelopingAddon()).to.throw(/Your names in package.json and index.js should match*/); }); - it('does not throw for a mismatched addon name when process.env.EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH is set', function() { + it('does not throw for a mismatched addon name when process.env.EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH is set', function () { process.env.EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH = 'true'; process.env.EMBER_ADDON_ENV = 'development'; project.root = 'foo'; @@ -331,7 +331,7 @@ describe('models/addon.js', function() { expect(addon.isDevelopingAddon()).to.eql(true); }); - it('throws an error if addon name is different in package.json and index.js ', function() { + it('throws an error if addon name is different in package.json and index.js ', function () { process.env.EMBER_ADDON_ENV = 'development'; project.root = 'foo'; project.name = () => 'foo-my-addon'; @@ -339,19 +339,19 @@ describe('models/addon.js', function() { expect(() => addon.isDevelopingAddon()).to.throw(/Your names in package.json and index.js should match*/); }); - it('returns false when `EMBER_ADDON_ENV` is not set', function() { + it('returns false when `EMBER_ADDON_ENV` is not set', function () { delete process.env.EMBER_ADDON_ENV; expect(addon.isDevelopingAddon()).to.eql(false); }); - it('returns false when `EMBER_ADDON_ENV` is something other than `development`', function() { + it('returns false when `EMBER_ADDON_ENV` is something other than `development`', function () { process.env.EMBER_ADDON_ENV = 'production'; expect(addon.isDevelopingAddon()).to.equal(false); }); - it('returns false when the addon is not the one being developed', function() { + it('returns false when the addon is not the one being developed', function () { process.env.EMBER_ADDON_ENV = 'development'; addon.name = 'my-addon'; @@ -359,20 +359,20 @@ describe('models/addon.js', function() { }); }); - describe('findOwnAddonByName', function() { + describe('findOwnAddonByName', function () { let ThisAddon = Addon.extend({ root: 'foo', name: 'this-addon', }); - it('it has the given addon', function() { + it('it has the given addon', function () { let addon = new ThisAddon(); let ownAddon = { name: 'my-cool-addon' }; addon.addons = [ownAddon]; expect(addon.findOwnAddonByName('my-cool-addon')).to.eql(ownAddon); }); - it('it does not have the given addon', function() { + it('it does not have the given addon', function () { let addon = new ThisAddon(); let ownAddon = { name: 'my-cool-addon' }; addon.addons = [ownAddon]; @@ -380,7 +380,7 @@ describe('models/addon.js', function() { }); }); - describe('hintingEnabled', function() { + describe('hintingEnabled', function () { /** Tests the various configuration options that affect the hintingEnabled method. @@ -396,7 +396,7 @@ describe('models/addon.js', function() { let originalEnvValue, originalEmberEnvValue, originalTestCommand, addon, project; - beforeEach(function() { + beforeEach(function () { let MyAddon = Addon.extend({ name: 'test-project', root: 'foo', @@ -415,7 +415,7 @@ describe('models/addon.js', function() { originalTestCommand = process.env.EMBER_CLI_TEST_COMMAND; }); - afterEach(function() { + afterEach(function () { addon.app = { options: {}, }; @@ -439,7 +439,7 @@ describe('models/addon.js', function() { } }); - it('returns true when `EMBER_ENV` is not set to production and options.hinting is true', function() { + it('returns true when `EMBER_ENV` is not set to production and options.hinting is true', function () { process.env.EMBER_ENV = 'development'; addon.app = { @@ -449,7 +449,7 @@ describe('models/addon.js', function() { expect(addon.hintingEnabled()).to.be.true; }); - it('returns true when `EMBER_CLI_TEST_COMMAND` is set and options.hinting is true', function() { + it('returns true when `EMBER_CLI_TEST_COMMAND` is set and options.hinting is true', function () { addon.app = { options: { hinting: true }, }; @@ -457,7 +457,7 @@ describe('models/addon.js', function() { expect(addon.hintingEnabled()).to.be.true; }); - it('returns false when `EMBER_ENV` is set to production, `EMBER_CLI_TEST_COMMAND` is unset and options.hinting is true', function() { + it('returns false when `EMBER_ENV` is set to production, `EMBER_CLI_TEST_COMMAND` is unset and options.hinting is true', function () { process.env.EMBER_ENV = 'production'; delete process.env.EMBER_CLI_TEST_COMMAND; @@ -468,7 +468,7 @@ describe('models/addon.js', function() { expect(addon.hintingEnabled()).to.be.false; }); - it('returns false when options.hinting is set to false', function() { + it('returns false when options.hinting is set to false', function () { addon.app = { options: { hinting: false }, }; @@ -476,14 +476,14 @@ describe('models/addon.js', function() { expect(addon.hintingEnabled()).to.be.false; }); - it('returns true when options.hinting is not set', function() { + it('returns true when options.hinting is not set', function () { expect(addon.hintingEnabled()).to.be.ok; }); }); - describe('treeGenerator', function() { - it('watch tree when developing the addon itself', function() { - addon.isDevelopingAddon = function() { + describe('treeGenerator', function () { + it('watch tree when developing the addon itself', function () { + addon.isDevelopingAddon = function () { return true; }; @@ -492,8 +492,8 @@ describe('models/addon.js', function() { expect(tree.__broccoliGetInfo__()).to.have.property('watched', true); }); - it('uses UnwatchedDir when not developing the addon itself', function() { - addon.isDevelopingAddon = function() { + it('uses UnwatchedDir when not developing the addon itself', function () { + addon.isDevelopingAddon = function () { return false; }; @@ -503,25 +503,25 @@ describe('models/addon.js', function() { }); }); - describe('blueprintsPath', function() { + describe('blueprintsPath', function () { let tmpdir; - beforeEach(async function() { + beforeEach(async function () { tmpdir = await mkTmpDirIn(tmproot); addon.root = tmpdir; }); - afterEach(function() { + afterEach(function () { return fs.remove(tmproot); }); - it('returns undefined if the `blueprint` folder does not exist', function() { + it('returns undefined if the `blueprint` folder does not exist', function () { let returnedPath = addon.blueprintsPath(); expect(returnedPath).to.equal(undefined); }); - it('returns blueprint path if the folder exists', function() { + it('returns blueprint path if the folder exists', function () { let blueprintsDir = path.join(tmpdir, 'blueprints'); fs.mkdirSync(blueprintsDir); @@ -531,15 +531,15 @@ describe('models/addon.js', function() { }); }); - describe('config', function() { - it('returns undefined if `config/environment.js` does not exist', function() { + describe('config', function () { + it('returns undefined if `config/environment.js` does not exist', function () { addon.root = path.join(fixturePath, 'no-config'); let result = addon.config(); expect(result).to.equal(undefined); }); - it('returns blueprint path if the folder exists', function() { + it('returns blueprint path if the folder exists', function () { addon.root = path.join(fixturePath, 'with-config'); let appConfig = {}; @@ -550,8 +550,8 @@ describe('models/addon.js', function() { }); }); - describe('compileTemplates', function() { - beforeEach(function() { + describe('compileTemplates', function () { + beforeEach(function () { projectPath = path.resolve(fixturePath, 'simple'); const packageContents = require(path.join(projectPath, 'package.json')); let cli = new MockCLI(); @@ -563,7 +563,7 @@ describe('models/addon.js', function() { addon = findWhere(project.addons, { name: 'ember-generated-with-export-addon' }); }); - it('should not throw an error if addon/templates is present but empty', function() { + it('should not throw an error if addon/templates is present but empty', function () { addon.root = path.join(fixturePath, 'with-empty-addon-templates'); expect(() => { @@ -572,8 +572,8 @@ describe('models/addon.js', function() { }); }); - describe('_fileSystemInfo', function() { - beforeEach(function() { + describe('_fileSystemInfo', function () { + beforeEach(function () { projectPath = path.resolve(fixturePath, 'simple'); const packageContents = require(path.join(projectPath, 'package.json')); let cli = new MockCLI(); @@ -585,9 +585,9 @@ describe('models/addon.js', function() { addon = findWhere(project.addons, { name: 'ember-generated-with-export-addon' }); }); - it('should not call _getAddonTemplatesTreeFiles when default treePath is used', function() { + it('should not call _getAddonTemplatesTreeFiles when default treePath is used', function () { let wasCalled = false; - addon._getAddonTemplatesTreeFiles = function() { + addon._getAddonTemplatesTreeFiles = function () { wasCalled = true; return []; }; @@ -597,10 +597,10 @@ describe('models/addon.js', function() { expect(wasCalled).to.not.be.ok; }); - it("should call _getAddonTemplatesTreeFiles when custom treePaths['addon-templates'] is used", function() { + it("should call _getAddonTemplatesTreeFiles when custom treePaths['addon-templates'] is used", function () { addon.treePaths['addon-templates'] = 'foo'; let wasCalled = false; - addon._getAddonTemplatesTreeFiles = function() { + addon._getAddonTemplatesTreeFiles = function () { wasCalled = true; return []; }; @@ -610,8 +610,8 @@ describe('models/addon.js', function() { expect(wasCalled).to.be.ok; }); - it('hasPodTemplates when pod templates found', function() { - addon._getAddonTreeFiles = function() { + it('hasPodTemplates when pod templates found', function () { + addon._getAddonTreeFiles = function () { return ['foo-bar/', 'foo-bar/component.js', 'foo-bar/template.hbs']; }; @@ -622,8 +622,8 @@ describe('models/addon.js', function() { }); }); - it('does not hasPodTemplates when no pod templates found', function() { - addon._getAddonTreeFiles = function() { + it('does not hasPodTemplates when no pod templates found', function () { + addon._getAddonTreeFiles = function () { return ['templates/', 'templates/components/', 'templates/components/foo-bar.hbs']; }; @@ -634,8 +634,8 @@ describe('models/addon.js', function() { }); }); - it('does not hasPodTemplates when no pod templates found (pod-like structure in `addon/templates/`)', function() { - addon._getAddonTreeFiles = function() { + it('does not hasPodTemplates when no pod templates found (pod-like structure in `addon/templates/`)', function () { + addon._getAddonTreeFiles = function () { return [ 'templates/', // this doesn't need "pod template handling" because @@ -651,8 +651,8 @@ describe('models/addon.js', function() { }); }); - it('does not hasTemplates when no templates found', function() { - addon._getAddonTreeFiles = function() { + it('does not hasTemplates when no templates found', function () { + addon._getAddonTreeFiles = function () { return ['components/', 'components/foo-bar.js', 'templates/', 'templates/components/']; }; @@ -663,8 +663,8 @@ describe('models/addon.js', function() { }); }); - it('does not hasJSFiles when none found', function() { - addon._getAddonTreeFiles = function() { + it('does not hasJSFiles when none found', function () { + addon._getAddonTreeFiles = function () { return ['components/', 'templates/', 'templates/components/', 'styles/foo.css']; }; @@ -676,10 +676,10 @@ describe('models/addon.js', function() { }); }); - describe('packageInfoCache', function() { + describe('packageInfoCache', function () { let packageInfoCache, addon, ui; - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(fixturePath, 'simple'); const packageContents = require(path.join(projectPath, 'package.json')); @@ -696,15 +696,15 @@ describe('models/addon.js', function() { packageInfoCache = addon.packageInfoCache; }); - it("is provided with the parent's `packageInfoCache` object", function() { + it("is provided with the parent's `packageInfoCache` object", function () { expect(packageInfoCache).to.equal(project.packageInfoCache); }); }); - describe('treeForStyles', function() { + describe('treeForStyles', function () { let builder, addon; - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(fixturePath, 'with-app-styles'); const packageContents = require(path.join(projectPath, 'package.json')); let cli = new MockCLI(); @@ -719,13 +719,13 @@ describe('models/addon.js', function() { addon = new BaseAddon(project, project); }); - afterEach(function() { + afterEach(function () { if (builder) { return builder.cleanup(); } }); - it('should move files in the root of the addons app/styles tree into the app/styles path', async function() { + it('should move files in the root of the addons app/styles tree into the app/styles path', async function () { builder = new broccoli.Builder(addon.treeFor('styles')); let results = await builder.build(); @@ -737,8 +737,8 @@ describe('models/addon.js', function() { }); }); - describe('._eachProjectAddonInvoke', function() { - beforeEach(function() { + describe('._eachProjectAddonInvoke', function () { + beforeEach(function () { let MyAddon = Addon.extend({ name: 'test-project', root: 'foo', @@ -752,7 +752,7 @@ describe('models/addon.js', function() { addon = new MyAddon(project, project); }); - it('should invoke the method on each of the project addons', function() { + it('should invoke the method on each of the project addons', function () { let counter = 0; project.addons = [ { @@ -771,7 +771,7 @@ describe('models/addon.js', function() { expect(counter).to.eql(2); }); - it('should provide default arguments if none are specified', function() { + it('should provide default arguments if none are specified', function () { let counter = 0; project.addons = [ { @@ -791,7 +791,7 @@ describe('models/addon.js', function() { }); }); - describe('addon tree caching', function() { + describe('addon tree caching', function () { let projectPath = path.resolve(fixturePath, 'simple'); const packageContents = require(path.join(projectPath, 'package.json')); @@ -801,8 +801,8 @@ describe('models/addon.js', function() { return new Addon(project, project); } - describe('cacheKeyForTree', function() { - it('returns null if `treeForApp` methods are implemented for the app tree', function() { + describe('cacheKeyForTree', function () { + it('returns null if `treeForApp` methods are implemented for the app tree', function () { let addon = createAddon( Addon.extend({ name: 'test-project', @@ -814,7 +814,7 @@ describe('models/addon.js', function() { expect(addon.cacheKeyForTree('app')).to.equal(null); }); - it('returns null if `compileAddon` methods are implemented for the addon tree', function() { + it('returns null if `compileAddon` methods are implemented for the addon tree', function () { let addon = createAddon( Addon.extend({ name: 'test-project', @@ -826,7 +826,7 @@ describe('models/addon.js', function() { expect(addon.cacheKeyForTree('addon')).to.equal(null); }); - it('returns null if `treeForMethods` is modified', function() { + it('returns null if `treeForMethods` is modified', function () { let addon = createAddon( Addon.extend({ name: 'test-project', @@ -842,7 +842,7 @@ describe('models/addon.js', function() { expect(addon.cacheKeyForTree('app')).to.equal(null); }); - it('returns stable value for repeated invocations', function() { + it('returns stable value for repeated invocations', function () { let addon = createAddon( Addon.extend({ name: 'test-project', @@ -857,8 +857,8 @@ describe('models/addon.js', function() { }); }); - describe('treeFor caching', function() { - it('defining custom treeForAddon without modifying cacheKeyForTree does not cache', function() { + describe('treeFor caching', function () { + it('defining custom treeForAddon without modifying cacheKeyForTree does not cache', function () { let addon = createAddon( Addon.extend({ name: 'test-project', @@ -875,7 +875,7 @@ describe('models/addon.js', function() { expect(firstTree).not.to.equal(secondTree); }); - it('defining custom cacheKeyForTree allows addon control of cache', function() { + it('defining custom cacheKeyForTree allows addon control of cache', function () { let addonProto = { name: 'test-project', root: path.join(projectPath, 'node_modules', 'ember-generated-with-export-addon'), @@ -883,7 +883,7 @@ describe('models/addon.js', function() { return tree; }, }; - addonProto.cacheKeyForTree = function(type) { + addonProto.cacheKeyForTree = function (type) { return type; }; diff --git a/tests/unit/models/asset-size-printer-test.js b/tests/unit/models/asset-size-printer-test.js index ef97dd3864..f6b5861fe4 100644 --- a/tests/unit/models/asset-size-printer-test.js +++ b/tests/unit/models/asset-size-printer-test.js @@ -14,7 +14,7 @@ const chaiAsPromised = require('chai-as-promised'); chai.use(chaiAsPromised); -describe('models/asset-size-printer', function() { +describe('models/asset-size-printer', function () { let storedTmpDir, assetDir, assetChildDir; function writeFiles() { @@ -36,8 +36,8 @@ describe('models/asset-size-printer', function() { }); } - beforeEach(function() { - return mkTmpDirIn(tmpRoot).then(function(tmpdir) { + beforeEach(function () { + return mkTmpDirIn(tmpRoot).then(function (tmpdir) { storedTmpDir = tmpdir; assetDir = path.join(storedTmpDir, 'assets'); assetChildDir = path.join(assetDir, 'childDir'); @@ -49,17 +49,17 @@ describe('models/asset-size-printer', function() { }); }); - afterEach(function() { + afterEach(function () { return fs.remove(storedTmpDir); }); - it('prints human-readable file sizes (including gzipped sizes) of css and js files in the output path', function() { + it('prints human-readable file sizes (including gzipped sizes) of css and js files in the output path', function () { let sizePrinter = new AssetSizePrinter({ ui: new MockUi(), outputPath: storedTmpDir, }); - return sizePrinter.print().then(function() { + return sizePrinter.print().then(function () { expect(sizePrinter.ui.output).to.include('File sizes:'); expect(sizePrinter.ui.output).to.include('some-project.css: '); expect(sizePrinter.ui.output).to.include('some-project.js: '); @@ -70,24 +70,24 @@ describe('models/asset-size-printer', function() { }); }); - it('does not print gzipped file sizes of empty files', function() { + it('does not print gzipped file sizes of empty files', function () { let sizePrinter = new AssetSizePrinter({ ui: new MockUi(), outputPath: storedTmpDir, }); - return sizePrinter.print().then(function() { + return sizePrinter.print().then(function () { expect(sizePrinter.ui.output).to.not.include('0 B gzipped)'); }); }); - it('does not print project test helper file sizes', function() { + it('does not print project test helper file sizes', function () { let sizePrinter = new AssetSizePrinter({ ui: new MockUi(), outputPath: storedTmpDir, }); - return sizePrinter.print().then(function() { + return sizePrinter.print().then(function () { expect(sizePrinter.ui.output).to.not.include('test-loader'); expect(sizePrinter.ui.output).to.not.include('test-support'); expect(sizePrinter.ui.output).to.not.include('testem'); @@ -95,26 +95,26 @@ describe('models/asset-size-printer', function() { }); }); - it('does not print non-css or js file sizes', function() { + it('does not print non-css or js file sizes', function () { let sizePrinter = new AssetSizePrinter({ ui: new MockUi(), outputPath: storedTmpDir, }); - return sizePrinter.print().then(function() { + return sizePrinter.print().then(function () { expect(sizePrinter.ui.output).to.not.include('some-project.scss'); expect(sizePrinter.ui.output).to.not.include('some-project.css4'); expect(sizePrinter.ui.output).to.not.include('some-project.json'); }); }); - it('can print out to JSON', function() { + it('can print out to JSON', function () { let sizePrinter = new AssetSizePrinter({ ui: new MockUi(), outputPath: storedTmpDir, }); - return sizePrinter.printJSON().then(function() { + return sizePrinter.printJSON().then(function () { let output = JSON.parse(sizePrinter.ui.output); expect(output.files[0].name).to.include('nested-asset.css'); @@ -125,14 +125,14 @@ describe('models/asset-size-printer', function() { }); }); - it('creates an array of asset objects', function() { + it('creates an array of asset objects', function () { let assetObjectKeys; let sizePrinter = new AssetSizePrinter({ ui: new MockUi(), outputPath: storedTmpDir, }); - return sizePrinter.makeAssetSizesObject().then(function(assetObject) { + return sizePrinter.makeAssetSizesObject().then(function (assetObject) { assetObjectKeys = Object.keys(assetObject[0]); expect(assetObjectKeys).to.deep.equal(['name', 'size', 'gzipSize', 'showGzipped']); @@ -145,7 +145,7 @@ describe('models/asset-size-printer', function() { }); }); - it('prints an error when no files are found', function() { + it('prints an error when no files are found', function () { let outputPath = path.join('path', 'that', 'does', 'not', 'exist'); let sizePrinter = new AssetSizePrinter({ ui: new MockUi(), diff --git a/tests/unit/models/blueprint-test.js b/tests/unit/models/blueprint-test.js index 0c4a075352..4593a9d275 100644 --- a/tests/unit/models/blueprint-test.js +++ b/tests/unit/models/blueprint-test.js @@ -9,13 +9,13 @@ const td = require('testdouble'); let Blueprint = require('../../../lib/models/blueprint'); -describe('Blueprint', function() { - afterEach(function() { +describe('Blueprint', function () { + afterEach(function () { td.reset(); }); - describe('.mapFile', function() { - it('replaces all occurrences of __name__ with module name', function() { + describe('.mapFile', function () { + it('replaces all occurrences of __name__ with module name', function () { let path = Blueprint.prototype.mapFile('__name__/__name__-controller.js', { dasherizedModuleName: 'my-blueprint', }); @@ -28,7 +28,7 @@ describe('Blueprint', function() { expect(path).to.equal('my-blueprint/my-blueprint.js'); }); - it('accepts locals.fileMap with multiple mappings', function() { + it('accepts locals.fileMap with multiple mappings', function () { let locals = {}; locals.fileMap = { __name__: 'user', @@ -45,24 +45,24 @@ describe('Blueprint', function() { }); }); - describe('.list', function() { - beforeEach(function() { - td.replace(Blueprint, '_existsSync', function(path) { + describe('.list', function () { + beforeEach(function () { + td.replace(Blueprint, '_existsSync', function (path) { return path.indexOf('package.json') === -1; }); td.replace(Blueprint, 'defaultLookupPaths'); td.when(Blueprint.defaultLookupPaths()).thenReturn([]); - td.replace(Blueprint, 'load', function(blueprintPath) { + td.replace(Blueprint, 'load', function (blueprintPath) { return { name: path.basename(blueprintPath), }; }); }); - it('returns a list of blueprints grouped by lookup path', function() { - td.replace(Blueprint, '_readdirSync', function() { + it('returns a list of blueprints grouped by lookup path', function () { + td.replace(Blueprint, '_readdirSync', function () { return ['test1', 'test2']; }); @@ -83,8 +83,8 @@ describe('Blueprint', function() { }); }); - it('overrides a blueprint of the same name from another package', function() { - td.replace(Blueprint, '_readdirSync', function() { + it('overrides a blueprint of the same name from another package', function () { + td.replace(Blueprint, '_readdirSync', function () { return ['test2']; }); @@ -113,21 +113,21 @@ describe('Blueprint', function() { }); }); - describe('help', function() { + describe('help', function () { let blueprint; - beforeEach(function() { + beforeEach(function () { blueprint = new Blueprint('path/to/my-blueprint'); }); - describe('printBasicHelp', function() { - beforeEach(function() { + describe('printBasicHelp', function () { + beforeEach(function () { td.replace(blueprint, '_printCommand', td.function()); td.replace(blueprint, 'printDetailedHelp', td.function()); td.when(blueprint.printDetailedHelp(), { ignoreExtraArgs: true }).thenReturn('help in detail'); }); - it('handles overridden', function() { + it('handles overridden', function () { Object.assign(blueprint, { overridden: true, }); @@ -142,7 +142,7 @@ describe('Blueprint', function() { td.verify(blueprint._printCommand(), { times: 0 }); }); - it('calls printCommand', function() { + it('calls printCommand', function () { td.when(blueprint._printCommand(), { ignoreExtraArgs: true }).thenReturn(' command printed'); let output = blueprint.printBasicHelp(); @@ -153,7 +153,7 @@ describe('Blueprint', function() { expect(output).to.equal(testString); }); - it('prints detailed help if verbose', function() { + it('prints detailed help if verbose', function () { td.when(blueprint._printCommand(), { ignoreExtraArgs: true }).thenReturn(' command printed'); let availableOptions = []; @@ -171,9 +171,9 @@ help in detail`); }); }); - describe('printDetailedHelp', function() { - it('did not find the file', function() { - td.replace(Blueprint, '_existsSync', function() { + describe('printDetailedHelp', function () { + it('did not find the file', function () { + td.replace(Blueprint, '_existsSync', function () { return false; }); @@ -185,12 +185,12 @@ help in detail`); td.verify(MarkdownColor.prototype.renderFile(), { ignoreExtraArgs: true, times: 0 }); }); - it('found the file', function() { - td.replace(Blueprint, '_existsSync', function() { + it('found the file', function () { + td.replace(Blueprint, '_existsSync', function () { return true; }); - td.replace(MarkdownColor.prototype, 'renderFile', function() { + td.replace(MarkdownColor.prototype, 'renderFile', function () { expect(arguments[1].indent).to.equal(' '); return 'test-file'; }); @@ -201,12 +201,12 @@ help in detail`); }); }); - describe('getJson', function() { - beforeEach(function() { + describe('getJson', function () { + beforeEach(function () { blueprint._printableProperties = ['test1', 'availableOptions']; }); - it('iterates options', function() { + it('iterates options', function () { let availableOptions = [ { type: 'my-string-type', @@ -238,7 +238,7 @@ help in detail`); }); }); - it('does not print detailed if not verbose', function() { + it('does not print detailed if not verbose', function () { td.replace(blueprint, 'printDetailedHelp', td.function()); blueprint.getJson(); @@ -246,7 +246,7 @@ help in detail`); td.verify(blueprint.printDetailedHelp(), { ignoreExtraArgs: true, times: 0 }); }); - it('is calling printDetailedHelp with availableOptions', function() { + it('is calling printDetailedHelp with availableOptions', function () { td.replace(blueprint, 'printDetailedHelp', td.function()); let availableOptions = []; @@ -259,7 +259,7 @@ help in detail`); td.verify(blueprint.printDetailedHelp(availableOptions)); }); - it("if printDetailedHelp returns falsy, don't attach property detailedHelp", function() { + it("if printDetailedHelp returns falsy, don't attach property detailedHelp", function () { td.replace(blueprint, 'printDetailedHelp', td.function()); let json = blueprint.getJson(true); @@ -268,7 +268,7 @@ help in detail`); expect(json).to.not.have.property('detailedHelp'); }); - it('sets detailedHelp properly', function() { + it('sets detailedHelp properly', function () { td.replace(blueprint, 'printDetailedHelp', td.function()); td.when(blueprint.printDetailedHelp(), { ignoreExtraArgs: true }).thenReturn('some details'); diff --git a/tests/unit/models/builder-test.js b/tests/unit/models/builder-test.js index e4d8d6681b..d3b9491fd0 100644 --- a/tests/unit/models/builder-test.js +++ b/tests/unit/models/builder-test.js @@ -18,7 +18,7 @@ let tmpRoot = path.join(root, 'tmp'); let Builder; -describe('models/builder.js', function() { +describe('models/builder.js', function () { let addon, builder, buildResults, tmpdir; function setupBroccoliBuilder() { @@ -40,7 +40,7 @@ describe('models/builder.js', function() { }; } - before(function() { + before(function () { let willInterruptProcess = require('../../../lib/utilities/will-interrupt-process'); td.replace(willInterruptProcess, 'addHandler', td.function()); td.replace(willInterruptProcess, 'removeHandler', td.function()); @@ -48,14 +48,14 @@ describe('models/builder.js', function() { Builder = require('../../../lib/models/builder'); }); - afterEach(function() { + afterEach(function () { if (builder) { return builder.cleanup(); } }); - describe('copyToOutputPath', function() { - beforeEach(async function() { + describe('copyToOutputPath', function () { + beforeEach(async function () { tmpdir = await mkTmpDirIn(tmpRoot); let project = new MockProject(); builder = new Builder({ @@ -65,22 +65,22 @@ describe('models/builder.js', function() { }); }); - afterEach(function() { + afterEach(function () { return fs.remove(tmpRoot); }); - it('allows for non-existent output-paths at arbitrary depth', function() { + it('allows for non-existent output-paths at arbitrary depth', function () { builder.outputPath = path.join(tmpdir, 'some', 'path', 'that', 'does', 'not', 'exist'); builder.copyToOutputPath('tests/fixtures/blueprints/basic_2'); expect(file(path.join(builder.outputPath, 'files', 'foo.txt'))).to.exist; }); - describe('build command', function() { + describe('build command', function () { let command; let parentPath = `..${path.sep}..${path.sep}`; - beforeEach(function() { + beforeEach(function () { command = new BuildCommand(commandOptions()); let project = new MockProject(); @@ -91,7 +91,7 @@ describe('models/builder.js', function() { }); }); - it('when outputPath is root directory ie., `--output-path=/` or `--output-path=C:`', function() { + it('when outputPath is root directory ie., `--output-path=/` or `--output-path=C:`', function () { let outputPathArg = '--output-path=.'; let outputPath = command.parseArgs([outputPathArg]).options.outputPath; outputPath = outputPath.split(path.sep)[0] + path.sep; @@ -100,7 +100,7 @@ describe('models/builder.js', function() { expect(builder.canDeleteOutputPath(outputPath)).to.equal(false); }); - it('when outputPath is project root ie., `--output-path=.`', function() { + it('when outputPath is project root ie., `--output-path=.`', function () { let outputPathArg = '--output-path=.'; let outputPath = command.parseArgs([outputPathArg]).options.outputPath; builder.outputPath = outputPath; @@ -108,7 +108,7 @@ describe('models/builder.js', function() { expect(builder.canDeleteOutputPath(outputPath)).to.equal(false); }); - it(`when outputPath is a parent directory ie., \`--output-path=${parentPath}\``, function() { + it(`when outputPath is a parent directory ie., \`--output-path=${parentPath}\``, function () { let outputPathArg = `--output-path=${parentPath}`; let outputPath = command.parseArgs([outputPathArg]).options.outputPath; builder.outputPath = outputPath; @@ -116,7 +116,7 @@ describe('models/builder.js', function() { expect(builder.canDeleteOutputPath(outputPath)).to.equal(false); }); - it('allow outputPath to contain the root path as a substring, as long as it is not a parent', function() { + it('allow outputPath to contain the root path as a substring, as long as it is not a parent', function () { let outputPathArg = '--output-path=.'; let outputPath = command.parseArgs([outputPathArg]).options.outputPath; outputPath = outputPath.substr(0, outputPath.length - 1); @@ -127,12 +127,12 @@ describe('models/builder.js', function() { }); }); - describe('build', function() { + describe('build', function () { let instrumentationStart; let instrumentationStop; let cwd, project; - beforeEach(function() { + beforeEach(function () { // Cache cwd to reset after test cwd = process.cwd(); project = new MockProject(); @@ -149,7 +149,7 @@ describe('models/builder.js', function() { instrumentationStop = td.replace(builder.project._instrumentation, 'stopAndReport'); }); - afterEach(function() { + afterEach(function () { process.chdir(cwd); delete process._heimdall; delete process.env.BROCCOLI_VIZ; @@ -159,13 +159,13 @@ describe('models/builder.js', function() { } }); - it('calls instrumentation.start', async function() { + it('calls instrumentation.start', async function () { let mockAnnotation = 'MockAnnotation'; await builder.build(null, mockAnnotation); td.verify(instrumentationStart('build'), { times: 1 }); }); - it('calls instrumentation.stop(build, result, resultAnnotation)', async function() { + it('calls instrumentation.stop(build, result, resultAnnotation)', async function () { let mockAnnotation = 'MockAnnotation'; await builder.build(null, mockAnnotation); @@ -176,7 +176,7 @@ describe('models/builder.js', function() { ); }); - it('prints a deprecation warning if it discovers a < v0.1.4 version of heimdalljs', async function() { + it('prints a deprecation warning if it discovers a < v0.1.4 version of heimdalljs', async function () { process._heimdall = {}; await builder.build(); @@ -185,7 +185,7 @@ describe('models/builder.js', function() { expect(output).to.include('Heimdalljs < 0.1.4 found. Please remove old versions'); }); - it('does not print a deprecation warning if it does not discover a < v0.1.4 version of heimdalljs', async function() { + it('does not print a deprecation warning if it does not discover a < v0.1.4 version of heimdalljs', async function () { expect(process._heimdall).to.equal(undefined); await builder.build(); @@ -194,7 +194,7 @@ describe('models/builder.js', function() { expect(output).to.not.include('Heimdalljs < 0.1.4 found. Please remove old versions'); }); - it('writes temp files to Broccoli temp dir', async function() { + it('writes temp files to Broccoli temp dir', async function () { const project = new MockProject(); project.root += '/tests/fixtures/build/simple'; expect(fs.existsSync(`${builder.project.root}/tmp`)).to.be.false; @@ -214,7 +214,7 @@ describe('models/builder.js', function() { rimraf.sync(result.directory); }); - it('produces the correct output', async function() { + it('produces the correct output', async function () { const project = new MockProject(); project.root += '/tests/fixtures/build/simple'; const setup = () => @@ -231,7 +231,7 @@ describe('models/builder.js', function() { expect(fixturify.readSync(result.directory)).to.deep.equal(fixturify.readSync(`${project.root}/dist`)); }); - it('returns {directory, graph} as the result object', async function() { + it('returns {directory, graph} as the result object', async function () { const project = new MockProject(); project.root += '/tests/fixtures/build/simple'; @@ -251,8 +251,8 @@ describe('models/builder.js', function() { }); }); - describe('cleanup', function() { - beforeEach(function() { + describe('cleanup', function () { + beforeEach(function () { let project = new MockProject(); builder = new Builder({ project, @@ -261,9 +261,9 @@ describe('models/builder.js', function() { }); }); - it('is idempotent', async function() { + it('is idempotent', async function () { let cleanupCount = 0; - builder.builder.cleanup = function() { + builder.builder.cleanup = function () { cleanupCount++; }; @@ -275,10 +275,10 @@ describe('models/builder.js', function() { }); }); - describe('addons', function() { + describe('addons', function () { let hooksCalled; - beforeEach(function() { + beforeEach(function () { hooksCalled = []; addon = { name: 'TestAddon', @@ -331,26 +331,26 @@ describe('models/builder.js', function() { }; }); - afterEach(function() { + afterEach(function () { delete process.env.BROCCOLI_VIZ; delete process.env.EMBER_CLI_INSTRUMENTATION; }); - it('allows addons to add promises preBuild', function() { + it('allows addons to add promises preBuild', function () { let preBuild = td.replace(addon, 'preBuild', td.function()); td.when(preBuild(), { ignoreExtraArgs: true, times: 1 }).thenReturn(Promise.resolve()); return builder.build(); }); - it('allows addons to add promises postBuild', async function() { + it('allows addons to add promises postBuild', async function () { let postBuild = td.replace(addon, 'postBuild', td.function()); await builder.build(); td.verify(postBuild(buildResults), { times: 1 }); }); - it('allows addons to add promises outputReady', async function() { + it('allows addons to add promises outputReady', async function () { let outputReady = td.replace(addon, 'outputReady', td.function()); await builder.build(); @@ -359,13 +359,13 @@ describe('models/builder.js', function() { td.verify(outputReady(expected), { times: 1 }); }); - describe('instrumentation hooks', function() { - beforeEach(function() { + describe('instrumentation hooks', function () { + beforeEach(function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; }); - it('invokes the instrumentation hook if it is preset', async function() { - addon.instrumentation = function() { + it('invokes the instrumentation hook if it is preset', async function () { + addon.instrumentation = function () { hooksCalled.push('instrumentation'); }; @@ -374,19 +374,19 @@ describe('models/builder.js', function() { }); }); - it('hooks are called in the right order without visualization', async function() { + it('hooks are called in the right order without visualization', async function () { await builder.build(); expect(hooksCalled).to.deep.equal(['preBuild', 'build', 'postBuild', 'outputReady']); }); - it('should call postBuild before copying to dist', async function() { + it('should call postBuild before copying to dist', async function () { let called = []; - addon.postBuild = function() { + addon.postBuild = function () { called.push('postBuild'); }; - builder.copyToOutputPath = function() { + builder.copyToOutputPath = function () { called.push('copyToOutputPath'); }; @@ -394,14 +394,14 @@ describe('models/builder.js', function() { expect(called).to.deep.equal(['postBuild', 'copyToOutputPath']); }); - it('should call outputReady after copying to output path', async function() { + it('should call outputReady after copying to output path', async function () { let called = []; - builder.copyToOutputPath = function() { + builder.copyToOutputPath = function () { called.push('copyToOutputPath'); }; - addon.outputReady = function() { + addon.outputReady = function () { called.push('outputReady'); }; @@ -409,15 +409,15 @@ describe('models/builder.js', function() { expect(called).to.deep.equal(['copyToOutputPath', 'outputReady']); }); - it('buildError receives the error object from the errored step', async function() { + it('buildError receives the error object from the errored step', async function () { let thrownBuildError = new Error('buildError'); let receivedBuildError; - addon.buildError = function(errorThrown) { + addon.buildError = function (errorThrown) { receivedBuildError = errorThrown; }; - builder.builder.build = function() { + builder.builder.build = function () { hooksCalled.push('build'); return Promise.reject(thrownBuildError); @@ -427,8 +427,8 @@ describe('models/builder.js', function() { expect(receivedBuildError).to.equal(thrownBuildError); }); - it('calls buildError and does not call build, postBuild or outputReady when preBuild fails', async function() { - addon.preBuild = function() { + it('calls buildError and does not call build, postBuild or outputReady when preBuild fails', async function () { + addon.preBuild = function () { hooksCalled.push('preBuild'); return Promise.reject(new Error('preBuild Error')); @@ -438,8 +438,8 @@ describe('models/builder.js', function() { expect(hooksCalled).to.deep.equal(['preBuild', 'buildError']); }); - it('calls buildError and does not call postBuild or outputReady when build fails', async function() { - builder.builder.build = function() { + it('calls buildError and does not call postBuild or outputReady when build fails', async function () { + builder.builder.build = function () { hooksCalled.push('build'); return Promise.reject(new Error('build Error')); @@ -449,8 +449,8 @@ describe('models/builder.js', function() { expect(hooksCalled).to.deep.equal(['preBuild', 'build', 'buildError']); }); - it('calls buildError when postBuild fails', async function() { - addon.postBuild = function() { + it('calls buildError when postBuild fails', async function () { + addon.postBuild = function () { hooksCalled.push('postBuild'); return Promise.reject(new Error('preBuild Error')); @@ -460,8 +460,8 @@ describe('models/builder.js', function() { expect(hooksCalled).to.deep.equal(['preBuild', 'build', 'postBuild', 'buildError']); }); - it('calls buildError when outputReady fails', async function() { - addon.outputReady = function() { + it('calls buildError when outputReady fails', async function () { + addon.outputReady = function () { hooksCalled.push('outputReady'); return Promise.reject(new Error('outputReady Error')); @@ -472,8 +472,8 @@ describe('models/builder.js', function() { }); }); - describe('fallback from broccoli 2 to broccoli-builder', function() { - it('falls back to broccoli-builder if an InvalidNode error is thrown for read/rebuild api', function() { + describe('fallback from broccoli 2 to broccoli-builder', function () { + it('falls back to broccoli-builder if an InvalidNode error is thrown for read/rebuild api', function () { let project = new MockProject(); const builder = new Builder({ project, @@ -496,7 +496,7 @@ describe('models/builder.js', function() { ); }); - it('errors for an invalid node', function() { + it('errors for an invalid node', function () { let project = new MockProject(); expect( () => diff --git a/tests/unit/models/command-test.js b/tests/unit/models/command-test.js index cd59f8d1dd..c3eaf645e5 100644 --- a/tests/unit/models/command-test.js +++ b/tests/unit/models/command-test.js @@ -77,32 +77,32 @@ let OptionsAliasCommand = Command.extend({ }, }); -describe('models/command.js', function() { +describe('models/command.js', function () { let ui; let config; let options; - before(function() { + before(function () { config = new Yam('ember-cli', { secondary: `${process.cwd()}/tests/fixtures/home`, primary: `${process.cwd()}/tests/fixtures/project`, }); }); - beforeEach(function() { + beforeEach(function () { options = commandOptions(); ui = options.ui; }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('parseArgs() should parse the command options.', function() { + it('parseArgs() should parse the command options.', function () { expect(new ServeCommand(options).parseArgs(['--port', '80'])).to.have.nested.property('options.port', 80); }); - it('parseArgs() should get command options from the config file and command line', function() { + it('parseArgs() should get command options from the config file and command line', function () { expect( new ServeCommand( Object.assign(options, { @@ -122,11 +122,11 @@ describe('models/command.js', function() { }); }); - it('parseArgs() should set default option values.', function() { + it('parseArgs() should set default option values.', function () { expect(new ServeCommand(options).parseArgs([])).to.have.nested.property('options.port', 4200); }); - it('parseArgs() should return args too.', function() { + it('parseArgs() should return args too.', function () { expect( new ServeCommand( Object.assign(options, { @@ -146,7 +146,7 @@ describe('models/command.js', function() { }); }); - it('parseArgs() should warn if an option is invalid.', function() { + it('parseArgs() should warn if an option is invalid.', function () { new ServeCommand( Object.assign(options, { settings: config.getAll(), @@ -157,18 +157,18 @@ describe('models/command.js', function() { ); }); - it('parseArgs() should parse shorthand options.', function() { + it('parseArgs() should parse shorthand options.', function () { expect(new ServeCommand(options).parseArgs(['-e', 'tacotown'])).to.have.nested.property( 'options.environment', 'tacotown' ); }); - it('parseArgs() should parse shorthand dasherized options.', function() { + it('parseArgs() should parse shorthand dasherized options.', function () { expect(new ServeCommand(options).parseArgs(['-lr', 'false'])).to.have.nested.property('options.liveReload', false); }); - it('parseArgs() should parse string options.', function() { + it('parseArgs() should parse string options.', function () { let CustomAliasCommand = Command.extend({ name: 'custom-alias', availableOptions: [ @@ -185,14 +185,14 @@ describe('models/command.js', function() { expect(command).to.have.nested.property('options.options', '--split 2 --random'); }); - describe('#validateAndRun', function() { - it('should reject and print a message if a required option is missing.', function() { - return new DevelopEmberCLICommand(options).validateAndRun([]).catch(function() { + describe('#validateAndRun', function () { + it('should reject and print a message if a required option is missing.', function () { + return new DevelopEmberCLICommand(options).validateAndRun([]).catch(function () { expect(ui.output).to.match(/requires the option.*package-name/); }); }); - it('should print a message if outside a project and command is not valid there.', function() { + it('should print a message if outside a project and command is not valid there.', function () { return new InsideProjectCommand( Object.assign(options, { project: { @@ -206,12 +206,12 @@ describe('models/command.js', function() { }) ) .validateAndRun([]) - .catch(function(reason) { + .catch(function (reason) { expect(reason.message).to.match(/You have to be inside an ember-cli project/); }); }); - it('selects watcher if an option', function() { + it('selects watcher if an option', function () { return new InsideProjectCommand( Object.assign(options, { availableOptions: [{ type: 'string', name: 'watcher' }], @@ -226,12 +226,12 @@ describe('models/command.js', function() { }) ) .validateAndRun([]) - .then(function(options) { + .then(function (options) { expect(options).to.have.property('watcher'); }); }); - it('selects NO watcher if NOT an option', function() { + it('selects NO watcher if NOT an option', function () { return new InsideProjectCommand( Object.assign(options, { availableOptions: [{ type: 'string', name: 'foo' }], @@ -246,19 +246,19 @@ describe('models/command.js', function() { }) ) .validateAndRun([]) - .then(function(options) { + .then(function (options) { expect(options).to.not.have.property('watcher'); }); }); - it('should print a message if inside a project and command is not valid there.', function() { - return new OutsideProjectCommand(options).validateAndRun([]).catch(function(reason) { + it('should print a message if inside a project and command is not valid there.', function () { + return new OutsideProjectCommand(options).validateAndRun([]).catch(function (reason) { expect(reason.message).to.match(/You cannot use.*inside an ember-cli project/); }); }); }); - it('should be able to set availableOptions within init', function() { + it('should be able to set availableOptions within init', function () { let AvailableOptionsInitCommand = Command.extend({ name: 'available-options-init-command', init() { @@ -290,12 +290,12 @@ describe('models/command.js', function() { }) ) .validateAndRun([]) - .then(function(commandOptions) { + .then(function (commandOptions) { expect(commandOptions).to.deep.equal({ spicy: true }); }); }); - it('should be able to set availableOptions within beforeRun', function() { + it('should be able to set availableOptions within beforeRun', function () { let AvailableOptionsInitCommand = Command.extend({ name: 'available-options-init-command', @@ -308,7 +308,7 @@ describe('models/command.js', function() { ], beforeRun() { - return new Promise(resolve => { + return new Promise((resolve) => { resolve( this.availableOptions.push({ name: 'foobar', @@ -337,13 +337,13 @@ describe('models/command.js', function() { ); return command.beforeRun().then(() => - command.validateAndRun([]).then(commandOptions => { + command.validateAndRun([]).then((commandOptions) => { expect(commandOptions).to.deep.equal({ spicy: true, foobar: 'bazbaz' }); }) ); }); - it('availableOptions with aliases should work.', function() { + it('availableOptions with aliases should work.', function () { expect(new OptionsAliasCommand(options).parseArgs(['-soft-shell'])).to.deep.equal({ options: { taco: 'soft-shell', @@ -353,7 +353,7 @@ describe('models/command.js', function() { }); }); - it('availableOptions with aliases should work with minimum characters.', function() { + it('availableOptions with aliases should work with minimum characters.', function () { expect(new OptionsAliasCommand(options).parseArgs(['-so'])).to.deep.equal({ options: { taco: 'soft-shell', @@ -363,7 +363,7 @@ describe('models/command.js', function() { }); }); - it('availableOptions with aliases should work with hyphenated options', function() { + it('availableOptions with aliases should work with hyphenated options', function () { expect(new OptionsAliasCommand(options).parseArgs(['-dm', 'hi'])).to.deep.equal({ options: { taco: 'traditional', @@ -383,7 +383,7 @@ describe('models/command.js', function() { }); }); - it('registerOptions() should allow adding availableOptions.', function() { + it('registerOptions() should allow adding availableOptions.', function () { let optionsAlias = new OptionsAliasCommand(options); let extendedAvailableOptions = [ { @@ -424,7 +424,7 @@ describe('models/command.js', function() { }); }); - it('registerOptions() should allow overriding availableOptions.', function() { + it('registerOptions() should allow overriding availableOptions.', function () { let optionsAlias = new OptionsAliasCommand(options); let extendedAvailableOptions = [ { @@ -483,7 +483,7 @@ describe('models/command.js', function() { }); }); - it('registerOptions() should not allow aliases with the same name.', function() { + it('registerOptions() should not allow aliases with the same name.', function () { let optionsAlias = new OptionsAliasCommand(options); let extendedAvailableOptions = [ { @@ -508,7 +508,7 @@ describe('models/command.js', function() { ); }); - it('registerOptions() should warn on options override attempts.', function() { + it('registerOptions() should warn on options override attempts.', function () { let optionsAlias = new OptionsAliasCommand(options); let extendedAvailableOptions = [ { @@ -522,7 +522,7 @@ describe('models/command.js', function() { expect(ui.output).to.match(/The ".*" alias cannot be overridden. Please use a different alias./); }); - it('registerOptions() should handle invalid alias definitions.', function() { + it('registerOptions() should handle invalid alias definitions.', function () { //check for different types, validate proper errors are thrown let optionsAlias = new OptionsAliasCommand(options); let badArrayAvailableOptions = [ @@ -556,7 +556,7 @@ describe('models/command.js', function() { ); }); - it('parseAlias() should parse aliases and return an object', function() { + it('parseAlias() should parse aliases and return an object', function () { let optionsAlias = new OptionsAliasCommand(options); let option = { name: 'filling', @@ -573,7 +573,7 @@ describe('models/command.js', function() { }); }); - it('validateOption() should validate options', function() { + it('validateOption() should validate options', function () { let option = { name: 'filling', type: String, @@ -595,7 +595,7 @@ describe('models/command.js', function() { expect(optionsAliasCommand.validateOption(dupe)).to.be.false; }); - it('validateOption() should throw an error when option is missing name or type', function() { + it('validateOption() should throw an error when option is missing name or type', function () { let optionsAlias = new OptionsAliasCommand(options); let notype = { name: 'taco' }; let noname = { type: Boolean }; @@ -608,7 +608,7 @@ describe('models/command.js', function() { ); }); - it('validateOption() should throw an error when option name is camelCase or capitalized', function() { + it('validateOption() should throw an error when option name is camelCase or capitalized', function () { let optionsAlias = new OptionsAliasCommand(options); let capital = { name: 'Taco', @@ -627,7 +627,7 @@ describe('models/command.js', function() { ); }); - it('mergeDuplicateOption() should merge duplicate options together', function() { + it('mergeDuplicateOption() should merge duplicate options together', function () { let optionsAlias = new OptionsAliasCommand(options); let garbageAvailableOptions = [{ name: 'spicy', type: Boolean, default: true, aliases: [{ mild: true }] }]; optionsAlias.registerOptions({ availableOptions: garbageAvailableOptions }); @@ -690,7 +690,7 @@ describe('models/command.js', function() { ]); }); - it('implicit shorthands work with values.', function() { + it('implicit shorthands work with values.', function () { expect(new OptionsAliasCommand(options).parseArgs(['-s', 'false', '-t', 'hard-shell'])).to.deep.equal({ options: { taco: 'hard-shell', @@ -700,12 +700,12 @@ describe('models/command.js', function() { }); }); - describe('runTask', function() { + describe('runTask', function () { let command; class AsyncTask extends Task { run(options) { - return new Promise(function(resolve) { + return new Promise(function (resolve) { setTimeout(() => resolve(options), 50); }); } @@ -723,7 +723,7 @@ describe('models/command.js', function() { } } - beforeEach(function() { + beforeEach(function () { // this should be changed to new Command(), but needs more mocking command = new ServeCommand( Object.assign({}, options, { @@ -736,15 +736,15 @@ describe('models/command.js', function() { ); }); - it('always handles task as a promise', function() { - return command.runTask('Sync', { param: 'value' }).then(result => { + it('always handles task as a promise', function () { + return command.runTask('Sync', { param: 'value' }).then((result) => { expect(result).to.eql({ param: 'value', }); }); }); - it('command environment should be shared with a task', function() { + it('command environment should be shared with a task', function () { let taskRun = command.runTask('Async', { param: 'value' }); expect(command._currentTask.ui).to.eql(command.ui); @@ -754,7 +754,7 @@ describe('models/command.js', function() { return taskRun; }); - it('_currentTask should store a reference to the current task', function() { + it('_currentTask should store a reference to the current task', function () { expect(command._currentTask).to.be.undefined; let taskRun = command.runTask('Sync', { param: 'value' }).then(() => { expect(command._currentTask).to.be.undefined; @@ -764,13 +764,13 @@ describe('models/command.js', function() { return taskRun; }); - it('_currentTask should cleanup current task on fail', function() { + it('_currentTask should cleanup current task on fail', function () { return expect(command.runTask('Failing', { param: 'value' })).to.be.rejected.then(() => { expect(command._currentTask).to.be.undefined; }); }); - it('throws on attempt to launch concurrent tasks', function() { + it('throws on attempt to launch concurrent tasks', function () { let asyncTaskRun, syncTaskRun; expect(() => { @@ -781,7 +781,7 @@ describe('models/command.js', function() { return Promise.all([asyncTaskRun, syncTaskRun]); }); - it('throws if the task is not found', function() { + it('throws if the task is not found', function () { try { let taskRun = command.runTask('notfound'); @@ -794,25 +794,25 @@ describe('models/command.js', function() { }); }); - describe('help', function() { + describe('help', function () { let command; - beforeEach(function() { + beforeEach(function () { // this should be changed to new Command(), but needs more mocking command = new ServeCommand(options); }); - describe('printBasicHelp', function() { - beforeEach(function() { + describe('printBasicHelp', function () { + beforeEach(function () { td.replace(command, '_printCommand', td.function()); td.when(command._printCommand(), { ignoreExtraArgs: true }).thenReturn(' command printed'); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('calls printCommand', function() { + it('calls printCommand', function () { let output = command.printBasicHelp(); let testString = processHelpString(`ember serve command printed${EOL}`); @@ -820,7 +820,7 @@ describe('models/command.js', function() { expect(output).to.equal(testString); }); - it('is root', function() { + it('is root', function () { command.isRoot = true; let output = command.printBasicHelp(); @@ -831,30 +831,30 @@ describe('models/command.js', function() { }); }); - describe('printDetailedHelp', function() { - it('has no-op function', function() { + describe('printDetailedHelp', function () { + it('has no-op function', function () { let output = command.printDetailedHelp(); expect(output).to.be.undefined; }); }); - describe('hasOption', function() { - it('reports false if no option with that name is present', function() { + describe('hasOption', function () { + it('reports false if no option with that name is present', function () { expect(command.hasOption('no-option-by-this-name')).to.be.false; }); - it('reports true if option with that name is present', function() { + it('reports true if option with that name is present', function () { expect(command.hasOption('port')).to.be.true; }); }); - describe('getJson', function() { - beforeEach(function() { + describe('getJson', function () { + beforeEach(function () { command._printableProperties = ['test1', 'test2']; }); - it('iterates options', function() { + it('iterates options', function () { Object.assign(command, { test1: 'a test', test2: 'another test', @@ -868,7 +868,7 @@ describe('models/command.js', function() { }); }); - it('calls detailed json', function() { + it('calls detailed json', function () { td.replace(command, 'addAdditionalJsonForHelp', td.function()); let options = {}; diff --git a/tests/unit/models/file-info-test.js b/tests/unit/models/file-info-test.js index b6d0896dd1..25c8e81cd4 100644 --- a/tests/unit/models/file-info-test.js +++ b/tests/unit/models/file-info-test.js @@ -12,11 +12,11 @@ const td = require('testdouble'); let root = process.cwd(); let tmproot = path.join(root, 'tmp'); -describe('Unit - FileInfo', function() { +describe('Unit - FileInfo', function () { let validOptions, ui, testOutputPath; - beforeEach(function() { - return mkTmpDirIn(tmproot).then(function(tmpdir) { + beforeEach(function () { + return mkTmpDirIn(tmproot).then(function (tmpdir) { testOutputPath = path.join(tmpdir, 'outputfile'); ui = new MockUI(); @@ -33,43 +33,43 @@ describe('Unit - FileInfo', function() { }); }); - afterEach(function(done) { + afterEach(function (done) { td.reset(); fs.remove(tmproot, done); }); - it('can instantiate with options', function() { + it('can instantiate with options', function () { new FileInfo(validOptions); }); // eslint-disable-next-line no-template-curly-in-string - it('does not interpolate {{ }} or ${ }', function() { + it('does not interpolate {{ }} or ${ }', function () { let options = {}; Object.assign(options, validOptions, { inputPath: path.resolve(__dirname, '../../fixtures/file-info/interpolate.txt'), templateVariables: { name: 'tacocat' }, }); let fileInfo = new FileInfo(options); - return fileInfo.render().then(function(output) { + return fileInfo.render().then(function (output) { // eslint-disable-next-line no-template-curly-in-string expect(output.trim()).to.equal('{{ name }} ${ name } tacocat tacocat'); }); }); - it('renders an input file', function() { + it('renders an input file', function () { validOptions.templateVariables.friend = 'Billy'; let fileInfo = new FileInfo(validOptions); - return fileInfo.render().then(function(output) { + return fileInfo.render().then(function (output) { expect(output.trim()).to.equal('Howdy Billy', 'expects the template to have been run'); }); }); - it('allows mutation to the rendered file', function() { + it('allows mutation to the rendered file', function () { validOptions.templateVariables.friend = 'Billy'; let fileInfo; - validOptions.replacer = function(content, theFileInfo) { + validOptions.replacer = function (content, theFileInfo) { expect(theFileInfo).to.eql(fileInfo); expect(content).to.eql('Howdy Billy\n'); @@ -78,12 +78,12 @@ describe('Unit - FileInfo', function() { fileInfo = new FileInfo(validOptions); - return fileInfo.render().then(function(output) { + return fileInfo.render().then(function (output) { expect(output.trim()).to.equal('HOWDY BILLY', 'expects the template to have been run'); }); }); - it('rejects if templating throws', function() { + it('rejects if templating throws', function () { let templateWithUndefinedVariable = path.resolve( __dirname, '../../fixtures/blueprints/with-templating/files/with-undefined-variable.txt' @@ -94,38 +94,38 @@ describe('Unit - FileInfo', function() { return fileInfo .render() - .then(function() { + .then(function () { throw new Error('FileInfo.render should reject if templating throws'); }) - .catch(function(e) { + .catch(function (e) { if (!e.toString().match(/ReferenceError/)) { throw e; } }); }); - it('does not explode when trying to template binary files', function() { + it('does not explode when trying to template binary files', function () { let binary = path.resolve(__dirname, '../../fixtures/problem-binary.png'); validOptions.inputPath = binary; let fileInfo = new FileInfo(validOptions); - return fileInfo.render().then(function(output) { + return fileInfo.render().then(function (output) { expect(!!output, 'expects the file to be processed without error').to.equal(true); }); }); - it('renders a diff to the UI', function() { + it('renders a diff to the UI', function () { validOptions.templateVariables.friend = 'Billy'; let fileInfo = new FileInfo(validOptions); return fs .writeFile(testOutputPath, `Something Old${EOL}`) - .then(function() { + .then(function () { return fileInfo.displayDiff(); }) - .then(function() { + .then(function () { let output = ui.output.trim().split(EOL); expect(output.shift()).to.equal(`Index: ${testOutputPath}`); expect(output.shift()).to.match(/=+/); @@ -137,50 +137,50 @@ describe('Unit - FileInfo', function() { }); }); - it('renders a menu with an overwrite option', function() { + it('renders a menu with an overwrite option', function () { td.when(ui.prompt(td.matchers.anything())).thenReturn(Promise.resolve({ answer: 'overwrite' })); let fileInfo = new FileInfo(validOptions); - return fileInfo.confirmOverwrite('test.js').then(function(action) { + return fileInfo.confirmOverwrite('test.js').then(function (action) { td.verify(ui.prompt(td.matchers.anything()), { times: 1 }); expect(action).to.equal('overwrite'); }); }); - it('renders a menu with a skip option', function() { + it('renders a menu with a skip option', function () { td.when(ui.prompt(td.matchers.anything())).thenReturn(Promise.resolve({ answer: 'skip' })); let fileInfo = new FileInfo(validOptions); - return fileInfo.confirmOverwrite('test.js').then(function(action) { + return fileInfo.confirmOverwrite('test.js').then(function (action) { td.verify(ui.prompt(td.matchers.anything()), { times: 1 }); expect(action).to.equal('skip'); }); }); - it('renders a menu with a diff option', function() { + it('renders a menu with a diff option', function () { td.when(ui.prompt(td.matchers.anything())).thenReturn(Promise.resolve({ answer: 'diff' })); let fileInfo = new FileInfo(validOptions); - return fileInfo.confirmOverwrite('test.js').then(function(action) { + return fileInfo.confirmOverwrite('test.js').then(function (action) { td.verify(ui.prompt(td.matchers.anything()), { times: 1 }); expect(action).to.equal('diff'); }); }); - it('renders a menu without diff and edit options when dealing with binary files', function() { + it('renders a menu without diff and edit options when dealing with binary files', function () { td.when(ui.prompt(td.matchers.anything())).thenReturn(Promise.resolve({ answer: 'skip' })); let binary = path.resolve(__dirname, '../../fixtures/problem-binary.png'); validOptions.inputPath = binary; let fileInfo = new FileInfo(validOptions); - return fileInfo.confirmOverwrite('test.png').then(function(/* action */) { + return fileInfo.confirmOverwrite('test.png').then(function (/* action */) { td.verify( ui.prompt( - td.matchers.argThat(function(options) { + td.matchers.argThat(function (options) { return options.choices.length === 2 && options.choices[0].key === 'y' && options.choices[1].key === 'n'; }) ) @@ -188,7 +188,7 @@ describe('Unit - FileInfo', function() { }); }); - it('normalizes line endings before comparing files', function() { + it('normalizes line endings before comparing files', function () { if (EOL === '\n') { return; } @@ -197,7 +197,7 @@ describe('Unit - FileInfo', function() { validOptions.outputPath = path.resolve(__dirname, '../../fixtures/file-info/test_lf.js'); let fileInfo = new FileInfo(validOptions); - return fileInfo.checkForConflict().then(function(type) { + return fileInfo.checkForConflict().then(function (type) { expect(type).to.equal('identical'); }); }); diff --git a/tests/unit/models/hardware-info-test.js b/tests/unit/models/hardware-info-test.js index 68812885a6..bc422eafdb 100644 --- a/tests/unit/models/hardware-info-test.js +++ b/tests/unit/models/hardware-info-test.js @@ -81,18 +81,18 @@ function stdout(value) { }); } -describe('models/hardware-info.js', function() { - afterEach(function() { +describe('models/hardware-info.js', function () { + afterEach(function () { td.reset(); }); - describe('.isUsingBattery', function() { - it('returns null for unsupported platforms', function() { + describe('.isUsingBattery', function () { + it('returns null for unsupported platforms', function () { expect(hwinfo.isUsingBattery('not-a-real-platform')).to.be.null; }); - describe('on FreeBSD', function() { - it('returns false via apm when not on battery', function() { + describe('on FreeBSD', function () { + it('returns false via apm when not on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenReturn({ stdout: '1\n' }); @@ -102,7 +102,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('freebsd')).to.be.false; }); - it('returns true via apm when on battery', function() { + it('returns true via apm when on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenReturn({ stdout: '0\n' }); @@ -112,7 +112,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('freebsd')).to.be.true; }); - it('returns false via upower when not on battery', function() { + it('returns false via upower when not on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -122,7 +122,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('freebsd')).to.be.false; }); - it('returns true via upower when on battery', function() { + it('returns true via upower when on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -132,7 +132,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('freebsd')).to.be.true; }); - it('returns null when battery status cannot be determined', function() { + it('returns null when battery status cannot be determined', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -142,8 +142,8 @@ describe('models/hardware-info.js', function() { }); }); - describe('on Linux', function() { - it('returns false via /sys/class/power_supply when not on battery', function() { + describe('on Linux', function () { + it('returns false via /sys/class/power_supply when not on battery', function () { const execaStub = td.function(execa.sync); td.when(execaStub(), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -157,7 +157,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('linux')).to.be.false; }); - it('returns true via /sys/class/power_supply when on battery', function() { + it('returns true via /sys/class/power_supply when on battery', function () { const execaStub = td.function(execa.sync); td.when(execaStub(), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -171,7 +171,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('linux')).to.be.true; }); - it('returns false via acpi when not on battery', function() { + it('returns false via acpi when not on battery', function () { const execaStub = td.function(execa.sync); td.when(execaStub('acpi'), { ignoreExtraArgs: true }).thenReturn({ stdout: 'Adapter 0: on-line\n' }); @@ -186,7 +186,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('linux')).to.be.false; }); - it('returns true via acpi when on battery', function() { + it('returns true via acpi when on battery', function () { const execaStub = td.function(execa.sync); td.when(execaStub('acpi'), { ignoreExtraArgs: true }).thenReturn({ stdout: 'Adapter 0: off-line\n' }); @@ -201,7 +201,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('linux')).to.be.true; }); - it('returns false via upower when not on battery', function() { + it('returns false via upower when not on battery', function () { const execaStub = td.function(execa.sync); td.when(execaStub('acpi'), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -217,7 +217,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('linux')).to.be.false; }); - it('returns true via upower when on battery', function() { + it('returns true via upower when on battery', function () { const execaStub = td.function(execa.sync); td.when(execaStub('acpi'), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -233,7 +233,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('linux')).to.be.true; }); - it('returns null when battery status cannot be determined', function() { + it('returns null when battery status cannot be determined', function () { const execaStub = td.function(execa.sync); td.when(execaStub(), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -248,8 +248,8 @@ describe('models/hardware-info.js', function() { }); }); - describe('on macOS', function() { - it('returns false when not on battery', function() { + describe('on macOS', function () { + it('returns false when not on battery', function () { td.replace( execa, 'sync', @@ -261,7 +261,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('darwin')).to.be.false; }); - it('returns true when on battery', function() { + it('returns true when on battery', function () { td.replace( execa, 'sync', @@ -273,7 +273,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('darwin')).to.be.true; }); - it('returns null when an error occurs', function() { + it('returns null when an error occurs', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('whoops!')); @@ -283,8 +283,8 @@ describe('models/hardware-info.js', function() { }); }); - describe('on OpenBSD', function() { - it('returns false via apm when not on battery', function() { + describe('on OpenBSD', function () { + it('returns false via apm when not on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenReturn({ stdout: '1\n' }); @@ -294,7 +294,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('openbsd')).to.be.false; }); - it('returns true via apm when on battery', function() { + it('returns true via apm when on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenReturn({ stdout: '0\n' }); @@ -304,7 +304,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('openbsd')).to.be.true; }); - it('returns false via upower when not on battery', function() { + it('returns false via upower when not on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -314,7 +314,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('openbsd')).to.be.false; }); - it('returns true via upower when on battery', function() { + it('returns true via upower when on battery', function () { const stub = td.function(execa.sync); td.when(stub('apm'), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -324,7 +324,7 @@ describe('models/hardware-info.js', function() { expect(hwinfo.isUsingBattery('openbsd')).to.be.true; }); - it('returns null when battery status cannot be determined', function() { + it('returns null when battery status cannot be determined', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('command not found')); @@ -334,8 +334,8 @@ describe('models/hardware-info.js', function() { }); }); - describe('on Windows', function() { - it('returns false when not on battery', function() { + describe('on Windows', function () { + it('returns false when not on battery', function () { td.replace( execa, 'sync', @@ -351,7 +351,7 @@ PowerOnline=TRUE expect(hwinfo.isUsingBattery('win32')).to.be.false; }); - it('returns true when on battery', function() { + it('returns true when on battery', function () { td.replace( execa, 'sync', @@ -367,7 +367,7 @@ PowerOnline=FALSE expect(hwinfo.isUsingBattery('win32')).to.be.true; }); - it('returns null when an error occurs', function() { + it('returns null when an error occurs', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('whoops!')); @@ -378,12 +378,12 @@ PowerOnline=FALSE }); }); - describe('.memorySwapUsed', function() { - it('returns null for unsupported platforms', function() { + describe('.memorySwapUsed', function () { + it('returns null for unsupported platforms', function () { expect(hwinfo.memorySwapUsed('not-a-real-platform')).to.be.null; }); - it('returns the expected value on FreeBSD', function() { + it('returns the expected value on FreeBSD', function () { td.replace( execa, 'sync', @@ -396,7 +396,7 @@ PowerOnline=FALSE expect(hwinfo.memorySwapUsed('freebsd')).to.equal(1865728); }); - it('returns null on FreeBSD when an error occurs', function() { + it('returns null on FreeBSD when an error occurs', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('whoops!')); @@ -405,7 +405,7 @@ PowerOnline=FALSE expect(hwinfo.memorySwapUsed('freebsd')).to.be.null; }); - it('returns the expected value on Linux', function() { + it('returns the expected value on Linux', function () { td.replace( execa, 'sync', @@ -418,7 +418,7 @@ Swap: 67448598528 121593856 67327004672 expect(hwinfo.memorySwapUsed('linux')).to.equal(121593856); }); - it('returns null on Linux when an error occurs', function() { + it('returns null on Linux when an error occurs', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('whoops!')); @@ -427,7 +427,7 @@ Swap: 67448598528 121593856 67327004672 expect(hwinfo.memorySwapUsed('linux')).to.be.null; }); - it('returns the expected value on macOS', function() { + it('returns the expected value on macOS', function () { td.replace( execa, 'sync', @@ -438,7 +438,7 @@ Swap: 67448598528 121593856 67327004672 expect(hwinfo.memorySwapUsed('darwin')).to.equal(5230034944); }); - it('returns null on macOS when an error occurs', function() { + it('returns null on macOS when an error occurs', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('whoops!')); @@ -447,7 +447,7 @@ Swap: 67448598528 121593856 67327004672 expect(hwinfo.memorySwapUsed('darwin')).to.be.null; }); - it('returns the expected value on OpenBSD', function() { + it('returns the expected value on OpenBSD', function () { td.replace( execa, 'sync', @@ -460,7 +460,7 @@ Swap: 67448598528 121593856 67327004672 expect(hwinfo.memorySwapUsed('openbsd')).to.equal(932864); }); - it('returns null on OpenBSD when an error occurs', function() { + it('returns null on OpenBSD when an error occurs', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('whoops!')); @@ -469,7 +469,7 @@ Swap: 67448598528 121593856 67327004672 expect(hwinfo.memorySwapUsed('openbsd')).to.be.null; }); - it('returns the expected value on Windows', function() { + it('returns the expected value on Windows', function () { td.replace( execa, 'sync', @@ -485,7 +485,7 @@ CurrentUsage=325 expect(hwinfo.memorySwapUsed('win32')).to.equal(340787200); }); - it('returns null on Windows when an error occurs', function() { + it('returns null on Windows when an error occurs', function () { const stub = td.function(execa.sync); td.when(stub(), { ignoreExtraArgs: true }).thenThrow(new Error('whoops!')); @@ -495,14 +495,14 @@ CurrentUsage=325 }); }); - describe('.processorLoad', function() { - it('returns null on Windows', function() { + describe('.processorLoad', function () { + it('returns null on Windows', function () { expect(hwinfo.processorLoad('win32')).to.be.null; }); }); - describe('.processorSpeed', function() { - it("averages the processors' speeds", function() { + describe('.processorSpeed', function () { + it("averages the processors' speeds", function () { td.replace(os, 'cpus', () => [{ speed: 1 }, { speed: 2 }, { speed: 3 }, { speed: 4 }, { speed: 5 }]); expect(hwinfo.processorSpeed()).to.equal(3); diff --git a/tests/unit/models/installation-checker-test.js b/tests/unit/models/installation-checker-test.js index 7e6eecc18a..0462bf35eb 100644 --- a/tests/unit/models/installation-checker-test.js +++ b/tests/unit/models/installation-checker-test.js @@ -4,7 +4,7 @@ const expect = require('chai').expect; const InstallationChecker = require('../../../lib/models/installation-checker'); const path = require('path'); -describe('Installation Checker', function() { +describe('Installation Checker', function () { let installationChecker; function fixturePath(pathToFile) { @@ -15,8 +15,8 @@ describe('Installation Checker', function() { installationChecker.checkInstallations(); } - describe('bower', function() { - it('works when installation directory exist', function() { + describe('bower', function () { + it('works when installation directory exist', function () { let project = { root: fixturePath('installation-checker/valid-bower-installation'), bowerDirectory: fixturePath('installation-checker/valid-bower-installation/bower_components'), @@ -26,7 +26,7 @@ describe('Installation Checker', function() { expect(checkInstallations).to.not.throw(/No dependencies installed/); }); - it("fails when installation directory doesn't exist", function() { + it("fails when installation directory doesn't exist", function () { let project = { root: fixturePath('installation-checker/invalid-bower-installation'), bowerDirectory: fixturePath('installation-checker/invalid-bower-installation/bower_components'), @@ -37,8 +37,8 @@ describe('Installation Checker', function() { }); }); - describe('npm', function() { - it('works when installation directory exist', function() { + describe('npm', function () { + it('works when installation directory exist', function () { let project = { root: fixturePath('installation-checker/valid-npm-installation'), }; @@ -47,7 +47,7 @@ describe('Installation Checker', function() { expect(checkInstallations).to.not.throw(/No dependencies installed/); }); - it("fails when installation directory doesn't exist", function() { + it("fails when installation directory doesn't exist", function () { let project = { root: fixturePath('installation-checker/invalid-npm-installation'), }; @@ -57,8 +57,8 @@ describe('Installation Checker', function() { }); }); - describe('npm and bower', function() { - it('fails reporting both dependencies', function() { + describe('npm and bower', function () { + it('fails reporting both dependencies', function () { let project = { root: fixturePath('installation-checker/invalid-bower-and-npm'), bowerDirectory: fixturePath('installation-checker/invalid-bower-and-npm/bower_components'), @@ -68,7 +68,7 @@ describe('Installation Checker', function() { expect(checkInstallations).to.throw(/^InstallationChecker: Unable to parse: .*package.json/); }); - it('ignores directories without bower.js and package.json files', function() { + it('ignores directories without bower.js and package.json files', function () { let project = { root: fixturePath('installation-checker/empty'), bowerDirectory: fixturePath('installation-checker/empty/bower_components'), diff --git a/tests/unit/models/instantiate-addons-test.js b/tests/unit/models/instantiate-addons-test.js index 082e748a93..f21fa2da18 100644 --- a/tests/unit/models/instantiate-addons-test.js +++ b/tests/unit/models/instantiate-addons-test.js @@ -3,19 +3,19 @@ const FixturifyProject = require('../../helpers/fixturify-project'); const expect = require('chai').expect; -describe('models/instatiate-addons.js', function() { +describe('models/instatiate-addons.js', function () { let fixturifyProject; - beforeEach(function() { + beforeEach(function () { fixturifyProject = new FixturifyProject('awesome-proj', '0.0.0'); fixturifyProject.addDevDependency('ember-cli', '*'); }); - afterEach(function() { + afterEach(function () { fixturifyProject.dispose(); }); - it('ordering without before/after', function() { + it('ordering without before/after', function () { // this tests ordering is very important to maintain, it tests some naunced // details which must be maintained fixturifyProject.addAddon('foo', '1.0.0'); @@ -38,7 +38,7 @@ describe('models/instatiate-addons.js', function() { project.initializeAddons(); - expect(project.addons.map(a => ({ name: a.pkg.name, version: a.pkg.version }))).to.deep.eql([ + expect(project.addons.map((a) => ({ name: a.pkg.name, version: a.pkg.version }))).to.deep.eql([ { name: 'a', version: '2.0.0' }, { name: 'b', version: '2.0.0' }, { name: 'c', version: '2.0.0' }, @@ -49,10 +49,10 @@ describe('models/instatiate-addons.js', function() { ]); }); - it('ordering with before specified', function() { + it('ordering with before specified', function () { fixturifyProject.addAddon('foo', '1.0.0'); fixturifyProject.addAddon('bar', '1.0.0'); - fixturifyProject.addAddon('qux', '1.0.0', a => (a.pkg['ember-addon'].before = 'foo')); + fixturifyProject.addAddon('qux', '1.0.0', (a) => (a.pkg['ember-addon'].before = 'foo')); fixturifyProject.writeSync(); @@ -60,13 +60,13 @@ describe('models/instatiate-addons.js', function() { project.initializeAddons(); - expect(project.addons.map(a => a.name)).to.deep.eql(['bar', 'qux', 'foo']); + expect(project.addons.map((a) => a.name)).to.deep.eql(['bar', 'qux', 'foo']); }); - it('ordering with after specified', function() { + it('ordering with after specified', function () { fixturifyProject.addAddon('foo', '1.0.0'); fixturifyProject.addAddon('bar', '1.0.0'); - fixturifyProject.addAddon('qux', '1.0.0', a => (a.pkg['ember-addon'].after = 'foo')); + fixturifyProject.addAddon('qux', '1.0.0', (a) => (a.pkg['ember-addon'].after = 'foo')); fixturifyProject.writeSync(); @@ -74,13 +74,13 @@ describe('models/instatiate-addons.js', function() { project.initializeAddons(); - expect(project.addons.map(a => a.name)).to.deep.eql(['bar', 'foo', 'qux']); + expect(project.addons.map((a) => a.name)).to.deep.eql(['bar', 'foo', 'qux']); }); - it('ordering always matches package.json name (index.js name is ignored)', function() { + it('ordering always matches package.json name (index.js name is ignored)', function () { let foo = fixturifyProject.addAddon('lol', '1.0.0'); foo.files['index.js'] = 'module.exports = { name: "foo" };'; - fixturifyProject.addAddon('qux', '1.0.0', a => (a.pkg['ember-addon'].before = 'foo')); + fixturifyProject.addAddon('qux', '1.0.0', (a) => (a.pkg['ember-addon'].before = 'foo')); fixturifyProject.writeSync(); @@ -88,12 +88,12 @@ describe('models/instatiate-addons.js', function() { project.initializeAddons(); - expect(project.addons.map(a => a.name)).to.deep.eql(['foo', 'qux']); + expect(project.addons.map((a) => a.name)).to.deep.eql(['foo', 'qux']); }); - it('errors when there is a cycle detected', function() { - fixturifyProject.addAddon('foo', '1.0.0', a => (a.pkg['ember-addon'].after = 'qux')); - fixturifyProject.addAddon('qux', '1.0.0', a => (a.pkg['ember-addon'].after = 'foo')); + it('errors when there is a cycle detected', function () { + fixturifyProject.addAddon('foo', '1.0.0', (a) => (a.pkg['ember-addon'].after = 'qux')); + fixturifyProject.addAddon('qux', '1.0.0', (a) => (a.pkg['ember-addon'].after = 'foo')); fixturifyProject.writeSync(); diff --git a/tests/unit/models/instrumentation-test.js b/tests/unit/models/instrumentation-test.js index c54819b46f..8305a86daa 100644 --- a/tests/unit/models/instrumentation-test.js +++ b/tests/unit/models/instrumentation-test.js @@ -24,8 +24,8 @@ const tmproot = path.join(root, 'tmp'); let instrumentation; -describe('models/instrumentation.js', function() { - afterEach(async function() { +describe('models/instrumentation.js', function () { + afterEach(async function () { delete process.env.BROCCOLI_VIZ; delete process.env.EMBER_CLI_INSTRUMENTATION; @@ -33,20 +33,20 @@ describe('models/instrumentation.js', function() { await fse.remove(tmproot); }); - describe('._enableFSMonitorIfInstrumentationEnabled', function() { + describe('._enableFSMonitorIfInstrumentationEnabled', function () { let originalStatSync = fs.statSync; - beforeEach(function() { + beforeEach(function () { expect(!!process.env.BROCCOLI_VIZ).to.eql(false); expect(!!process.env.EMBER_CLI_INSTRUMENTATION).to.eql(false); expect(fs.statSync).to.equal(originalStatSync); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('if VIZ is NOT enabled, do not monitor', function() { + it('if VIZ is NOT enabled, do not monitor', function () { let monitor = Instrumentation._enableFSMonitorIfInstrumentationEnabled(); try { expect(fs.statSync).to.equal(originalStatSync); @@ -58,7 +58,7 @@ describe('models/instrumentation.js', function() { } }); - it('if VIZ is enabled, monitor', function() { + it('if VIZ is enabled, monitor', function () { process.env.BROCCOLI_VIZ = '1'; let monitor = Instrumentation._enableFSMonitorIfInstrumentationEnabled(); try { @@ -70,7 +70,7 @@ describe('models/instrumentation.js', function() { } }); - it('if instrumentation is enabled, monitor', function() { + it('if instrumentation is enabled, monitor', function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; let monitor = Instrumentation._enableFSMonitorIfInstrumentationEnabled(); try { @@ -82,7 +82,7 @@ describe('models/instrumentation.js', function() { } }); - it('if enableInstrumentation is NOT enabled in .ember-cli, do not monitor', function() { + it('if enableInstrumentation is NOT enabled in .ember-cli, do not monitor', function () { let mockedYam = new Yam('ember-cli', { primary: `${process.cwd()}/tests/fixtures/instrumentation-disabled-config`, }); @@ -97,7 +97,7 @@ describe('models/instrumentation.js', function() { } }); - it('if enableInstrumentation is enabled in .ember-cli, monitor', function() { + it('if enableInstrumentation is enabled in .ember-cli, monitor', function () { let mockedYam = new Yam('ember-cli', { primary: `${process.cwd()}/tests/fixtures/instrumentation-enabled-config`, }); @@ -112,25 +112,25 @@ describe('models/instrumentation.js', function() { }); }); - describe('constructor', function() { + describe('constructor', function () { const heimdall = require('heimdalljs'); let heimdallStart; - beforeEach(function() { + beforeEach(function () { heimdallStart = td.replace(heimdall, 'start'); }); - afterEach(function() { + afterEach(function () { delete process.env.EMBER_CLI_INSTRUMENTATION; td.reset(); }); - describe('when instrumentation is enabled', function() { - beforeEach(function() { + describe('when instrumentation is enabled', function () { + beforeEach(function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; }); - it('starts an init node if init instrumentation is missing', function() { + it('starts an init node if init instrumentation is missing', function () { let mockToken = {}; td.when( @@ -151,7 +151,7 @@ describe('models/instrumentation.js', function() { expect(instrumentation.instrumentations.init.node).to.not.equal(undefined); }); - it('does not create an init node if init instrumentation is included', function() { + it('does not create an init node if init instrumentation is included', function () { let mockToken = {}; let mockInstrumentation = {}; @@ -165,7 +165,7 @@ describe('models/instrumentation.js', function() { td.verify(heimdallStart(), { times: 0, ignoreExtraArgs: true }); }); - it('does not warn if init instrumentation is included', function() { + it('does not warn if init instrumentation is included', function () { td.when(heimdallStart('init')); let mockInstrumentation = {}; @@ -181,12 +181,12 @@ describe('models/instrumentation.js', function() { }); }); - describe('when instrumentation is not enabled', function() { - beforeEach(function() { + describe('when instrumentation is not enabled', function () { + beforeEach(function () { expect(process.env.EMBER_CLI_INSTRUMENTATION).to.eql(undefined); }); - it('does not create an init node if init instrumentation is missing', function() { + it('does not create an init node if init instrumentation is missing', function () { let mockToken = {}; td.when(heimdallStart('init')).thenReturn(mockToken); @@ -197,7 +197,7 @@ describe('models/instrumentation.js', function() { td.verify(heimdallStart(), { times: 0, ignoreExtraArgs: true }); }); - it('does not warn when init instrumentation is missing', function() { + it('does not warn when init instrumentation is missing', function () { td.when(heimdallStart('init')); let ui = new MockUI(); @@ -211,11 +211,11 @@ describe('models/instrumentation.js', function() { }); }); - describe('.isVizEnabled', function() { + describe('.isVizEnabled', function () { let originalWarn = console.warn; let warnInvocations; - beforeEach(function() { + beforeEach(function () { instrumentation = new Instrumentation({ ui: new MockUI(), }); @@ -223,37 +223,37 @@ describe('models/instrumentation.js', function() { delete process.env.BROCCOLI_VIZ; delete process.env.EMBER_CLI_INSTRUMENTATION; warnInvocations = []; - console.warn = function() { + console.warn = function () { warnInvocations.push.apply(warnInvocations, Array.prototype.slice.call(arguments)); }; }); - afterEach(function() { + afterEach(function () { console.warn = originalWarn; }); - it('is true and does not warn if BROCCOLI_VIZ=1', function() { + it('is true and does not warn if BROCCOLI_VIZ=1', function () { process.env.BROCCOLI_VIZ = '1'; expect(instrumentation.isVizEnabled()).to.eql(true); expect(warnInvocations).to.eql([]); }); - it('is true and warns at most once if BROCCOLI_VIZ is set but not 1', function() { + it('is true and warns at most once if BROCCOLI_VIZ is set but not 1', function () { process.env.BROCCOLI_VIZ = 'on'; expect(instrumentation.isVizEnabled()).to.eql(true); expect(instrumentation.isVizEnabled()).to.eql(true); expect(warnInvocations).to.eql(["Please set BROCCOLI_VIZ=1 to enable visual instrumentation, rather than 'on'"]); }); - it('is false if BROCCOLI_VIZ is unset', function() { + it('is false if BROCCOLI_VIZ is unset', function () { expect('BROCCOLI_VIZ' in process.env).to.eql(false); expect(instrumentation.isVizEnabled()).to.eql(false); expect(warnInvocations).to.eql([]); }); }); - describe('.isEnabled', function() { - beforeEach(function() { + describe('.isEnabled', function () { + beforeEach(function () { instrumentation = new Instrumentation({ ui: new MockUI(), }); @@ -261,41 +261,41 @@ describe('models/instrumentation.js', function() { delete process.env.EMBER_CLI_INSTRUMENTATION; }); - it('is true if BROCCOLI_VIZ=1', function() { + it('is true if BROCCOLI_VIZ=1', function () { process.env.BROCCOLI_VIZ = '1'; expect(instrumentation.isEnabled()).to.eql(true); }); - it('is true if EMBER_CLI_INSTRUMENTATION=1', function() { + it('is true if EMBER_CLI_INSTRUMENTATION=1', function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; expect(instrumentation.isEnabled()).to.eql(true); }); - it('is false if EMBER_CLI_INSTRUMENTATION != 1', function() { + it('is false if EMBER_CLI_INSTRUMENTATION != 1', function () { process.env.EMBER_CLI_INSTRUMENTATION = 'on'; expect(instrumentation.isEnabled()).to.eql(false); }); - it('is false if both BROCCOLI_VIZ and EMBER_CLI_INSTRUMENTATION are unset', function() { + it('is false if both BROCCOLI_VIZ and EMBER_CLI_INSTRUMENTATION are unset', function () { expect('BROCCOLI_VIZ' in process.env).to.eql(false); expect('EMBER_CLI_INSTRUMENTATION' in process.env).to.eql(false); expect(instrumentation.isEnabled()).to.eql(false); }); }); - describe('.start', function() { + describe('.start', function () { let project; let instrumentation; let heimdall; - beforeEach(function() { + beforeEach(function () { project = new MockProject(); instrumentation = project._instrumentation; instrumentation._heimdall = heimdall = new Heimdall(); process.env.EMBER_CLI_INSTRUMENTATION = '1'; }); - it('starts a new subtree for name', function() { + it('starts a new subtree for name', function () { let heimdallStart = td.replace(heimdall, 'start'); instrumentation.start('init'); @@ -343,7 +343,7 @@ describe('models/instrumentation.js', function() { ); }); - it('does not start a subtree if instrumentation is disabled', function() { + it('does not start a subtree if instrumentation is disabled', function () { process.env.EMBER_CLI_INSTRUMENTATION = 'no thanks'; let heimdallStart = td.replace(heimdall, 'start'); @@ -353,13 +353,13 @@ describe('models/instrumentation.js', function() { td.verify(heimdallStart(), { times: 0, ignoreExtraArgs: true }); }); - it('throws if name is unexpected', function() { + it('throws if name is unexpected', function () { expect(() => { instrumentation.start('a party!'); }).to.throw('No such instrumentation "a party!"'); }); - it('removes any prior instrumentation information to avoid leaks', function() { + it('removes any prior instrumentation information to avoid leaks', function () { function build() { instrumentation.start('build'); let a = heimdall.start('a'); @@ -391,13 +391,13 @@ describe('models/instrumentation.js', function() { }); }); - describe('.stopAndReport', function() { + describe('.stopAndReport', function () { let project; let instrumentation; let heimdall; let addon; - beforeEach(function() { + beforeEach(function () { project = new MockProject(); instrumentation = project._instrumentation; heimdall = instrumentation._heimdall = new Heimdall(); @@ -414,17 +414,17 @@ describe('models/instrumentation.js', function() { ]; }); - it('throws if name is unexpected', function() { + it('throws if name is unexpected', function () { expect(() => instrumentation.stopAndReport('the weather')).to.throw('No such instrumentation "the weather"'); }); - it('throws if name has not yet started', function() { + it('throws if name has not yet started', function () { expect(() => instrumentation.stopAndReport('init')).to.throw( 'Cannot stop instrumentation "init". It has not started.' ); }); - it('warns if heimdall stop throws (eg when unbalanced)', function() { + it('warns if heimdall stop throws (eg when unbalanced)', function () { instrumentation.start('init'); heimdall.start('a ruckus'); @@ -436,7 +436,7 @@ describe('models/instrumentation.js', function() { expect(() => instrumentation.stopAndReport('init')).to.not.throw(); }); - it('computes summary for name', function() { + it('computes summary for name', function () { let buildSummary = td.replace(instrumentation, '_buildSummary'); let initSummary = td.replace(instrumentation, '_initSummary'); let treeFor = td.replace(instrumentation, '_instrumentationTreeFor'); @@ -499,8 +499,8 @@ describe('models/instrumentation.js', function() { ); }); - describe('writes to disk', function() { - beforeEach(function() { + describe('writes to disk', function () { + beforeEach(function () { let buildSummary = td.replace(instrumentation, '_buildSummary'); let initSummary = td.replace(instrumentation, '_initSummary'); let treeFor = td.replace(instrumentation, '_instrumentationTreeFor'); @@ -526,7 +526,7 @@ describe('models/instrumentation.js', function() { process.env.EMBER_CLI_INSTRUMENTATION = '1'; }); - it('writes instrumentation info if viz is enabled', async function() { + it('writes instrumentation info if viz is enabled', async function () { process.env.BROCCOLI_VIZ = '1'; await mkTmpDirIn(tmproot); @@ -561,7 +561,7 @@ describe('models/instrumentation.js', function() { }); }); - it('does not write instrumentation info if viz is disabled', async function() { + it('does not write instrumentation info if viz is disabled', async function () { delete process.env.BROCCOLI_VIZ; await mkTmpDirIn(tmproot); @@ -585,13 +585,13 @@ describe('models/instrumentation.js', function() { }); }); - describe('addons', function() { + describe('addons', function () { let mockInitSummary; let mockInitTree; let mockBuildSummary; let mockBuildTree; - beforeEach(function() { + beforeEach(function () { let buildSummary = td.replace(instrumentation, '_buildSummary'); let initSummary = td.replace(instrumentation, '_initSummary'); let treeFor = td.replace(instrumentation, '_instrumentationTreeFor'); @@ -607,7 +607,7 @@ describe('models/instrumentation.js', function() { td.when(treeFor('build')).thenReturn(mockBuildTree); }); - it('invokes addons that have [INSTRUMENTATION] for init', function() { + it('invokes addons that have [INSTRUMENTATION] for init', function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; let hook = td.function(); @@ -619,7 +619,7 @@ describe('models/instrumentation.js', function() { td.verify(hook('init', { summary: mockInitSummary, tree: mockInitTree })); }); - it('invokes addons that have [INSTRUMENTATION] for build', function() { + it('invokes addons that have [INSTRUMENTATION] for build', function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; let hook = td.function(); @@ -631,7 +631,7 @@ describe('models/instrumentation.js', function() { td.verify(hook('build', { summary: mockBuildSummary, tree: mockBuildTree })); }); - it('does not invoke addons if instrumentation is disabled', function() { + it('does not invoke addons if instrumentation is disabled', function () { process.env.EMBER_CLI_INSTRUMENTATION = 'not right now thanks'; let hook = td.function(); @@ -645,7 +645,7 @@ describe('models/instrumentation.js', function() { }); }); - describe('._instrumenationTreeFor', function() { + describe('._instrumenationTreeFor', function () { function StatsSchema() { this.x = 0; this.y = 0; @@ -696,9 +696,9 @@ describe('models/instrumentation.js', function() { expect(Object.keys(json)).to.eql(['nodes']); expect(json.nodes.length).to.eql(8); - expect(json.nodes.map(x => x.id)).to.eql([1, 2, 3, 4, 5, 6, 7, 8]); + expect(json.nodes.map((x) => x.id)).to.eql([1, 2, 3, 4, 5, 6, 7, 8]); - expect(json.nodes.map(x => x.label)).to.eql([ + expect(json.nodes.map((x) => x.label)).to.eql([ { name, emberCLI: true }, { name: 'a' }, { name: 'b1', broccoliNode: true, broccoliCachedNode: false }, @@ -709,10 +709,10 @@ describe('models/instrumentation.js', function() { { name: 'c3' }, ]); - expect(json.nodes.map(x => x.children)).to.eql([[2], [3, 5], [4], [], [6, 8], [7], [], []]); + expect(json.nodes.map((x) => x.children)).to.eql([[2], [3, 5], [4], [], [6, 8], [7], [], []]); - let stats = json.nodes.map(x => x.stats); - stats.forEach(nodeStats => { + let stats = json.nodes.map((x) => x.stats); + stats.forEach((nodeStats) => { expect('own' in nodeStats).to.eql(true); expect('time' in nodeStats).to.eql(true); expect(nodeStats.time.self).to.be.within(0, 2000000); //2ms in nanoseconds @@ -726,15 +726,15 @@ describe('models/instrumentation.js', function() { } function assertTreeValidAPI(name, tree) { - let depthFirstNames = Array.from(tree.dfsIterator()).map(x => x.label.name); + let depthFirstNames = Array.from(tree.dfsIterator()).map((x) => x.label.name); expect(depthFirstNames, 'depth first name order').to.eql([name, 'a', 'b1', 'c1', 'b2', 'c2', 'd1', 'c3']); - let breadthFirstNames = Array.from(tree.bfsIterator()).map(x => x.label.name); + let breadthFirstNames = Array.from(tree.bfsIterator()).map((x) => x.label.name); expect(breadthFirstNames, 'breadth first name order').to.eql([name, 'a', 'b1', 'b2', 'c1', 'c2', 'c3', 'd1']); - let c2 = Array.from(tree.dfsIterator()).filter(x => x.label.name === 'c2')[0]; + let c2 = Array.from(tree.dfsIterator()).filter((x) => x.label.name === 'c2')[0]; - let ancestorNames = Array.from(c2.ancestorsIterator()).map(x => x.label.name); + let ancestorNames = Array.from(c2.ancestorsIterator()).map((x) => x.label.name); expect(ancestorNames).to.eql(['b2', 'a', name]); } @@ -743,24 +743,24 @@ describe('models/instrumentation.js', function() { assertTreeValidAPI(name, tree); } - it('produces a valid tree for init', function() { + it('produces a valid tree for init', function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; makeTree('init'); assertTreeValid('init', instrumentation._instrumentationTreeFor('init')); }); - it('produces a valid tree for build', function() { + it('produces a valid tree for build', function () { process.env.EMBER_CLI_INSTRUMENTATION = '1'; makeTree('build'); assertTreeValid('build', instrumentation._instrumentationTreeFor('build')); }); }); - describe('summaries', function() { + describe('summaries', function () { let instrTree; let instrumentation; - beforeEach(function() { + beforeEach(function () { instrumentation = new Instrumentation({ ui: new MockUI() }); let heimdall = new Heimdall(); @@ -779,8 +779,8 @@ describe('models/instrumentation.js', function() { process.env.EMBER_CLI_INSTRUMENTATION = '1'; }); - describe('._buildSummary', function() { - it('computes initial build sumamries', function() { + describe('._buildSummary', function () { + it('computes initial build sumamries', function () { let result = { directory: 'tmp/someplace', outputChanges: ['assets/foo.js', 'assets/foo.css'], @@ -806,7 +806,7 @@ describe('models/instrumentation.js', function() { expect(Object.keys(summary.platform)).to.eql(['name', ...Object.keys(hwinfo), 'collectionTime']); }); - it('computes rebuild summaries', function() { + it('computes rebuild summaries', function () { let result = { directory: 'tmp/someplace', outputChanges: ['assets/foo.js', 'assets/foo.css'], @@ -843,8 +843,8 @@ describe('models/instrumentation.js', function() { }); }); - describe('._initSummary', function() { - it('computes an init summary', function() { + describe('._initSummary', function () { + it('computes an init summary', function () { let summary = instrumentation._initSummary(instrTree); expect(Object.keys(summary)).to.eql(['totalTime', 'platform']); @@ -855,8 +855,8 @@ describe('models/instrumentation.js', function() { }); }); - describe('._commandSummary', function() { - it('computes a command summary', function() { + describe('._commandSummary', function () { + it('computes a command summary', function () { let summary = instrumentation._commandSummary(instrTree, 'build', ['--like', '--whatever']); expect(Object.keys(summary)).to.eql(['name', 'args', 'totalTime', 'platform']); @@ -869,8 +869,8 @@ describe('models/instrumentation.js', function() { }); }); - describe('._shutdownSummary', function() { - it('computes a shutdown summary', function() { + describe('._shutdownSummary', function () { + it('computes a shutdown summary', function () { let summary = instrumentation._shutdownSummary(instrTree); expect(Object.keys(summary)).to.eql(['totalTime', 'platform']); diff --git a/tests/unit/models/package-info-cache/node-module-list-test.js b/tests/unit/models/package-info-cache/node-module-list-test.js index 921d5c8cf1..72412b8940 100644 --- a/tests/unit/models/package-info-cache/node-module-list-test.js +++ b/tests/unit/models/package-info-cache/node-module-list-test.js @@ -3,14 +3,14 @@ const expect = require('chai').expect; const NodeModulesList = require('../../../../lib/models/package-info-cache/node-modules-list'); -describe('models/package-info-cache/node-modules-list-test', function() { - it('correctly constructs', function() { +describe('models/package-info-cache/node-modules-list-test', function () { + it('correctly constructs', function () { expect(new NodeModulesList()).to.be.ok; expect(new NodeModulesList('/some/path')).to.be.ok; }); - describe('.NULL', function() { - it('returns a singleton, deeply frozen NodeMoudlesList', function() { + describe('.NULL', function () { + it('returns a singleton, deeply frozen NodeMoudlesList', function () { expect(NodeModulesList.NULL).to.equal(NodeModulesList.NULL); expect(NodeModulesList.NULL).to.be.frozen; expect(NodeModulesList.NULL.entries).to.be.frozen; @@ -19,13 +19,13 @@ describe('models/package-info-cache/node-modules-list-test', function() { }); }); - describe('findPackage', function() { - it('works with no entries', function() { + describe('findPackage', function () { + it('works with no entries', function () { let list = new NodeModulesList(); expect(list.findPackage('omg')).to.eql(null); }); - it('supports basic entries (missing, present, scoped)', function() { + it('supports basic entries (missing, present, scoped)', function () { let list = new NodeModulesList(); let scoped = new NodeModulesList(); let omg = { name: 'omg' }; diff --git a/tests/unit/models/package-info-cache/package-info-cache-test.js b/tests/unit/models/package-info-cache/package-info-cache-test.js index 7218917e8a..3687a48fb0 100644 --- a/tests/unit/models/package-info-cache/package-info-cache-test.js +++ b/tests/unit/models/package-info-cache/package-info-cache-test.js @@ -9,17 +9,17 @@ const MockUI = require('console-ui/mock'); const MockCLI = require('../../../helpers/mock-cli'); const FixturifyProject = require('../../../helpers/fixturify-project'); -describe('models/package-info-cache/package-info-cache-test.js', function() { +describe('models/package-info-cache/package-info-cache-test.js', function () { let project, projectPath, packageJsonPath, packageContents, projectPackageInfo, resolvedFile, ui, cli, pic; this.timeout(20000); - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); cli = new MockCLI({ ui }); }); - describe('lexicographically', function() { - it('works', function() { + describe('lexicographically', function () { + it('works', function () { expect( [ { name: 'c' }, @@ -50,23 +50,23 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - describe('pushUnique', function() { - it('works (and does last write win)', function() { + describe('pushUnique', function () { + it('works (and does last write win)', function () { let a = { name: 'a' }; let b = { name: 'b' }; let c = { name: 'c' }; let result = []; - [a, a, a, b, a, c, a, c].forEach(entry => PackageInfo.pushUnique(result, entry)); + [a, a, a, b, a, c, a, c].forEach((entry) => PackageInfo.pushUnique(result, entry)); expect(result).to.eql([b, a, c]); }); }); - describe('packageInfo contents tests on valid project', function() { + describe('packageInfo contents tests on valid project', function () { let projectPath, packageJsonPath, packageContents, projectPackageInfo; - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(addonFixturePath, 'simple'); packageJsonPath = path.join(projectPath, 'package.json'); packageContents = require(packageJsonPath); @@ -76,23 +76,23 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { projectPackageInfo = pic.getEntry(projectPath); }); - it('finds project PackageInfo entry for project root', function() { + it('finds project PackageInfo entry for project root', function () { expect(projectPackageInfo).to.exist; }); - it('projectPackageInfo has a "pkg" field', function() { + it('projectPackageInfo has a "pkg" field', function () { expect(projectPackageInfo.pkg).to.exist; }); - it('shows projectPackageInfo is considered valid', function() { + it('shows projectPackageInfo is considered valid', function () { expect(projectPackageInfo.valid).to.be.true; }); - it('is a project, so it may have addons', function() { + it('is a project, so it may have addons', function () { expect(projectPackageInfo.mayHaveAddons).to.eql(true); }); - it('shows projectPackageInfo has cliInfo at ember-cli root dir', function() { + it('shows projectPackageInfo has cliInfo at ember-cli root dir', function () { expect(projectPackageInfo.cliInfo).to.exist; let cliRealPath = projectPackageInfo.cliInfo.realPath; @@ -100,7 +100,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(cliRealPath).to.equal(emberCliRealPath); }); - it('shows projectPackageInfo has 1 error', function() { + it('shows projectPackageInfo has 1 error', function () { expect(projectPackageInfo.hasErrors()).to.be.true; let errorArray = projectPackageInfo.errors.getErrors(); @@ -109,14 +109,14 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); // TODO: the input to this test is polluted by other tests: https://github.com/ember-cli/ember-cli/issues/7981 - it.skip('shows projectPackageInfo error is "3 dependencies missing"', function() { + it.skip('shows projectPackageInfo error is "3 dependencies missing"', function () { let errorArray = projectPackageInfo.errors.getErrors(); let error = errorArray[0]; expect(error.type).to.equal('dependenciesMissing'); expect(error.data.length).to.equal(3); }); - it('shows projectPackageInfo has 1 dependencyPackage', function() { + it('shows projectPackageInfo has 1 dependencyPackage', function () { let dependencyPackages = projectPackageInfo.dependencyPackages; expect(dependencyPackages).to.exist; @@ -125,13 +125,13 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); // TODO: the input to this test is polluted by other tests: https://github.com/ember-cli/ember-cli/issues/7981 - it.skip('shows projectPackageInfo has 8 devDependencyPackages', function() { + it.skip('shows projectPackageInfo has 8 devDependencyPackages', function () { let devDependencyPackages = projectPackageInfo.devDependencyPackages; expect(devDependencyPackages).to.exist; expect(Object.keys(devDependencyPackages).length).to.equal(8); }); - it('shows projectPackageInfo.devDependencyPackages + missing dependencies = project.devDependencies', function() { + it('shows projectPackageInfo.devDependencyPackages + missing dependencies = project.devDependencies', function () { let devDependencyPackages = projectPackageInfo.devDependencyPackages; expect(devDependencyPackages).to.exist; let devDependencyPackageNames = Object.keys(devDependencyPackages); @@ -151,7 +151,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(packageAndErrorNames).to.deep.equal(devDependencyNames); }); - it('shows projectPackageInfo has 1 in-repo addon named "ember-super-button"', function() { + it('shows projectPackageInfo has 1 in-repo addon named "ember-super-button"', function () { let inRepoAddons = projectPackageInfo.inRepoAddons; expect(inRepoAddons).to.exist; expect(inRepoAddons.length).to.equal(1); @@ -159,14 +159,14 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(inRepoAddons[0].pkg.name).to.equal('ember-super-button'); }); - it('shows projectPackageInfo has 7 internal addon packages', function() { + it('shows projectPackageInfo has 7 internal addon packages', function () { let internalAddons = projectPackageInfo.internalAddons; expect(internalAddons).to.exist; expect(internalAddons.length).to.equal(7); }); // TODO: the input to this test is polluted by other tests: https://github.com/ember-cli/ember-cli/issues/7981 - it.skip('shows projectPackageInfo has 9 node-module entries', function() { + it.skip('shows projectPackageInfo has 9 node-module entries', function () { let nodeModules = projectPackageInfo.nodeModules; expect(nodeModules).to.exist; expect(nodeModules.entries).to.exist; @@ -174,17 +174,17 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - describe('packageInfo', function() { - describe('project with invalid paths', function() { + describe('packageInfo', function () { + describe('project with invalid paths', function () { let project, fixturifyProject; - beforeEach(function() { + beforeEach(function () { // create a new ember-app - fixturifyProject = new FixturifyProject('simple-ember-app', '0.0.0', project => { + fixturifyProject = new FixturifyProject('simple-ember-app', '0.0.0', (project) => { project.addAddon('ember-resolver', '^5.0.1'); project.addAddon('ember-random-addon', 'latest'); project.addAddon('loader.js', 'latest'); project.addAddon('something-else', 'latest'); - project.addInRepoAddon('ember-super-button', 'latest', function(project) { + project.addInRepoAddon('ember-super-button', 'latest', function (project) { project.pkg['ember-addon'].paths = ['lib/herp-not-here']; }); project.addDevDependency('ember-cli', 'latest'); @@ -197,35 +197,35 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { project = fixturifyProject.buildProjectModel(Project); }); - afterEach(function() { + afterEach(function () { fixturifyProject.dispose(); delete process.env.EMBER_CLI_ERROR_ON_INVALID_ADDON; }); - it('shows a warning with invalid ember-addon#path', function() { + it('shows a warning with invalid ember-addon#path', function () { project.discoverAddons(); expect(project.cli.ui.output).to.include( `specifies an invalid, malformed or missing addon at relative path 'lib${path.sep}no-such-path'` ); }); - it('throws an error with flag on', function() { + it('throws an error with flag on', function () { process.env.EMBER_CLI_ERROR_ON_INVALID_ADDON = 'true'; expect(() => project.discoverAddons()).to.throw( /specifies an invalid, malformed or missing addon at relative path 'lib[\\/]no-such-path'/ ); }); }); - describe('valid project', function() { + describe('valid project', function () { let project, fixturifyProject; - before(function() { + before(function () { // create a new ember-app - fixturifyProject = new FixturifyProject('simple-ember-app', '0.0.0', project => { + fixturifyProject = new FixturifyProject('simple-ember-app', '0.0.0', (project) => { project.addAddon('ember-resolver', '^5.0.1'); - project.addAddon('ember-random-addon', 'latest', addon => { - addon.addAddon('other-nested-addon', 'latest', addon => { + project.addAddon('ember-random-addon', 'latest', (addon) => { + addon.addAddon('other-nested-addon', 'latest', (addon) => { addon.addAddon('ember-resolver', '*'); - addon.toJSON = function() { + addon.toJSON = function () { const json = Object.getPrototypeOf(this).toJSON.call(this); // here we introduce an empty folder in our node_modules. json[this.name].node_modules['ember-resolver'] = {}; @@ -250,11 +250,11 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { projectPackageInfo = pic.getEntry(path.join(fixturifyProject.root, 'simple-ember-app')); }); - after(function() { + after(function () { fixturifyProject.dispose(); }); - it('was able to find ember-resolver even if an empty directory was left', function() { + it('was able to find ember-resolver even if an empty directory was left', function () { const emberResolver = project.findAddonByName('ember-resolver'); const nestedEmberResolver = project.findAddonByName('ember-random-addon').addons[0].addons[0]; expect(emberResolver.name).to.eql('ember-resolver'); @@ -262,7 +262,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(emberResolver.root).to.eql(nestedEmberResolver.root); }); - it('has dependencies who have their mayHaveAddons correctly set', function() { + it('has dependencies who have their mayHaveAddons correctly set', function () { expect(projectPackageInfo.devDependencyPackages['non-ember-thingy']).to.have.property('mayHaveAddons', false); expect(projectPackageInfo.devDependencyPackages['ember-cli']).to.have.property('mayHaveAddons', false); expect(projectPackageInfo.dependencyPackages['loader.js']).to.have.property('mayHaveAddons', true); @@ -271,18 +271,18 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(projectPackageInfo.dependencyPackages['something-else']).to.have.property('mayHaveAddons', true); }); - it('validates projectPackageInfo', function() { + it('validates projectPackageInfo', function () { expect(projectPackageInfo).to.exist; expect(projectPackageInfo.pkg).to.exist; expect(projectPackageInfo.valid).to.be.true; }); - it('shows projectPackageInfo has 0 errors', function() { + it('shows projectPackageInfo has 0 errors', function () { expect(projectPackageInfo.hasErrors()).to.be.false; expect(projectPackageInfo.errors.getErrors()).to.have.property('length', 0); }); - it('shows projectPackageInfo has 1 dependencyPackage', function() { + it('shows projectPackageInfo has 1 dependencyPackage', function () { let dependencyPackages = projectPackageInfo.dependencyPackages; expect(dependencyPackages).to.exist; @@ -290,14 +290,14 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(dependencyPackages['something-else']).to.exist; }); - it('shows projectPackageInfo has 82devDependencyPackages', function() { + it('shows projectPackageInfo has 82devDependencyPackages', function () { let devDependencyPackages = projectPackageInfo.devDependencyPackages; expect(devDependencyPackages).to.exist; expect(Object.keys(devDependencyPackages).length).to.equal(2); }); - it('shows projectPackageInfo has 1 in-repo addon named "ember-super-button"', function() { + it('shows projectPackageInfo has 1 in-repo addon named "ember-super-button"', function () { let inRepoAddons = projectPackageInfo.inRepoAddons; expect(inRepoAddons).to.exist; @@ -306,14 +306,14 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(inRepoAddons[0].pkg.name).to.equal('ember-super-button'); }); - it('shows projectPackageInfo has 7 internal addon packages', function() { + it('shows projectPackageInfo has 7 internal addon packages', function () { let internalAddons = projectPackageInfo.internalAddons; expect(internalAddons).to.exist; expect(internalAddons.length).to.equal(7); }); - it('shows projectPackageInfo has 7 node-module entries', function() { + it('shows projectPackageInfo has 7 node-module entries', function () { let nodeModules = projectPackageInfo.nodeModules; expect(nodeModules).to.exist; @@ -323,8 +323,8 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - describe('packageInfo contents tests on missing project', function() { - beforeEach(function() { + describe('packageInfo contents tests on missing project', function () { + beforeEach(function () { projectPath = path.resolve(addonFixturePath, 'fakepackage'); let deps = { @@ -347,27 +347,27 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { projectPackageInfo = pic.getEntry(projectPath); }); - it('creates a packageInfo object for the missing path', function() { + it('creates a packageInfo object for the missing path', function () { expect(projectPackageInfo).to.exist; }); - it('has 3 errors', function() { + it('has 3 errors', function () { let errors = projectPackageInfo.errors; expect(errors).to.exist; expect(errors.hasErrors()).to.be.true; expect(errors.getErrors().length).to.equal(3); }); - it('has a "packageDirectoryMissing" error', function() { + it('has a "packageDirectoryMissing" error', function () { let errorArray = projectPackageInfo.errors.getErrors(); - let pkgDirMissingErr = errorArray.find(function(err) { + let pkgDirMissingErr = errorArray.find(function (err) { return err.type === 'packageDirectoryMissing'; }); expect(pkgDirMissingErr).to.exist; expect(pkgDirMissingErr.data).to.equal(projectPath); }); - it('has empty "dependencyPackages" and "devDependencyPackages" objects', function() { + it('has empty "dependencyPackages" and "devDependencyPackages" objects', function () { expect(projectPackageInfo.dependencyPackages).to.exist; expect(projectPackageInfo.devDependencyPackages).to.exist; expect(Object.keys(projectPackageInfo.dependencyPackages).length).to.equal(0); @@ -375,8 +375,8 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - describe('packageInfo contents tests on with-nested-addons project', function() { - beforeEach(function() { + describe('packageInfo contents tests on with-nested-addons project', function () { + beforeEach(function () { projectPath = path.resolve(addonFixturePath, 'with-nested-addons'); packageJsonPath = path.join(projectPath, 'package.json'); packageContents = null; // there is no actual package.json @@ -386,9 +386,9 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { projectPackageInfo = pic.getEntry(projectPath); }); - it('shows projectPackageInfo has a "packageJsonMissing" error', function() { + it('shows projectPackageInfo has a "packageJsonMissing" error', function () { let errorArray = projectPackageInfo.errors.getErrors(); - let pkgJsonMissingErr = errorArray.find(function(err) { + let pkgJsonMissingErr = errorArray.find(function (err) { return err.type === 'packageJsonMissing'; }); expect(pkgJsonMissingErr).to.exist; @@ -396,8 +396,8 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - describe('packageInfo contents tests on external-dependency project', function() { - beforeEach(function() { + describe('packageInfo contents tests on external-dependency project', function () { + beforeEach(function () { projectPath = path.resolve(addonFixturePath, 'external-dependency'); packageJsonPath = path.join(projectPath, 'package.json'); packageContents = require(packageJsonPath); @@ -407,7 +407,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { projectPackageInfo = pic.getEntry(projectPath); }); - it('shows projectPackageInfo finds a dependency above project root', function() { + it('shows projectPackageInfo finds a dependency above project root', function () { expect(projectPackageInfo.dependencyPackages).to.exist; let emberCliStringUtilsPkgInfo = projectPackageInfo.dependencyPackages['ember-cli-string-utils']; @@ -419,7 +419,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { ); }); - it('shows projectPackageInfo finds an external dependency involving a scope', function() { + it('shows projectPackageInfo finds an external dependency involving a scope', function () { expect(projectPackageInfo.dependencyPackages).to.exist; let restPkgInfo = projectPackageInfo.dependencyPackages['@octokit/rest']; @@ -430,18 +430,18 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - describe('discoverProjectAddons', function() { + describe('discoverProjectAddons', function () { let fixturifyProject; - afterEach(function() { + afterEach(function () { if (fixturifyProject) { fixturifyProject.dispose(); } }); - describe('within an addon', function() { - beforeEach(function() { - fixturifyProject = new FixturifyProject('external-dependency', '0.0.0', project => { + describe('within an addon', function () { + beforeEach(function () { + fixturifyProject = new FixturifyProject('external-dependency', '0.0.0', (project) => { project.addDevDependency('ember-cli-string-utils', 'latest'); project.addDevDependency('@octokit/rest', 'latest'); project.addAddon('ember-cli-blueprint-test-helpers', 'latest'); @@ -461,7 +461,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - it('lock down dependency orderings', function() { + it('lock down dependency orderings', function () { let project = fixturifyProject.buildProjectModel(); project.discoverAddons(); @@ -489,10 +489,10 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { }); }); - describe('tests for projectPackageInfo.addonMainPath', function() { + describe('tests for projectPackageInfo.addonMainPath', function () { let origPackageContents; - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(addonFixturePath, 'external-dependency'); packageJsonPath = path.join(projectPath, 'package.json'); // Because we allow the tests to modify packageContents, and the original @@ -507,7 +507,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { packageContents = JSON.parse(JSON.stringify(origPackageContents)); }); - it('adds .js if not present', function() { + it('adds .js if not present', function () { packageContents['ember-addon']['main'] = 'index'; project = new Project(projectPath, packageContents, ui, cli); @@ -517,7 +517,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(resolvedFile).to.equal('index.js'); }); - it("doesn't add .js if it is .js", function() { + it("doesn't add .js if it is .js", function () { packageContents['ember-addon']['main'] = 'index.js'; project = new Project(projectPath, packageContents, ui, cli); @@ -527,7 +527,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(resolvedFile).to.equal('index.js'); }); - it("doesn't add .js if it has another extension", function() { + it("doesn't add .js if it has another extension", function () { packageContents['ember-addon']['main'] = 'index.coffee'; project = new Project(projectPath, packageContents, ui, cli); @@ -537,7 +537,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(resolvedFile).to.equal('index.coffee'); }); - it('allows lookup of existing non-`index.js` `main` entry points', function() { + it('allows lookup of existing non-`index.js` `main` entry points', function () { delete packageContents['ember-addon']; packageContents['main'] = 'some/other/path.js'; @@ -548,7 +548,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(resolvedFile).to.equal(path.join(projectPath, 'some/other/path.js')); }); - it('fails invalid other `main` entry points', function() { + it('fails invalid other `main` entry points', function () { delete packageContents['ember-addon']; packageContents['main'] = 'some/other/non-existent-file.js'; @@ -561,7 +561,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(error.type).to.equal('emberAddonMainMissing'); }); - it('falls back to `index.js` if `main` and `ember-addon` are not found', function() { + it('falls back to `index.js` if `main` and `ember-addon` are not found', function () { delete packageContents['ember-addon']; project = new Project(projectPath, packageContents, ui, cli); @@ -571,7 +571,7 @@ describe('models/package-info-cache/package-info-cache-test.js', function() { expect(resolvedFile).to.equal(path.join(projectPath, 'index.js')); }); - it('falls back to `index.js` if `main` and `ember-addon.main` are not found', function() { + it('falls back to `index.js` if `main` and `ember-addon.main` are not found', function () { delete packageContents['ember-addon'].main; project = new Project(projectPath, packageContents, ui, cli); diff --git a/tests/unit/models/project-test.js b/tests/unit/models/project-test.js index ce442f1f85..2e58930915 100644 --- a/tests/unit/models/project-test.js +++ b/tests/unit/models/project-test.js @@ -11,7 +11,7 @@ const emberCLIVersion = require('../../../lib/utilities/version-utils').emberCLI const td = require('testdouble'); const MockCLI = require('../../helpers/mock-cli'); -describe('models/project.js', function() { +describe('models/project.js', function () { let project, projectPath, packageContents; function makeProject() { @@ -19,24 +19,24 @@ describe('models/project.js', function() { project = new Project(projectPath, packageContents, cli.ui, cli); } - beforeEach(function() { + beforeEach(function () { packageContents = {}; }); - afterEach(function() { + afterEach(function () { if (project) { project = null; } }); - describe('constructor', function() { - it('sets up bidirectional instrumentation', function() { + describe('constructor', function () { + it('sets up bidirectional instrumentation', function () { let cli = new MockCLI(); expect(cli.instrumentation.project).to.equal(null); projectPath = 'tmp/test-app'; - return tmp.setup(projectPath).then(function() { + return tmp.setup(projectPath).then(function () { touch(`${projectPath}/config/environment.js`, { baseURL: '/foo/bar', }); @@ -48,13 +48,13 @@ describe('models/project.js', function() { }); }); - describe('Project.prototype.config', function() { + describe('Project.prototype.config', function () { let called; projectPath = 'tmp/test-app'; - beforeEach(function() { + beforeEach(function () { called = false; - return tmp.setup(projectPath).then(function() { + return tmp.setup(projectPath).then(function () { touch(`${projectPath}/config/environment.js`, { baseURL: '/foo/bar', }); @@ -69,24 +69,24 @@ describe('models/project.js', function() { makeProject(); - project.require = function() { + project.require = function () { called = true; - return function() {}; + return function () {}; }; }); }); - afterEach(function() { + afterEach(function () { called = null; return tmp.teardown(projectPath); }); - it('config() finds and requires config/environment', function() { + it('config() finds and requires config/environment', function () { project.config('development'); expect(called).to.equal(true); }); - it('config() with no args returns the config corresponding to the current EMBER_ENV', function() { + it('config() with no args returns the config corresponding to the current EMBER_ENV', function () { process.env.EMBER_ENV = 'testing'; project.config(); @@ -99,8 +99,8 @@ describe('models/project.js', function() { expect(configCacheKey).to.match(/testing/i); }); - describe('memoizes', function() { - it('memoizes', function() { + describe('memoizes', function () { + it('memoizes', function () { project.config('development'); expect(called).to.equal(true); called = false; @@ -108,8 +108,8 @@ describe('models/project.js', function() { expect(called).to.equal(false); }); - it('considers configPath when memoizing', function() { - project.configPath = function() { + it('considers configPath when memoizing', function () { + project.configPath = function () { return `${projectPath}/config/a`; }; project.config('development'); @@ -117,7 +117,7 @@ describe('models/project.js', function() { expect(called).to.equal(true); called = false; - project.configPath = function() { + project.configPath = function () { return `${projectPath}/config/a`; }; project.config('development'); @@ -125,7 +125,7 @@ describe('models/project.js', function() { expect(called).to.equal(false); called = false; - project.configPath = function() { + project.configPath = function () { return `${projectPath}/config/b`; }; project.config('development'); @@ -140,7 +140,7 @@ describe('models/project.js', function() { }); }); - it('configPath() returns tests/dummy/config/environment', function() { + it('configPath() returns tests/dummy/config/environment', function () { project.pkg = { 'ember-addon': { configPath: 'tests/dummy/config', @@ -152,10 +152,10 @@ describe('models/project.js', function() { expect(project.configPath().slice(-expected.length)).to.equal(expected); }); - it('calls getAddonsConfig', function() { + it('calls getAddonsConfig', function () { let addonConfigCalled = false; - project.getAddonsConfig = function() { + project.getAddonsConfig = function () { addonConfigCalled = true; return {}; @@ -165,12 +165,12 @@ describe('models/project.js', function() { expect(addonConfigCalled).to.equal(true); }); - it('returns getAddonsConfig result when configPath is not present', function() { + it('returns getAddonsConfig result when configPath is not present', function () { let expected = { foo: 'bar', }; - project.getAddonsConfig = function() { + project.getAddonsConfig = function () { return expected; }; @@ -178,10 +178,10 @@ describe('models/project.js', function() { expect(actual).to.deep.equal(expected); }); - describe('merges getAddonsConfig result with app config', function() { + describe('merges getAddonsConfig result with app config', function () { let projectConfig, addon1Config, addon2Config; - beforeEach(function() { + beforeEach(function () { addon1Config = { addon: { derp: 'herp' } }; addon2Config = { addon: { blammo: 'blahzorz' } }; @@ -201,14 +201,14 @@ describe('models/project.js', function() { project._addonsInitialized = true; - project.require = function() { - return function() { + project.require = function () { + return function () { return projectConfig; }; }; }); - it('merges getAddonsConfig result with app config', function() { + it('merges getAddonsConfig result with app config', function () { let expected = { foo: 'bar', baz: 'qux', @@ -222,7 +222,7 @@ describe('models/project.js', function() { expect(actual).to.deep.equal(expected); }); - it('getAddonsConfig does NOT override project config', function() { + it('getAddonsConfig does NOT override project config', function () { let expected = { foo: 'bar', baz: 'qux', @@ -240,18 +240,18 @@ describe('models/project.js', function() { }); }); - describe('Project.prototype.targets', function() { - beforeEach(function() { + describe('Project.prototype.targets', function () { + beforeEach(function () { projectPath = 'tmp/test-app'; }); - afterEach(function() { + afterEach(function () { return tmp.teardown(projectPath); }); - describe('when the is a `/config/targets.js` file', function() { - beforeEach(function() { - return tmp.setup(projectPath).then(function() { + describe('when the is a `/config/targets.js` file', function () { + beforeEach(function () { + return tmp.setup(projectPath).then(function () { let targetsPath = path.join(projectPath, 'config', 'targets.js'); fs.createFileSync(targetsPath); fs.writeFileSync(targetsPath, 'module.exports = { browsers: ["last 2 versions", "safari >= 7"] };', { @@ -260,27 +260,27 @@ describe('models/project.js', function() { makeProject(); - project.require = function() { + project.require = function () { return { browsers: ['last 2 versions', 'safari >= 7'] }; }; }); }); - it('returns the object defined in `/config/targets` if present', function() { + it('returns the object defined in `/config/targets` if present', function () { expect(project.targets).to.deep.equal({ browsers: ['last 2 versions', 'safari >= 7'], }); }); }); - describe("when there isn't a `/config/targets.js` file", function() { - beforeEach(function() { - return tmp.setup(projectPath).then(function() { + describe("when there isn't a `/config/targets.js` file", function () { + beforeEach(function () { + return tmp.setup(projectPath).then(function () { makeProject(); }); }); - it('returns the default targets', function() { + it('returns the default targets', function () { expect(project.targets).to.deep.equal({ browsers: ['ie 11', 'last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions'], }); @@ -288,8 +288,8 @@ describe('models/project.js', function() { }); }); - describe('addons', function() { - beforeEach(function() { + describe('addons', function () { + beforeEach(function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/simple'); packageContents = require(path.join(projectPath, 'package.json')); @@ -298,7 +298,7 @@ describe('models/project.js', function() { project.initializeAddons(); }); - it("returns a listing of all dependencies in the project's package.json", function() { + it("returns a listing of all dependencies in the project's package.json", function () { let expected = { 'ember-cli': 'latest', 'ember-random-addon': 'latest', @@ -317,7 +317,7 @@ describe('models/project.js', function() { expect(project.dependencies()).to.deep.equal(expected); }); - it("returns a listing of all dependencies in the project's bower.json", function() { + it("returns a listing of all dependencies in the project's bower.json", function () { let expected = { jquery: '^1.11.1', ember: '1.7.0', @@ -330,7 +330,7 @@ describe('models/project.js', function() { expect(project.bowerDependencies()).to.deep.equal(expected); }); - it('returns a listing of all ember-cli-addons directly depended on by the project', function() { + it('returns a listing of all ember-cli-addons directly depended on by the project', function () { let expected = [ 'amd-transform', 'broccoli-serve-files', @@ -351,7 +351,7 @@ describe('models/project.js', function() { expect(Object.keys(project.addonPackages)).to.deep.equal(expected); }); - it('returns instances of the addons', function() { + it('returns instances of the addons', function () { let addons = project.addons; expect(addons[8].name).to.equal('ember-before-blueprint-addon'); @@ -360,25 +360,25 @@ describe('models/project.js', function() { expect(addons[14].addons[1].name).to.equal('ember-ng'); }); - it('addons get passed the project instance', function() { + it('addons get passed the project instance', function () { let addons = project.addons; expect(addons[1].project).to.equal(project); }); - it('returns an instance of an addon that uses `ember-addon-main`', function() { + it('returns an instance of an addon that uses `ember-addon-main`', function () { let addons = project.addons; expect(addons[10].name).to.equal('ember-random-addon'); }); - it('returns the default blueprints path', function() { + it('returns the default blueprints path', function () { let expected = project.root + path.normalize('/blueprints'); expect(project.localBlueprintLookupPath()).to.equal(expected); }); - it('returns a listing of all addon blueprints paths ordered by last loaded when called once', function() { + it('returns a listing of all addon blueprints paths ordered by last loaded when called once', function () { let loadedBlueprintPaths = [ project.root + path.normalize('/node_modules/ember-before-blueprint-addon/blueprints'), project.root + path.normalize('/node_modules/ember-random-addon/blueprints'), @@ -392,7 +392,7 @@ describe('models/project.js', function() { expect(first).to.deep.equal(expected); }); - it('returns a listing of all addon blueprints paths ordered by last loaded when called twice', function() { + it('returns a listing of all addon blueprints paths ordered by last loaded when called twice', function () { let loadedBlueprintPaths = [ project.root + path.normalize('/node_modules/ember-before-blueprint-addon/blueprints'), project.root + path.normalize('/node_modules/ember-random-addon/blueprints'), @@ -407,7 +407,7 @@ describe('models/project.js', function() { expect(second).to.deep.equal(expected); }); - it('returns a listing of all blueprints paths', function() { + it('returns a listing of all blueprints paths', function () { let expected = [ project.root + path.normalize('/blueprints'), project.root + path.normalize('/node_modules/ember-after-blueprint-addon/blueprints'), @@ -418,24 +418,24 @@ describe('models/project.js', function() { expect(project.blueprintLookupPaths()).to.deep.equal(expected); }); - it('does not include blueprint path relative to root if outside a project', function() { - project.isEmberCLIProject = function() { + it('does not include blueprint path relative to root if outside a project', function () { + project.isEmberCLIProject = function () { return false; }; expect(project.blueprintLookupPaths()).to.deep.equal(project.addonBlueprintLookupPaths()); }); - it('returns an instance of an addon with an object export', function() { + it('returns an instance of an addon with an object export', function () { let addons = project.addons; expect(addons[13] instanceof Addon).to.equal(true); expect(addons[13].name).to.equal('ember-generated-with-export-addon'); }); - it('adds the project itself if it is an addon', function() { + it('adds the project itself if it is an addon', function () { project.addonPackages = {}; - project.isEmberCLIAddon = function() { + project.isEmberCLIAddon = function () { return true; }; @@ -444,7 +444,7 @@ describe('models/project.js', function() { expect(project.addonPackages[project.name()]).to.exist; }); - it('should catch addon constructor errors', function() { + it('should catch addon constructor errors', function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/invalid-constructor'); packageContents = require(path.join(projectPath, 'package.json')); @@ -460,8 +460,8 @@ describe('models/project.js', function() { }); }); - describe('reloadAddon', function() { - beforeEach(function() { + describe('reloadAddon', function () { + beforeEach(function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/simple'); packageContents = require(path.join(projectPath, 'package.json')); @@ -475,26 +475,26 @@ describe('models/project.js', function() { project.reloadAddons(); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('sets _addonsInitialized to false', function() { + it('sets _addonsInitialized to false', function () { expect(project._addonsInitialized).to.equal(false); }); - it('reloads the package', function() { + it('reloads the package', function () { td.verify(Project.prototype.reloadPkg(), { ignoreExtraArgs: true }); }); - it('initializes the addons', function() { + it('initializes the addons', function () { td.verify(Project.prototype.initializeAddons(), { ignoreExtraArgs: true }); }); }); - describe('reloadPkg', function() { + describe('reloadPkg', function () { let newProjectPath, oldPkg; - beforeEach(function() { + beforeEach(function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/simple'); packageContents = require(path.join(projectPath, 'package.json')); @@ -508,57 +508,57 @@ describe('models/project.js', function() { project.root = newProjectPath; }); - it('reloads the package from disk', function() { + it('reloads the package from disk', function () { project.reloadPkg(); expect(oldPkg).to.not.deep.equal(project.pkg); }); }); - describe('emberCLIVersion', function() { - beforeEach(function() { + describe('emberCLIVersion', function () { + beforeEach(function () { projectPath = `${process.cwd()}/tmp/test-app`; makeProject(); }); - it('should return the same value as the utility function', function() { + it('should return the same value as the utility function', function () { expect(project.emberCLIVersion()).to.equal(emberCLIVersion()); }); }); - describe('isEmberCLIProject', function() { - beforeEach(function() { + describe('isEmberCLIProject', function () { + beforeEach(function () { projectPath = `${process.cwd()}/tmp/test-app`; makeProject(); }); - it('returns false when `ember-cli` is not a dependency', function() { + it('returns false when `ember-cli` is not a dependency', function () { expect(project.isEmberCLIProject()).to.equal(false); }); - it('returns true when `ember-cli` is a devDependency', function() { + it('returns true when `ember-cli` is a devDependency', function () { project.pkg.devDependencies = { 'ember-cli': '*' }; expect(project.isEmberCLIProject()).to.equal(true); }); - it('returns true when `ember-cli` is a dependency', function() { + it('returns true when `ember-cli` is a dependency', function () { project.pkg.dependencies = { 'ember-cli': '*' }; expect(project.isEmberCLIProject()).to.equal(true); }); }); - describe('isEmberCLIAddon', function() { - beforeEach(function() { + describe('isEmberCLIAddon', function () { + beforeEach(function () { projectPath = `${process.cwd()}/tmp/test-app`; makeProject(); project.initializeAddons(); }); - it('should return true if `ember-addon` is included in keywords', function() { + it('should return true if `ember-addon` is included in keywords', function () { project.pkg = { keywords: ['ember-addon'], }; @@ -566,7 +566,7 @@ describe('models/project.js', function() { expect(project.isEmberCLIAddon()).to.equal(true); }); - it('should return false if `ember-addon` is not included in keywords', function() { + it('should return false if `ember-addon` is not included in keywords', function () { project.pkg = { keywords: [], }; @@ -575,8 +575,8 @@ describe('models/project.js', function() { }); }); - describe('findAddonByName', function() { - beforeEach(function() { + describe('findAddonByName', function () { + beforeEach(function () { projectPath = `${process.cwd()}/tmp/test-app`; makeProject(); @@ -598,16 +598,16 @@ describe('models/project.js', function() { ]; }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('should call initialize addons', function() { + it('should call initialize addons', function () { project.findAddonByName('foo'); td.verify(project.initializeAddons(), { ignoreExtraArgs: true }); }); - it('generally should work and defer to findAddonByName utlity', function() { + it('generally should work and defer to findAddonByName utlity', function () { let addon; addon = project.findAddonByName('foo'); expect(addon.name).to.equal('foo', 'should have found the foo addon'); @@ -617,49 +617,49 @@ describe('models/project.js', function() { }); }); - describe('bowerDirectory', function() { - beforeEach(function() { + describe('bowerDirectory', function () { + beforeEach(function () { projectPath = path.resolve(__dirname, '../../fixtures/addon/simple'); makeProject(); }); - it('should be initialized in constructor', function() { + it('should be initialized in constructor', function () { expect(project.bowerDirectory).to.equal('bower_components'); }); - it('should be set to directory property in .bowerrc', function() { + it('should be set to directory property in .bowerrc', function () { projectPath = path.resolve(__dirname, '../../fixtures/bower-directory-tests/bowerrc-with-directory'); makeProject(); expect(project.bowerDirectory).to.equal('vendor'); }); - it('should default to ‘bower_components’ unless directory property is set in .bowerrc', function() { + it('should default to ‘bower_components’ unless directory property is set in .bowerrc', function () { projectPath = path.resolve(__dirname, '../../fixtures/bower-directory-tests/bowerrc-without-directory'); makeProject(); expect(project.bowerDirectory).to.equal('bower_components'); }); - it('should default to ‘bower_components’ if .bowerrc is not present', function() { + it('should default to ‘bower_components’ if .bowerrc is not present', function () { projectPath = path.resolve(__dirname, '../../fixtures/bower-directory-tests/no-bowerrc'); makeProject(); expect(project.bowerDirectory).to.equal('bower_components'); }); - it('should default to ‘bower_components’ if .bowerrc json is invalid', function() { + it('should default to ‘bower_components’ if .bowerrc json is invalid', function () { projectPath = path.resolve(__dirname, '../../fixtures/bower-directory-tests/invalid-bowerrc'); makeProject(); expect(project.bowerDirectory).to.equal('bower_components'); }); }); - describe('.nullProject', function() { - it('is a singleton', function() { + describe('.nullProject', function () { + it('is a singleton', function () { expect(Project.nullProject()).to.equal(Project.nullProject()); }); }); - describe('generateTestFile()', function() { - it('returns empty file and shows warning', function() { + describe('generateTestFile()', function () { + it('returns empty file and shows warning', function () { projectPath = path.resolve(__dirname, '../../fixtures/project'); makeProject(); diff --git a/tests/unit/models/server-watcher-test.js b/tests/unit/models/server-watcher-test.js index 4b247170f8..11b5ff88f4 100644 --- a/tests/unit/models/server-watcher-test.js +++ b/tests/unit/models/server-watcher-test.js @@ -7,12 +7,12 @@ const MockAnalytics = require('../../helpers/mock-analytics'); const MockServerWatcher = require('../../helpers/mock-watcher'); const ServerWatcher = require('../../../lib/models/server-watcher'); -describe('Server Watcher', function() { +describe('Server Watcher', function () { let ui; let analytics; let watcher; - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); analytics = new MockAnalytics(); watcher = new MockServerWatcher(); @@ -24,44 +24,44 @@ describe('Server Watcher', function() { }); }); - describe('watcher:change', function() { - beforeEach(function() { + describe('watcher:change', function () { + beforeEach(function () { watcher.emit('change', 'foo.txt'); }); - it('logs that the file was changed', function() { + it('logs that the file was changed', function () { expect(ui.output).to.equal(`File changed: "foo.txt"${EOL}`); }); - it('does NOT tracks changes', function() { + it('does NOT tracks changes', function () { expect(analytics.tracks).to.deep.equal([]); }); }); - describe('watcher:add', function() { - beforeEach(function() { + describe('watcher:add', function () { + beforeEach(function () { watcher.emit('add', 'foo.txt'); }); - it('logs that the file was added', function() { + it('logs that the file was added', function () { expect(ui.output).to.equal(`File added: "foo.txt"${EOL}`); }); - it('does NOT track additions', function() { + it('does NOT track additions', function () { expect(analytics.tracks).to.deep.equal([]); }); }); - describe('watcher:delete', function() { - beforeEach(function() { + describe('watcher:delete', function () { + beforeEach(function () { watcher.emit('delete', 'foo.txt'); }); - it('logs that the file was deleted', function() { + it('logs that the file was deleted', function () { expect(ui.output).to.equal(`File deleted: "foo.txt"${EOL}`); }); - it('does NOT tracks deletions', function() { + it('does NOT tracks deletions', function () { expect(analytics.tracks).to.deep.equal([]); }); }); diff --git a/tests/unit/models/watcher-test.js b/tests/unit/models/watcher-test.js index 2b434fbd36..4f31df86af 100644 --- a/tests/unit/models/watcher-test.js +++ b/tests/unit/models/watcher-test.js @@ -10,7 +10,7 @@ const EOL = require('os').EOL; const chalk = require('chalk'); const BuildError = require('../../helpers/build-error'); -describe('Watcher', function() { +describe('Watcher', function () { let ui; let subject; let builder; @@ -35,7 +35,7 @@ describe('Watcher', function() { }, }; - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); analytics = new MockAnalytics(); @@ -49,8 +49,8 @@ describe('Watcher', function() { }); }); - describe('watcher strategy selection', function() { - it('selects the events-based watcher by default', function() { + describe('watcher strategy selection', function () { + it('selects the events-based watcher by default', function () { subject.options = null; expect(subject.buildOptions()).to.deep.equal({ @@ -61,7 +61,7 @@ describe('Watcher', function() { }); }); - it('selects the events-based watcher when given events watcher option', function() { + it('selects the events-based watcher when given events watcher option', function () { subject.options = { watcher: 'events', }; @@ -74,7 +74,7 @@ describe('Watcher', function() { }); }); - it('selects the polling watcher when given polling watcher option', function() { + it('selects the polling watcher when given polling watcher option', function () { subject.options = { watcher: 'polling', }; @@ -88,27 +88,27 @@ describe('Watcher', function() { }); }); - describe('underlining watcher properly logs change events', function() { - it('logs that the file was added', function() { + describe('underlining watcher properly logs change events', function () { + it('logs that the file was added', function () { watcher.emit('change', 'add', 'foo.txt'); expect(ui.output).to.equal(`file added foo.txt${EOL}`); }); - it('logs that the file was changed', function() { + it('logs that the file was changed', function () { watcher.emit('change', 'change', 'foo.txt'); expect(ui.output).to.equal(`file changed foo.txt${EOL}`); }); - it('logs that the file was deleted', function() { + it('logs that the file was deleted', function () { watcher.emit('change', 'delete', 'foo.txt'); expect(ui.output).to.equal(`file deleted foo.txt${EOL}`); }); }); - describe(`watcher:buildSuccess`, function() { - beforeEach(function() { + describe(`watcher:buildSuccess`, function () { + beforeEach(function () { watcher.emit(`buildSuccess`, mockResult); }); - it('tracks events', function() { + it('tracks events', function () { expect(analytics.tracks).to.deep.equal([ { name: 'ember rebuild', @@ -117,7 +117,7 @@ describe('Watcher', function() { ]); }); - it('tracks timings', function() { + it('tracks timings', function () { expect(analytics.trackTimings).to.deep.equal([ { category: 'rebuild', @@ -128,15 +128,15 @@ describe('Watcher', function() { ]); }); - it('logs that the build was successful', function() { + it('logs that the build was successful', function () { expect(ui.output).to.equal(EOL + chalk.green('Build successful (12344ms)') + EOL); }); }); - describe('output', function() { + describe('output', function () { this.timeout(40000); - it('with ssl', function() { + it('with ssl', function () { let subject = new Watcher({ ui, analytics, @@ -166,7 +166,7 @@ describe('Watcher', function() { expect(output[0]).to.equal(`${chalk.green('Build successful (12344ms)')} – Serving on https://localhost:1337/`); }); - it('with baseURL', function() { + it('with baseURL', function () { let subject = new Watcher({ ui, analytics, @@ -196,7 +196,7 @@ describe('Watcher', function() { expect(output.length).to.equal(1, 'expected only one line of output'); }); - it('with rootURL', function() { + it('with rootURL', function () { let subject = new Watcher({ ui, analytics, @@ -227,7 +227,7 @@ describe('Watcher', function() { expect(output.length).to.equal(1, 'expected only one line of output'); }); - it('with empty rootURL', function() { + it('with empty rootURL', function () { let subject = new Watcher({ ui, analytics, @@ -256,7 +256,7 @@ describe('Watcher', function() { expect(output.length).to.equal(1, 'expected only one line of output'); }); - it('with customURL', function() { + it('with customURL', function () { let subject = new Watcher({ ui, analytics, @@ -277,7 +277,7 @@ describe('Watcher', function() { }, }, }); - subject.serveURL = function() { + subject.serveURL = function () { return `http://customurl.com/`; }; subject.didChange(mockResult); @@ -287,8 +287,8 @@ describe('Watcher', function() { }); }); - describe('watcher:error', function() { - it('tracks errors', function() { + describe('watcher:error', function () { + it('tracks errors', function () { watcher.emit('error', { message: 'foo', stack: new Error().stack, @@ -301,7 +301,7 @@ describe('Watcher', function() { ]); }); - it('watcher error', function() { + it('watcher error', function () { watcher.emit('error', { message: 'foo', stack: new Error().stack, @@ -314,7 +314,7 @@ describe('Watcher', function() { expect(outs[0]).to.equal(chalk.red('foo')); }); - it('watcher buildFailure', function() { + it('watcher buildFailure', function () { watcher.emit('buildFailure', { isBuilderError: true, message: 'I am a build error', @@ -330,7 +330,7 @@ describe('Watcher', function() { expect(outs[2]).to.equal(chalk.red('I am a build error')); }); - it('emits without error.file', function() { + it('emits without error.file', function () { subject.didError( new BuildError({ file: 'someFile', @@ -346,7 +346,7 @@ describe('Watcher', function() { expect(outs[2]).to.equal(chalk.red('buildFailed')); }); - it('emits with error.file with error.line without err.col', function() { + it('emits with error.file with error.line without err.col', function () { subject.didError( new BuildError({ file: 'someFile', @@ -363,7 +363,7 @@ describe('Watcher', function() { expect(outs[2]).to.equal(chalk.red('buildFailed')); }); - it('emits with error.file without error.line with err.col', function() { + it('emits with error.file without error.line with err.col', function () { subject.didError( new BuildError({ file: 'someFile', @@ -380,7 +380,7 @@ describe('Watcher', function() { expect(outs[2]).to.equal(chalk.red('buildFailed')); }); - it('emits with error.file with error.line with err.col', function() { + it('emits with error.file with error.line with err.col', function () { subject.didError( new BuildError({ file: 'someFile', @@ -399,8 +399,8 @@ describe('Watcher', function() { }); }); - describe('watcher:change afterError', function() { - beforeEach(function() { + describe('watcher:change afterError', function () { + beforeEach(function () { watcher.emit('error', { message: 'foo', stack: new Error().stack, @@ -409,11 +409,11 @@ describe('Watcher', function() { watcher.emit(`buildSuccess`, mockResult); }); - it('log that the build was green', function() { + it('log that the build was green', function () { expect(ui.output).to.match(/Build successful./, 'has successful build output'); }); - it('keep tracking analytics', function() { + it('keep tracking analytics', function () { expect(analytics.tracks).to.deep.equal([ { name: 'ember rebuild', diff --git a/tests/unit/package/dependency-version-test.js b/tests/unit/package/dependency-version-test.js index 3e052b6815..0a92f422a4 100644 --- a/tests/unit/package/dependency-version-test.js +++ b/tests/unit/package/dependency-version-test.js @@ -2,15 +2,15 @@ const assertVersionLock = require('../../helpers/assert-version-lock'); -describe('dependencies', function() { +describe('dependencies', function () { let pkg; - describe('in package.json', function() { - before(function() { + describe('in package.json', function () { + before(function () { pkg = require('../../../package.json'); }); - it('are locked down for pre-1.0 versions', function() { + it('are locked down for pre-1.0 versions', function () { assertVersionLock(pkg.dependencies); assertVersionLock(pkg.devDependencies); }); diff --git a/tests/unit/settings-file/leek-options-test.js b/tests/unit/settings-file/leek-options-test.js index 52cc0b33db..7876de3a14 100644 --- a/tests/unit/settings-file/leek-options-test.js +++ b/tests/unit/settings-file/leek-options-test.js @@ -9,10 +9,10 @@ const broccoliTestHelper = require('broccoli-test-helper'); const buildOutput = broccoliTestHelper.buildOutput; const createTempDir = broccoliTestHelper.createTempDir; -describe('.ember-cli leek options', function() { +describe('.ember-cli leek options', function () { let passedOptions, leekConfigFolder; - before(async function() { + before(async function () { leekConfigFolder = await createTempDir(); leekConfigFolder.write({ @@ -36,7 +36,7 @@ describe('.ember-cli leek options', function() { primary: primaryPath, }); - let mockedLeek = function(options) { + let mockedLeek = function (options) { passedOptions = options; }; @@ -47,11 +47,11 @@ describe('.ember-cli leek options', function() { }); }); - after(async function() { + after(async function () { await leekConfigFolder.dispose(); }); - it('should contain the leek options from .ember-cli file', function() { + it('should contain the leek options from .ember-cli file', function () { expect(passedOptions.adapterUrls).to.contain.keys(['event', 'exception', 'timing', 'appview']); }); }); diff --git a/tests/unit/settings-file/precedence-settings-test.js b/tests/unit/settings-file/precedence-settings-test.js index 31793bd99d..6e47537b64 100644 --- a/tests/unit/settings-file/precedence-settings-test.js +++ b/tests/unit/settings-file/precedence-settings-test.js @@ -7,14 +7,14 @@ const MockAnalytics = require('../../helpers/mock-analytics'); const Command = require('../../../lib/models/command'); const Yam = require('yam'); -describe('.ember-cli', function() { +describe('.ember-cli', function () { let ui; let analytics; let project; let settings; let homeSettings; - before(function() { + before(function () { ui = new MockUI(); analytics = new MockAnalytics(); project = { @@ -36,7 +36,7 @@ describe('.ember-cli', function() { }).getAll(); }); - it('local settings take precedence over global settings', function() { + it('local settings take precedence over global settings', function () { let command = new Command({ ui, analytics, diff --git a/tests/unit/tasks/addon-install-test.js b/tests/unit/tasks/addon-install-test.js index 66eed5d73e..4ee1b71fc7 100644 --- a/tests/unit/tasks/addon-install-test.js +++ b/tests/unit/tasks/addon-install-test.js @@ -5,25 +5,25 @@ const expect = require('chai').expect; const CoreObject = require('core-object'); const MockUi = require('console-ui/mock'); -describe('addon install task', function() { +describe('addon install task', function () { let ui; let project; - beforeEach(function() { + beforeEach(function () { ui = new MockUi(); project = { reloadAddons() {}, }; }); - afterEach(function() { + afterEach(function () { // ui.stopProgress(); ui = undefined; project = undefined; }); - describe('when no save flag specified in blueprintOptions', function() { - it('calls npm install with --save-dev as a default', function(done) { + describe('when no save flag specified in blueprintOptions', function () { + it('calls npm install with --save-dev as a default', function (done) { let MockNpmInstallTask = CoreObject.extend({ run(options) { expect(options.save).to.not.be.true; @@ -43,8 +43,8 @@ describe('addon install task', function() { }); }); - describe('when save flag specified in blueprintOptions', function() { - it('calls npm install with --save', function(done) { + describe('when save flag specified in blueprintOptions', function () { + it('calls npm install with --save', function (done) { let MockNpmInstallTask = CoreObject.extend({ run(options) { expect(options.save).to.be.true; @@ -68,8 +68,8 @@ describe('addon install task', function() { }); }); - describe('when saveDev flag specified in blueprintOptions', function() { - it('calls npm install with --save-dev', function(done) { + describe('when saveDev flag specified in blueprintOptions', function () { + it('calls npm install with --save-dev', function (done) { let MockNpmInstallTask = CoreObject.extend({ run(options) { expect(options.save).to.not.be.true; @@ -93,8 +93,8 @@ describe('addon install task', function() { }); }); - describe('when both save and saveDev flag specified in blueprintOptions', function() { - it('calls npm install with --save', function(done) { + describe('when both save and saveDev flag specified in blueprintOptions', function () { + it('calls npm install with --save', function (done) { let MockNpmInstallTask = CoreObject.extend({ run(options) { expect(options.save).to.be.true; diff --git a/tests/unit/tasks/bower-install-test.js b/tests/unit/tasks/bower-install-test.js index 6045016679..926dcc3ad0 100644 --- a/tests/unit/tasks/bower-install-test.js +++ b/tests/unit/tasks/bower-install-test.js @@ -5,22 +5,22 @@ const MockUI = require('console-ui/mock'); const expect = require('../../chai').expect; const td = require('testdouble'); -describe('BowerInstallTask', function() { +describe('BowerInstallTask', function () { let task, ui; - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); task = new BowerInstallTask({ ui }); }); - describe('ensureBower()', function() { - beforeEach(function() { + describe('ensureBower()', function () { + beforeEach(function () { task.resolveBower = td.function(); task.importBower = td.function(); task.installBower = td.function(); }); - it('resolves if "bower" property is set', async function() { + it('resolves if "bower" property is set', async function () { let mockValue = 'foobar'; task.bower = mockValue; @@ -30,14 +30,14 @@ describe('BowerInstallTask', function() { expect(task.bower).to.equal(mockValue); }); - it('imports "bower" if it can be resolved', async function() { + it('imports "bower" if it can be resolved', async function () { td.when(task.resolveBower()).thenResolve('path/to/bower'); td.when(task.importBower('path/to/bower')).thenReturn('ok'); expect(await task.ensureBower()).to.equal('ok'); }); - it('install "bower" if it can not be resolved', async function() { + it('install "bower" if it can not be resolved', async function () { let error = new Error("Cannot find module 'bower'"); td.when(task.resolveBower()).thenReturn(Promise.reject(error), Promise.resolve('path/to/bower')); @@ -47,7 +47,7 @@ describe('BowerInstallTask', function() { expect(await task.ensureBower()).to.equal('ok'); }); - it('pass other resolve errors on', async function() { + it('pass other resolve errors on', async function () { let error = new Error('foobar'); td.when(task.resolveBower()).thenReturn(Promise.reject(error)); @@ -55,7 +55,7 @@ describe('BowerInstallTask', function() { await expect(task.ensureBower()).to.be.rejectedWith('foobar'); }); - it('pass install errors on', async function() { + it('pass install errors on', async function () { let error = new Error("Cannot find module 'bower'"); td.when(task.resolveBower()).thenReturn(Promise.reject(error)); diff --git a/tests/unit/tasks/build-watch-test.js b/tests/unit/tasks/build-watch-test.js index a9162943b9..111cfbeeaa 100644 --- a/tests/unit/tasks/build-watch-test.js +++ b/tests/unit/tasks/build-watch-test.js @@ -5,7 +5,7 @@ const Builder = require('../../../lib/models/builder'); const MockProject = require('../../helpers/mock-project'); const expect = require('chai').expect; -describe('build-watch task', function() { +describe('build-watch task', function () { let task, ui; function setupBroccoliBuilder() { @@ -58,8 +58,8 @@ describe('build-watch task', function() { return task.run(options); } - describe('onInterrupt', function() { - it('fulfills the run promise and cleans up the builder', async function() { + describe('onInterrupt', function () { + it('fulfills the run promise and cleans up the builder', async function () { let runPromise = runBuildWatchTask(); Promise.resolve().then(() => task.onInterrupt()); diff --git a/tests/unit/tasks/git-init-test.js b/tests/unit/tasks/git-init-test.js index 251634a968..be24e96fe0 100644 --- a/tests/unit/tasks/git-init-test.js +++ b/tests/unit/tasks/git-init-test.js @@ -11,10 +11,10 @@ const mkTmpDirIn = require('../../../lib/utilities/mk-tmp-dir-in'); let tmproot = path.join(root, 'tmp'); const td = require('testdouble'); -describe('git-init', function() { +describe('git-init', function () { let task; - beforeEach(async function() { + beforeEach(async function () { task = new GitInitTask({ ui: new MockUI(), project: new MockProject(), @@ -28,13 +28,13 @@ describe('git-init', function() { process.chdir(tmpdir); }); - afterEach(async function() { + afterEach(async function () { process.chdir(root); await fs.remove(tmproot); }); - describe('skipGit: true', function() { - it('does not initialize git', async function() { + describe('skipGit: true', function () { + it('does not initialize git', async function () { await task.run({ skipGit: true, }); @@ -43,7 +43,7 @@ describe('git-init', function() { }); }); - it('correctly initializes git if git is around, and more or less works', async function() { + it('correctly initializes git if git is around, and more or less works', async function () { td.when(task._gitVersion()).thenResolve(); td.when(task._gitInit()).thenResolve(); td.when(task._gitAdd()).thenResolve(); @@ -59,7 +59,7 @@ describe('git-init', function() { expect(task.ui.errors).to.equal(''); }); - it('skips initializing git, if `git --version` fails', async function() { + it('skips initializing git, if `git --version` fails', async function () { td.when(task._gitVersion()).thenReject(); await task.run(); @@ -71,7 +71,7 @@ describe('git-init', function() { expect(task.ui.errors).to.equal(''); }); - it('includes the HOME environment variable in the environment passed to git', function() { + it('includes the HOME environment variable in the environment passed to git', function () { let env = task.buildGitEnvironment(); expect(env.HOME).to.equal(process.env.HOME); }); diff --git a/tests/unit/tasks/npm-install-test.js b/tests/unit/tasks/npm-install-test.js index 52ea9573cb..b9c3ba8b6c 100644 --- a/tests/unit/tasks/npm-install-test.js +++ b/tests/unit/tasks/npm-install-test.js @@ -4,11 +4,11 @@ const NpmInstallTask = require('../../../lib/tasks/npm-install'); const MockUI = require('console-ui/mock'); const expect = require('chai').expect; -describe('npm install task', function() { +describe('npm install task', function () { let npmInstallTask; let ui; - beforeEach(function() { + beforeEach(function () { let project = { root: __dirname, }; @@ -20,12 +20,12 @@ describe('npm install task', function() { }); }); - afterEach(function() { + afterEach(function () { ui = undefined; npmInstallTask = undefined; }); - it('skips npm installs if there is no package.json', function() { + it('skips npm installs if there is no package.json', function () { return npmInstallTask.run({}).then(() => { expect(ui.output).to.include('Skipping npm install: package.json not found'); }); diff --git a/tests/unit/tasks/npm-task-test.js b/tests/unit/tasks/npm-task-test.js index b2bca390a5..08812185b5 100644 --- a/tests/unit/tasks/npm-task-test.js +++ b/tests/unit/tasks/npm-task-test.js @@ -6,17 +6,17 @@ const expect = require('../../chai').expect; const td = require('testdouble'); const SilentError = require('silent-error'); -describe('NpmTask', function() { - describe('checkNpmVersion', function() { +describe('NpmTask', function () { + describe('checkNpmVersion', function () { let task, ui; - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); task = new NpmTask({ ui }); task.npm = td.function(); }); - it('resolves when a compatible version is found', function() { + it('resolves when a compatible version is found', function () { td.when(task.npm(['--version'])).thenResolve({ stdout: '5.2.1' }); return expect(task.checkNpmVersion()).to.be.fulfilled.then(() => { @@ -25,7 +25,7 @@ describe('NpmTask', function() { }); }); - it('resolves with warning when a newer version is found', function() { + it('resolves with warning when a newer version is found', function () { td.when(task.npm(['--version'])).thenResolve({ stdout: '7.0.0' }); return expect(task.checkNpmVersion()).to.be.fulfilled.then(() => { @@ -34,7 +34,7 @@ describe('NpmTask', function() { }); }); - it('rejects when an older version is found', function() { + it('rejects when an older version is found', function () { td.when(task.npm(['--version'])).thenResolve({ stdout: '2.9.9' }); return expect(task.checkNpmVersion()) @@ -45,7 +45,7 @@ describe('NpmTask', function() { }); }); - it('rejects when npm is not found', function() { + it('rejects when npm is not found', function () { let error = new Error('npm not found'); error.code = 'ENOENT'; @@ -59,7 +59,7 @@ describe('NpmTask', function() { }); }); - it('rejects when npm returns an unreadable version', function() { + it('rejects when npm returns an unreadable version', function () { td.when(task.npm(['--version'])).thenResolve({ stdout: '5' }); return expect(task.checkNpmVersion()) @@ -70,7 +70,7 @@ describe('NpmTask', function() { }); }); - it('rejects when an unknown error is thrown', function() { + it('rejects when an unknown error is thrown', function () { td.when(task.npm(['--version'])).thenReject(new Error('foobar?')); return expect(task.checkNpmVersion()) @@ -82,22 +82,22 @@ describe('NpmTask', function() { }); }); - describe('checkYarn', function() { + describe('checkYarn', function () { let task, ui, yarn; - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); yarn = td.function(); task = new NpmTask({ ui, yarn }); }); - it('resolves when yarn is found', function() { + it('resolves when yarn is found', function () { td.when(yarn(['--version'])).thenResolve({ stdout: '0.22.1' }); return expect(task.checkYarn()).to.be.fulfilled; }); - it('rejects when yarn is not found', function() { + it('rejects when yarn is not found', function () { let error = new Error('yarn not found'); error.code = 'ENOENT'; @@ -106,38 +106,38 @@ describe('NpmTask', function() { return expect(task.checkYarn()).to.be.rejectedWith('yarn not found'); }); - it('rejects when an unknown error is thrown', function() { + it('rejects when an unknown error is thrown', function () { td.when(yarn(['--version'])).thenReject(new Error('foobar?')); return expect(task.checkYarn()).to.be.rejectedWith('foobar?'); }); }); - describe('findPackageManager', function() { + describe('findPackageManager', function () { let task; - beforeEach(function() { + beforeEach(function () { task = new NpmTask(); task.hasYarnLock = td.function(); task.checkYarn = td.function(); task.checkNpmVersion = td.function(); }); - it('resolves when no yarn.lock file was found and npm is compatible', function() { + it('resolves when no yarn.lock file was found and npm is compatible', function () { td.when(task.hasYarnLock()).thenReturn(false); td.when(task.checkNpmVersion()).thenResolve(); return expect(task.findPackageManager()).to.be.fulfilled; }); - it('resolves when no yarn.lock file was found and npm is incompatible', function() { + it('resolves when no yarn.lock file was found and npm is incompatible', function () { td.when(task.hasYarnLock()).thenReturn(false); td.when(task.checkNpmVersion()).thenReject(); return expect(task.findPackageManager()).to.be.rejected; }); - it('resolves when yarn.lock file and yarn were found and sets useYarn = true', function() { + it('resolves when yarn.lock file and yarn were found and sets useYarn = true', function () { td.when(task.hasYarnLock()).thenReturn(true); td.when(task.checkYarn()).thenResolve(); @@ -147,7 +147,7 @@ describe('NpmTask', function() { }); }); - it('resolves when yarn.lock file was found, yarn was not found and npm is compatible', function() { + it('resolves when yarn.lock file was found, yarn was not found and npm is compatible', function () { td.when(task.hasYarnLock()).thenReturn(true); td.when(task.checkYarn()).thenReject(); td.when(task.checkNpmVersion()).thenResolve(); @@ -158,7 +158,7 @@ describe('NpmTask', function() { }); }); - it('rejects when yarn.lock file was found, yarn was not found and npm is incompatible', function() { + it('rejects when yarn.lock file was found, yarn was not found and npm is incompatible', function () { td.when(task.hasYarnLock()).thenReturn(true); td.when(task.checkYarn()).thenReject(); td.when(task.checkNpmVersion()).thenReject(); @@ -166,7 +166,7 @@ describe('NpmTask', function() { return expect(task.findPackageManager()).to.be.rejected; }); - it('resolves when yarn is requested and found', function() { + it('resolves when yarn is requested and found', function () { task.useYarn = true; td.when(task.checkYarn()).thenResolve(); @@ -174,7 +174,7 @@ describe('NpmTask', function() { return expect(task.findPackageManager()).to.be.fulfilled; }); - it('rejects with SilentError when yarn is requested but not found', function() { + it('rejects with SilentError when yarn is requested but not found', function () { task.useYarn = true; let error = new Error('yarn not found'); @@ -185,7 +185,7 @@ describe('NpmTask', function() { return expect(task.findPackageManager()).to.be.rejectedWith(SilentError, /Yarn could not be found/); }); - it('rejects when yarn is requested and yarn check errors', function() { + it('rejects when yarn is requested and yarn check errors', function () { task.useYarn = true; td.when(task.checkYarn()).thenReject(new Error('foobar')); @@ -193,7 +193,7 @@ describe('NpmTask', function() { return expect(task.findPackageManager()).to.be.rejectedWith('foobar'); }); - it('resolves when npm is requested and compatible', function() { + it('resolves when npm is requested and compatible', function () { task.useYarn = false; td.when(task.checkNpmVersion()).thenResolve(); @@ -201,7 +201,7 @@ describe('NpmTask', function() { return expect(task.findPackageManager()).to.be.fulfilled; }); - it('rejects when npm is requested but incompatible', function() { + it('rejects when npm is requested but incompatible', function () { task.useYarn = false; td.when(task.checkNpmVersion()).thenReject(); @@ -210,26 +210,26 @@ describe('NpmTask', function() { }); }); - describe('toYarnArgs', function() { + describe('toYarnArgs', function () { let task; - beforeEach(function() { + beforeEach(function () { task = new NpmTask(); }); - it('converts "npm install --no-optional" to "yarn install --ignore-optional"', function() { + it('converts "npm install --no-optional" to "yarn install --ignore-optional"', function () { let args = task.toYarnArgs('install', { optional: false }); expect(args).to.deep.equal(['install', '--ignore-optional', '--non-interactive']); }); - it('converts "npm install --save foobar" to "yarn add foobar"', function() { + it('converts "npm install --save foobar" to "yarn add foobar"', function () { let args = task.toYarnArgs('install', { save: true, packages: ['foobar'] }); expect(args).to.deep.equal(['add', 'foobar', '--non-interactive']); }); - it('converts "npm install --save-dev --save-exact foo" to "yarn add --dev --exact foo"', function() { + it('converts "npm install --save-dev --save-exact foo" to "yarn add --dev --exact foo"', function () { let args = task.toYarnArgs('install', { 'save-dev': true, 'save-exact': true, @@ -239,13 +239,13 @@ describe('NpmTask', function() { expect(args).to.deep.equal(['add', '--dev', '--exact', 'foo', '--non-interactive']); }); - it('converts "npm uninstall bar" to "yarn remove bar"', function() { + it('converts "npm uninstall bar" to "yarn remove bar"', function () { let args = task.toYarnArgs('uninstall', { packages: ['bar'] }); expect(args).to.deep.equal(['remove', 'bar', '--non-interactive']); }); - it('throws when "yarn install" is called with packages', function() { + it('throws when "yarn install" is called with packages', function () { expect(() => task.toYarnArgs('install', { packages: ['foo'] })).to.throw(Error, /install foo/); }); }); diff --git a/tests/unit/tasks/serve-test.js b/tests/unit/tasks/serve-test.js index 9346a5467c..7567cb942d 100644 --- a/tests/unit/tasks/serve-test.js +++ b/tests/unit/tasks/serve-test.js @@ -5,7 +5,7 @@ const Builder = require('../../../lib/models/builder'); const MockProject = require('../../helpers/mock-project'); const expect = require('chai').expect; -describe('serve task', function() { +describe('serve task', function () { let task, ui; function setupBroccoliBuilder() { @@ -63,14 +63,14 @@ describe('serve task', function() { return task.run(options); } - describe('run with path', function() { - it(`Throws error if path doesn't exist`, function() { + describe('run with path', function () { + it(`Throws error if path doesn't exist`, function () { expect(runServeTask.bind(this, 'xyz')).to.throw( 'The path xyz does not exist. Please specify a valid build directory to serve.' ); }); - it(`Serves ember app from given path`, async function() { + it(`Serves ember app from given path`, async function () { runServeTask('docs'); await Promise.resolve(); @@ -78,8 +78,8 @@ describe('serve task', function() { }); }); - describe('onInterrupt', function() { - it('fulfills the run promise and cleans up the builder', async function() { + describe('onInterrupt', function () { + it('fulfills the run promise and cleans up the builder', async function () { let servePromise = runServeTask(); await Promise.resolve(); diff --git a/tests/unit/tasks/server/express-server-test.js b/tests/unit/tasks/server/express-server-test.js index 38d4c15286..135413f1a5 100644 --- a/tests/unit/tasks/server/express-server-test.js +++ b/tests/unit/tasks/server/express-server-test.js @@ -16,18 +16,18 @@ const express = require('express'); const WebSocket = require('websocket').w3cwebsocket; function checkMiddlewareOptions(options) { - expect(options).to.satisfy(option => option.baseURL || option.rootURL); + expect(options).to.satisfy((option) => option.baseURL || option.rootURL); } function sleep(timeout) { - return new Promise(resolve => setTimeout(resolve, timeout)); + return new Promise((resolve) => setTimeout(resolve, timeout)); } -describe('express-server', function() { +describe('express-server', function () { let subject, ui, project, proxy, nockProxy; nock.enableNetConnect(); - beforeEach(function() { + beforeEach(function () { this.timeout(10000); ui = new MockUI(); project = new MockProject(); @@ -43,7 +43,7 @@ describe('express-server', function() { }); }); - afterEach(function() { + afterEach(function () { return subject .stopHttpServer() .catch(() => {}) @@ -56,7 +56,7 @@ describe('express-server', function() { }); }); - it('address in use', function() { + it('address in use', function () { let preexistingServer = net.createServer(); preexistingServer.listen(1337); @@ -65,31 +65,31 @@ describe('express-server', function() { host: undefined, port: '1337', }) - .then(function() { + .then(function () { expect(false, 'should have rejected').to.be.ok; }) - .catch(function(reason) { + .catch(function (reason) { expect(reason.message).to.equal( 'Could not serve on http://localhost:1337. It is either in use or you do not have permission.' ); }) - .finally(function() { + .finally(function () { preexistingServer.close(); }); }); - describe('displayHost', function() { - it('should use the specified host if specified', function() { + describe('displayHost', function () { + it('should use the specified host if specified', function () { expect(subject.displayHost('1.2.3.4')).to.equal('1.2.3.4'); }); - it('should use the use localhost if host is not specified', function() { + it('should use the use localhost if host is not specified', function () { expect(subject.displayHost(undefined)).to.equal('localhost'); }); }); - describe('processAppMiddlewares', function() { - it('has a good error message if a file exists, but does not export a function', function() { + describe('processAppMiddlewares', function () { + it('has a good error message if a file exists, but does not export a function', function () { subject.project = { has() { return true; @@ -104,13 +104,13 @@ describe('express-server', function() { }).to.throw(TypeError, 'ember-cli expected ./server/index.js to be the entry for your mock or proxy server'); }); - it('returns values returned by server/index', function() { + it('returns values returned by server/index', function () { subject.project = { has() { return true; }, require() { - return function() { + return function () { return 'foo'; }; }, @@ -120,10 +120,10 @@ describe('express-server', function() { }); }); - describe('output', function() { + describe('output', function () { this.timeout(40000); - it('address in use', function() { + it('address in use', function () { let preexistingServer = net.createServer(); preexistingServer.listen(1337); @@ -133,19 +133,19 @@ describe('express-server', function() { port: '1337', }) ) - .to.be.rejected.then(reason => { + .to.be.rejected.then((reason) => { expect(reason.message).to.equal( 'Could not serve on http://localhost:1337. It is either in use or you do not have permission.' ); }) - .finally(function() { + .finally(function () { preexistingServer.close(); }); }); }); - describe('behaviour', function() { - it('starts with ssl if ssl option is passed', function() { + describe('behaviour', function () { + it('starts with ssl if ssl option is passed', function () { return subject .start({ host: 'localhost', @@ -155,12 +155,12 @@ describe('express-server', function() { sslKey: 'tests/fixtures/ssl/server.key', rootURL: '/', }) - .then(function() { - return new Promise(function(resolve, reject) { + .then(function () { + return new Promise(function (resolve, reject) { process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; request('https://localhost:1337', { strictSSL: false }) .get('/') - .expect(200, function(err, value) { + .expect(200, function (err, value) { process.env.NODE_TLS_REJECT_UNAUTHORIZED = '1'; if (err) { reject(err); @@ -172,12 +172,12 @@ describe('express-server', function() { }); }); - it('app middlewares are processed before the proxy', function(done) { + it('app middlewares are processed before the proxy', function (done) { let expected = '/foo was hit'; - project.require = function() { - return function(app) { - app.use('/foo', function(req, res) { + project.require = function () { + return function (app) { + app.use('/foo', function (req, res) { res.send(expected); }); }; @@ -190,14 +190,14 @@ describe('express-server', function() { port: '1337', rootURL: '/', }) - .then(function() { + .then(function () { request(subject.app) .get('/foo') .set('accept', 'application/json, */*') - .expect(res => { + .expect((res) => { expect(res.text).to.equal(expected); }) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -207,12 +207,12 @@ describe('express-server', function() { }); }); - it('works with a regular express app', function(done) { + it('works with a regular express app', function (done) { let expected = '/foo was hit'; - project.require = function() { + project.require = function () { let app = express(); - app.use('/foo', function(req, res) { + app.use('/foo', function (req, res) { res.send(expected); }); return app; @@ -225,14 +225,14 @@ describe('express-server', function() { port: '1337', rootURL: '/', }) - .then(function() { + .then(function () { request(subject.app) .get('/foo') .set('accept', 'application/json, */*') - .expect(res => { + .expect((res) => { expect(res.text).to.equal(expected); }) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -242,16 +242,16 @@ describe('express-server', function() { }); }); - describe('compression', function() { + describe('compression', function () { let longText = ''; for (let i = 0; i < 10000; ++i) { longText += 'x'; } longText += ''; - it('uses compression by default for long texts', function(done) { - project.require = function() { + it('uses compression by default for long texts', function (done) { + project.require = function () { let app = express(); - app.use('/foo', function(req, res) { + app.use('/foo', function (req, res) { res.send(longText); }); return app; @@ -264,14 +264,14 @@ describe('express-server', function() { port: '1337', rootURL: '/', }) - .then(function() { + .then(function () { request(subject.app) .get('/foo') - .expect(function(res) { + .expect(function (res) { expect(res.text).to.equal(longText); expect(res.header['content-encoding']).to.equal('gzip'); }) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -281,10 +281,10 @@ describe('express-server', function() { }); }); - it('does not use compression even for long texts when the x-no-compression header is sent in the response', function(done) { - project.require = function() { + it('does not use compression even for long texts when the x-no-compression header is sent in the response', function (done) { + project.require = function () { let app = express(); - app.use('/foo', function(req, res) { + app.use('/foo', function (req, res) { res.set('x-no-compression', 'true'), res.send(longText); }); return app; @@ -297,16 +297,16 @@ describe('express-server', function() { port: '1337', rootURL: '/', }) - .then(function() { + .then(function () { request(subject.app) .get('/foo') .set('accept', 'application/json, */*') - .expect(function(res) { + .expect(function (res) { expect(res.text).to.equal(longText); expect(res.header['content-encoding']).to.not.exist; expect(parseInt(res.header['content-length'], 10)).to.equal(longText.length); }) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -316,10 +316,10 @@ describe('express-server', function() { }); }); - it('does not use compression for server sent events', async function() { - project.require = function() { + it('does not use compression for server sent events', async function () { + project.require = function () { let app = express(); - app.use('/foo', function(req, res) { + app.use('/foo', function (req, res) { res.set('Content-Type', 'text/event-stream'); res.send(longText); }); @@ -337,7 +337,7 @@ describe('express-server', function() { await request(subject.app) .get('/foo') .set('accept', 'application/json, */*') - .expect(function(res) { + .expect(function (res) { expect(res.text).to.equal(longText); expect(res.header['content-encoding']).to.not.exist; expect(parseInt(res.header['content-length'], 10)).to.equal(longText.length); @@ -347,8 +347,8 @@ describe('express-server', function() { }); }); - describe('with proxy', function() { - beforeEach(function() { + describe('with proxy', function () { + beforeEach(function () { return subject.start({ proxy: 'http://localhost:3001/', host: undefined, @@ -362,7 +362,7 @@ describe('express-server', function() { request(app) .get(url) .set('accept', 'text/html') - .end(function(err, response) { + .end(function (err, response) { if (err) { return done(err); } @@ -374,12 +374,12 @@ describe('express-server', function() { }); } - it('bypasses proxy for /', function(done) { + it('bypasses proxy for /', function (done) { bypassTest(subject.app, '/', done); }); - it('bypasses proxy for files that exist', function(done) { - bypassTest(subject.app, '/test-file.txt', done, function(response) { + it('bypasses proxy for files that exist', function (done) { + bypassTest(subject.app, '/test-file.txt', done, function (response) { expect(response.text.trim()).to.equal('some contents'); }); }); @@ -390,7 +390,7 @@ describe('express-server', function() { .call(req, url) .set('content-length', 0) .set('accept', 'text/json') - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -402,27 +402,27 @@ describe('express-server', function() { }); } - it('proxies GET', function(done) { + it('proxies GET', function (done) { apiTest(subject.app, 'get', '/api/get', done); }); - it('proxies PUT', function(done) { + it('proxies PUT', function (done) { apiTest(subject.app, 'put', '/api/put', done); }); - it('proxies POST', function(done) { + it('proxies POST', function (done) { apiTest(subject.app, 'post', '/api/post', done); }); - it('proxies DELETE', function(done) { + it('proxies DELETE', function (done) { apiTest(subject.app, 'delete', '/api/delete', done); }); - it('proxies websockets', function(done) { + it('proxies websockets', function (done) { let number = Math.round(Math.random() * 0xffffff); let client = new WebSocket('ws://localhost:1337/foo'); - client.onerror = error => { + client.onerror = (error) => { done(error); // fail the test }; @@ -441,11 +441,11 @@ describe('express-server', function() { }); // test for #1263 - it('proxies when accept contains */*', function(done) { + it('proxies when accept contains */*', function (done) { request(subject.app) .get('/api/get') .set('accept', 'application/json, */*') - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -455,8 +455,8 @@ describe('express-server', function() { }); }); - describe('proxy with subdomain', function() { - beforeEach(function() { + describe('proxy with subdomain', function () { + beforeEach(function () { nockProxy = { called: null, method: null, @@ -476,7 +476,7 @@ describe('express-server', function() { return req[method] .call(req, url) .set('accept', 'text/json') - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -487,14 +487,14 @@ describe('express-server', function() { }); } - it('proxies GET', function(done) { + it('proxies GET', function (done) { nock('http://api.lvh.me', { reqheaders: { host: 'api.lvh.me', }, }) .get('/api/get') - .reply(200, function() { + .reply(200, function () { nockProxy.called = true; nockProxy.method = 'GET'; nockProxy.url = '/api/get'; @@ -505,14 +505,14 @@ describe('express-server', function() { apiTest(subject.app, 'get', '/api/get', done); }); - it('proxies PUT', function(done) { + it('proxies PUT', function (done) { nock('http://api.lvh.me', { reqheaders: { host: 'api.lvh.me', }, }) .put('/api/put') - .reply(204, function() { + .reply(204, function () { nockProxy.called = true; nockProxy.method = 'PUT'; nockProxy.url = '/api/put'; @@ -523,14 +523,14 @@ describe('express-server', function() { apiTest(subject.app, 'put', '/api/put', done); }); - it('proxies POST', function(done) { + it('proxies POST', function (done) { nock('http://api.lvh.me', { reqheaders: { host: 'api.lvh.me', }, }) .post('/api/post') - .reply(201, function() { + .reply(201, function () { nockProxy.called = true; nockProxy.method = 'POST'; nockProxy.url = '/api/post'; @@ -541,14 +541,14 @@ describe('express-server', function() { apiTest(subject.app, 'post', '/api/post', done); }); - it('proxies DELETE', function(done) { + it('proxies DELETE', function (done) { nock('http://api.lvh.me', { reqheaders: { host: 'api.lvh.me', }, }) .delete('/api/delete') - .reply(204, function() { + .reply(204, function () { nockProxy.called = true; nockProxy.method = 'DELETE'; nockProxy.url = '/api/delete'; @@ -560,10 +560,10 @@ describe('express-server', function() { }); // test for #1263 - it('proxies when accept contains */*', function(done) { + it('proxies when accept contains */*', function (done) { nock('http://api.lvh.me') .get('/api/get') - .reply(200, function() { + .reply(200, function () { nockProxy.called = true; nockProxy.method = 'GET'; nockProxy.url = '/api/get'; @@ -574,7 +574,7 @@ describe('express-server', function() { request(subject.app) .get('/api/get') .set('accept', 'application/json, */*') - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -584,7 +584,7 @@ describe('express-server', function() { }); }); - describe('without proxy', function() { + describe('without proxy', function () { function startServer(rootURL) { return subject.start({ environment: 'development', @@ -594,14 +594,14 @@ describe('express-server', function() { }); } - it('serves index.html when file not found with auto/history location', function(done) { - startServer().then(function() { + it('serves index.html when file not found with auto/history location', function (done) { + startServer().then(function () { request(subject.app) .get('/someurl.withperiod') .set('accept', 'text/html') .expect(200) .expect('Content-Type', /html/) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -610,19 +610,19 @@ describe('express-server', function() { }); }); - it('GET /tests serves tests/index.html for mime of */* (hash location)', function(done) { + it('GET /tests serves tests/index.html for mime of */* (hash location)', function (done) { project._config = { rootURL: '/', locationType: 'hash', }; - startServer().then(function() { + startServer().then(function () { request(subject.app) .get('/tests') .set('accept', '*/*') .expect(200) .expect('Content-Type', /html/) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -631,14 +631,14 @@ describe('express-server', function() { }); }); - it('GET /tests serves tests/index.html for mime of */* (auto location)', function(done) { - startServer().then(function() { + it('GET /tests serves tests/index.html for mime of */* (auto location)', function (done) { + startServer().then(function () { request(subject.app) .get('/tests') .set('accept', '*/*') .expect(200) .expect('Content-Type', /html/) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -647,14 +647,14 @@ describe('express-server', function() { }); }); - it('GET /tests/whatever serves tests/index.html when file not found', function(done) { - startServer().then(function() { + it('GET /tests/whatever serves tests/index.html when file not found', function (done) { + startServer().then(function () { request(subject.app) .get('/tests/whatever') .set('accept', 'text/html') .expect(200) .expect('Content-Type', /html/) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -663,15 +663,15 @@ describe('express-server', function() { }); }); - it('GET /tests/an-existing-file.tla serves tests/an-existing-file.tla if it is found', function(done) { - startServer().then(function() { + it('GET /tests/an-existing-file.tla serves tests/an-existing-file.tla if it is found', function (done) { + startServer().then(function () { request(subject.app) .get('/tests/test-file.txt') .set('accept', 'text/html') .expect(200) .expect(/some contents/) .expect('Content-Type', /text/) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -680,14 +680,14 @@ describe('express-server', function() { }); }); - it('serves index.html when file not found (with rootURL) with auto/history location', function(done) { - startServer('/foo').then(function() { + it('serves index.html when file not found (with rootURL) with auto/history location', function (done) { + startServer('/foo').then(function () { request(subject.app) .get('/foo/someurl') .set('accept', 'text/html') .expect(200) .expect('Content-Type', /html/) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -696,20 +696,20 @@ describe('express-server', function() { }); }); - it('serves index.html when file not found (with rootURL) with custom history location', function(done) { + it('serves index.html when file not found (with rootURL) with custom history location', function (done) { project._config = { rootURL: '/', locationType: 'blahr', historySupportMiddleware: true, }; - startServer('/foo').then(function() { + startServer('/foo').then(function () { request(subject.app) .get('/foo/someurl') .set('accept', 'text/html') .expect(200) .expect('Content-Type', /html/) - .end(function(err) { + .end(function (err) { if (err) { return done(err); } @@ -718,38 +718,34 @@ describe('express-server', function() { }); }); - it('returns a 404 when file not found with hash location', function(done) { + it('returns a 404 when file not found with hash location', function (done) { project._config = { rootURL: '/', locationType: 'hash', }; - startServer().then(function() { - request(subject.app) - .get('/someurl.withperiod') - .set('accept', 'text/html') - .expect(404) - .end(done); + startServer().then(function () { + request(subject.app).get('/someurl.withperiod').set('accept', 'text/html').expect(404).end(done); }); }); - it('files that exist in broccoli directory are served up', function(done) { - startServer().then(function() { + it('files that exist in broccoli directory are served up', function (done) { + startServer().then(function () { request(subject.app) .get('/test-file.txt') - .end(function(err, response) { + .end(function (err, response) { expect(response.text.trim()).to.equal('some contents'); done(); }); }); }); - it('serves static asset up from build output without a period in name', function(done) { - startServer().then(function() { + it('serves static asset up from build output without a period in name', function (done) { + startServer().then(function () { request(subject.app) .get('/someurl-without-period') .expect(200) - .end(function(err, response) { + .end(function (err, response) { if (err) { return done(err); } @@ -761,12 +757,12 @@ describe('express-server', function() { }); }); - it('serves a static wasm file up from build output with correct Content-Type header', function(done) { - startServer().then(function() { + it('serves a static wasm file up from build output with correct Content-Type header', function (done) { + startServer().then(function () { request(subject.app) .get('/vendor/foo.wasm') .expect(200) - .end(function(err, response) { + .end(function (err, response) { if (err) { return done(err); } @@ -778,16 +774,16 @@ describe('express-server', function() { }); }); - it('serves static asset up from build output without a period in name (with rootURL)', function(done) { + it('serves static asset up from build output without a period in name (with rootURL)', function (done) { project._config = { rootURL: '/foo', }; - startServer('/foo').then(function() { + startServer('/foo').then(function () { request(subject.app) .get('/foo/someurl-without-period') .expect(200) - .end(function(err, response) { + .end(function (err, response) { if (err) { return done(err); } @@ -800,37 +796,37 @@ describe('express-server', function() { }); }); - describe('addons', function() { + describe('addons', function () { let calls; - beforeEach(function() { + beforeEach(function () { calls = 0; - subject.processAddonMiddlewares = function(options) { + subject.processAddonMiddlewares = function (options) { checkMiddlewareOptions(options); calls++; }; }); - it('calls processAddonMiddlewares upon start', function() { + it('calls processAddonMiddlewares upon start', function () { return subject .start({ host: undefined, port: '1337', }) - .then(function() { + .then(function () { expect(calls).to.equal(1); }); }); }); - describe('addon middleware', function() { + describe('addon middleware', function () { let firstCalls; let secondCalls; - beforeEach(function() { + beforeEach(function () { firstCalls = 0; secondCalls = 0; - project.initializeAddons = function() {}; + project.initializeAddons = function () {}; project.addons = [ { serverMiddleware({ options }) { @@ -850,39 +846,39 @@ describe('express-server', function() { ]; }); - it('calls serverMiddleware on the addons on start', function() { + it('calls serverMiddleware on the addons on start', function () { return subject .start({ host: undefined, port: '1337', }) - .then(function() { + .then(function () { expect(firstCalls).to.equal(1); expect(secondCalls).to.equal(1); }); }); - it('calls serverMiddleware on the addons on restart', function() { + it('calls serverMiddleware on the addons on restart', function () { return subject .start({ host: undefined, port: '1337', }) - .then(function() { + .then(function () { subject.changedFiles = ['bar.js']; return subject.restartHttpServer(); }) - .then(function() { + .then(function () { expect(firstCalls).to.equal(2); expect(secondCalls).to.equal(2); }); }); }); - describe('addon middleware is async', function() { + describe('addon middleware is async', function () { let order = []; - beforeEach(function() { - project.initializeAddons = function() {}; + beforeEach(function () { + project.initializeAddons = function () {}; project.addons = [ { serverMiddleware() { @@ -891,8 +887,8 @@ describe('express-server', function() { }, { serverMiddleware() { - return new Promise(function(resolve) { - setTimeout(function() { + return new Promise(function (resolve) { + setTimeout(function () { order.push('second'); resolve(); }, 50); @@ -907,13 +903,13 @@ describe('express-server', function() { ]; }); - it('waits for async middleware to complete before the next middleware', function() { + it('waits for async middleware to complete before the next middleware', function () { return subject .start({ host: undefined, port: '1337', }) - .then(function() { + .then(function () { expect(order[0]).to.equal('first'); expect(order[1]).to.equal('second'); expect(order[2]).to.equal('third'); @@ -921,9 +917,9 @@ describe('express-server', function() { }); }); - describe('addon middleware bubble errors', function() { - beforeEach(function() { - project.initializeAddons = function() {}; + describe('addon middleware bubble errors', function () { + beforeEach(function () { + project.initializeAddons = function () {}; project.addons = [ { serverMiddleware() { @@ -932,33 +928,33 @@ describe('express-server', function() { }, ]; }); - it('up to server start', function() { + it('up to server start', function () { return subject .start({ host: undefined, port: '1337', }) - .catch(function(reason) { + .catch(function (reason) { expect(reason).to.equal('addon middleware fail'); }); }); }); - describe('app middleware', function() { + describe('app middleware', function () { let passedOptions; let calls; - beforeEach(function() { + beforeEach(function () { passedOptions = null; calls = 0; - subject.processAppMiddlewares = function(options) { + subject.processAppMiddlewares = function (options) { passedOptions = options; calls++; }; }); - it('calls processAppMiddlewares upon start', function() { + it('calls processAppMiddlewares upon start', function () { let realOptions = { baseURL: '/', rootURL: undefined, @@ -966,13 +962,13 @@ describe('express-server', function() { port: '1337', }; - return subject.start(realOptions).then(function() { + return subject.start(realOptions).then(function () { expect(passedOptions).to.deep.equal(realOptions); expect(calls).to.equal(1); }); }); - it('calls processAppMiddlewares upon restart', function() { + it('calls processAppMiddlewares upon restart', function () { let realOptions = { baseURL: '/', rootURL: undefined, @@ -984,12 +980,12 @@ describe('express-server', function() { return subject .start(realOptions) - .then(function() { + .then(function () { originalApp = subject.app; subject.changedFiles = ['bar.js']; return subject.restartHttpServer(); }) - .then(function() { + .then(function () { expect(subject.app).to.be.ok; expect(originalApp).to.not.equal(subject.app); expect(passedOptions).to.deep.equal(realOptions); @@ -997,10 +993,10 @@ describe('express-server', function() { }); }); - it('includes httpServer instance in options', function() { + it('includes httpServer instance in options', function () { let passedOptions; - subject.processAppMiddlewares = function(options) { + subject.processAppMiddlewares = function (options) { passedOptions = options; }; @@ -1009,16 +1005,16 @@ describe('express-server', function() { port: '1337', }; - return subject.start(realOptions).then(function() { + return subject.start(realOptions).then(function () { expect(!!passedOptions.httpServer.listen).to.be.ok; }); }); }); - describe('serverWatcherDidChange', function() { - it('is called on file change', function() { + describe('serverWatcherDidChange', function () { + it('is called on file change', function () { let calls = 0; - subject.serverWatcherDidChange = function() { + subject.serverWatcherDidChange = function () { calls++; }; @@ -1027,15 +1023,15 @@ describe('express-server', function() { host: undefined, port: '1337', }) - .then(function() { + .then(function () { subject.serverWatcher.emit('change', 'foo.txt'); expect(calls).to.equal(1); }); }); - it('schedules a server restart', function() { + it('schedules a server restart', function () { let calls = 0; - subject.scheduleServerRestart = function() { + subject.scheduleServerRestart = function () { calls++; }; @@ -1044,7 +1040,7 @@ describe('express-server', function() { host: undefined, port: '1337', }) - .then(function() { + .then(function () { subject.serverWatcher.emit('change', 'foo.txt'); subject.serverWatcher.emit('change', 'bar.txt'); expect(calls).to.equal(2); @@ -1052,11 +1048,11 @@ describe('express-server', function() { }); }); - describe('scheduleServerRestart', function() { - it('schedules exactly one call of restartHttpServer', async function() { + describe('scheduleServerRestart', function () { + it('schedules exactly one call of restartHttpServer', async function () { let calls = 0; - subject.restartHttpServer = function() { + subject.restartHttpServer = function () { calls++; }; @@ -1082,8 +1078,8 @@ describe('express-server', function() { }); }); - describe('restartHttpServer', function() { - it('restarts the server', function() { + describe('restartHttpServer', function () { + it('restarts the server', function () { let originalHttpServer; let originalApp; return subject @@ -1091,14 +1087,14 @@ describe('express-server', function() { host: undefined, port: '1337', }) - .then(function() { + .then(function () { ui.output = ''; originalHttpServer = subject.httpServer; originalApp = subject.app; subject.changedFiles = ['bar.js']; return subject.restartHttpServer(); }) - .then(function() { + .then(function () { expect(ui.output).to.contains(EOL + chalk.green('Server restarted.') + EOL + EOL); expect(subject.httpServer, 'HTTP server exists').to.be.ok; expect(subject.httpServer).to.not.equal(originalHttpServer, 'HTTP server has changed'); @@ -1107,7 +1103,7 @@ describe('express-server', function() { }); }); - it('restarts the server again if one or more files change during a previous restart', function() { + it('restarts the server again if one or more files change during a previous restart', function () { let originalHttpServer; let originalApp; return subject @@ -1115,11 +1111,11 @@ describe('express-server', function() { host: undefined, port: '1337', }) - .then(function() { + .then(function () { originalHttpServer = subject.httpServer; originalApp = subject.app; - subject.serverRestartPromise = new Promise(function(resolve) { - setTimeout(function() { + subject.serverRestartPromise = new Promise(function (resolve) { + setTimeout(function () { subject.serverRestartPromise = null; resolve(); }, 20); @@ -1127,7 +1123,7 @@ describe('express-server', function() { subject.changedFiles = ['bar.js']; return subject.restartHttpServer(); }) - .then(function() { + .then(function () { expect(!!subject.httpServer).to.equal(true, 'HTTP server exists'); expect(subject.httpServer).to.not.equal(originalHttpServer, 'HTTP server has changed'); expect(!!subject.app).to.equal(true, 'App exists'); @@ -1135,9 +1131,9 @@ describe('express-server', function() { }); }); - it('emits the restart event', function() { + it('emits the restart event', function () { let calls = 0; - subject.on('restart', function() { + subject.on('restart', function () { calls++; }); return subject @@ -1145,11 +1141,11 @@ describe('express-server', function() { host: undefined, port: '1337', }) - .then(function() { + .then(function () { subject.changedFiles = ['bar.js']; return subject.restartHttpServer(); }) - .then(function() { + .then(function () { expect(calls).to.equal(1); }); }); diff --git a/tests/unit/tasks/server/livereload-server-test.js b/tests/unit/tasks/server/livereload-server-test.js index 0744e04f20..d371172e94 100644 --- a/tests/unit/tasks/server/livereload-server-test.js +++ b/tests/unit/tasks/server/livereload-server-test.js @@ -12,14 +12,14 @@ const express = require('express'); const FSTree = require('fs-tree-diff'); const http = require('http'); -describe('livereload-server', function() { +describe('livereload-server', function () { let subject; let ui; let watcher; let httpServer; let app; - beforeEach(function() { + beforeEach(function () { ui = new MockUI(); watcher = new MockWatcher(); httpServer = new MockExpressServer(); @@ -37,7 +37,7 @@ describe('livereload-server', function() { }); }); - afterEach(function() { + afterEach(function () { try { if (subject.liveReloadServer) { subject.liveReloadServer.close(); @@ -47,20 +47,20 @@ describe('livereload-server', function() { } }); - describe('start', function() { - it('does not start the server if `liveReload` option is not true', function() { + describe('start', function () { + it('does not start the server if `liveReload` option is not true', function () { return subject .setupMiddleware({ liveReload: false, liveReloadPort: 4200, liveReloadPrefix: '/', }) - .then(function() { + .then(function () { expect(ui.output).to.contains('WARNING: Livereload server manually disabled.'); expect(!!subject.liveReloadServer).to.equal(false); }); }); - it('informs of error during startup with custom port', async function() { + it('informs of error during startup with custom port', async function () { let preexistingServer = net.createServer(); preexistingServer.listen(1337); @@ -74,10 +74,10 @@ describe('livereload-server', function() { } catch (e) { expect(e.message).to.include(`Livereload failed on 'http://localhost:1337', It may be in use.`); } finally { - await new Promise(resolve => preexistingServer.close(resolve)); + await new Promise((resolve) => preexistingServer.close(resolve)); } }); - it('starts with custom host, custom port', function() { + it('starts with custom host, custom port', function () { return subject .setupMiddleware({ liveReloadHost: '127.0.0.1', @@ -86,12 +86,12 @@ describe('livereload-server', function() { liveReloadPrefix: '/', port: 4200, }) - .then(function() { + .then(function () { expect(subject.liveReloadServer.options.port).to.equal(1377); expect(subject.liveReloadServer.options.host).to.equal('127.0.0.1'); }); }); - it('Livereload responds to livereload requests and returns livereload file', function(done) { + it('Livereload responds to livereload requests and returns livereload file', function (done) { let server = app.listen(4200); subject .setupMiddleware({ @@ -99,16 +99,16 @@ describe('livereload-server', function() { liveReloadPrefix: '_lr', port: 4200, }) - .then(function() { - http.get('http://localhost:4200/_lr/livereload.js', function(response) { + .then(function () { + http.get('http://localhost:4200/_lr/livereload.js', function (response) { expect(response.statusCode).to.equal(200); server.close(done); }); }); }); }); - describe('start with https', function() { - it('correctly runs in https mode', function() { + describe('start with https', function () { + it('correctly runs in https mode', function () { return subject .setupMiddleware({ liveReload: true, @@ -119,13 +119,13 @@ describe('livereload-server', function() { sslCert: 'tests/fixtures/ssl/server.crt', port: 4200, }) - .then(function() { + .then(function () { expect(subject.liveReloadServer.options.key).to.be.an.instanceof(Buffer); expect(subject.liveReloadServer.options.cert).to.be.an.instanceof(Buffer); }); }); - it('informs of error during startup', async function() { + it('informs of error during startup', async function () { let preexistingServer = net.createServer(); preexistingServer.listen(1337); @@ -143,11 +143,11 @@ describe('livereload-server', function() { } catch (e) { expect(e.message).to.include(`Livereload failed on 'https://localhost:1337', It may be in use.`); } finally { - await new Promise(resolve => preexistingServer.close(resolve)); + await new Promise((resolve) => preexistingServer.close(resolve)); } }); - it('correctly runs in https mode with custom port', function() { + it('correctly runs in https mode with custom port', function () { return subject .setupMiddleware({ liveReload: true, @@ -158,17 +158,17 @@ describe('livereload-server', function() { sslCert: 'tests/fixtures/ssl/server.crt', port: 4200, }) - .then(function() { + .then(function () { expect(subject.liveReloadServer.options.key).to.be.an.instanceof(Buffer); expect(subject.liveReloadServer.options.cert).to.be.an.instanceof(Buffer); }); }); }); - describe('express server restart', function() { - it('triggers when the express server restarts', function() { + describe('express server restart', function () { + it('triggers when the express server restarts', function () { let calls = 0; - subject.didRestart = function() { + subject.didRestart = function () { calls++; }; return subject @@ -177,14 +177,14 @@ describe('livereload-server', function() { liveReloadPrefix: '/', port: 4200, }) - .then(function() { + .then(function () { subject.app.emit('restart'); expect(calls).to.equal(1); }); }); - it('triggers when the express server restarts with custom port', function() { + it('triggers when the express server restarts with custom port', function () { let calls = 0; - subject.didRestart = function() { + subject.didRestart = function () { calls++; }; return subject @@ -194,28 +194,28 @@ describe('livereload-server', function() { liveReloadPort: 1337, port: 4200, }) - .then(function() { + .then(function () { subject.app.emit('restart'); expect(calls).to.equal(1); }); }); }); - describe('livereload changes', function() { + describe('livereload changes', function () { let liveReloadServer; let changedCount; let oldChanged; - let stubbedChanged = function() { + let stubbedChanged = function () { changedCount += 1; }; let trackCount; let oldTrack; - let stubbedTrack = function() { + let stubbedTrack = function () { trackCount += 1; }; - let createStubbedGetDirectoryEntries = function(files) { - return function() { - return files.map(function(file) { + let createStubbedGetDirectoryEntries = function (files) { + return function () { + return files.map(function (file) { return { relativePath: file, isDirectory() { @@ -226,7 +226,7 @@ describe('livereload-server', function() { }; }; - beforeEach(function() { + beforeEach(function () { subject.setupMiddleware({ liveReload: true, liveReloadPort: 4200, @@ -245,13 +245,13 @@ describe('livereload-server', function() { subject.tree = FSTree.fromEntries([]); }); - afterEach(function() { + afterEach(function () { liveReloadServer.changed = oldChanged; subject.analytics.track = oldTrack; subject.project.liveReloadFilterPatterns = []; }); - describe('watcher events', function() { + describe('watcher events', function () { function watcherEventTest(eventName, expectedCount) { subject.getDirectoryEntries = createStubbedGetDirectoryEntries(['test/fixtures/proxy/file-a.js']); subject.project.liveReloadFilterPatterns = []; @@ -261,20 +261,20 @@ describe('livereload-server', function() { return expect(changedCount).to.equal(expectedCount); } - it('triggers a livereload change on a watcher change event', function() { + it('triggers a livereload change on a watcher change event', function () { return watcherEventTest('change', 1); }); - it('triggers a livereload change on a watcher error event', function() { + it('triggers a livereload change on a watcher error event', function () { return watcherEventTest('error', 1); }); - it('does not trigger a livereload change on other watcher events', function() { + it('does not trigger a livereload change on other watcher events', function () { return watcherEventTest('not-an-event', 0); }); - it('recovers from error when file is already cached in previous cache step', function() { - let compileError = function() { + it('recovers from error when file is already cached in previous cache step', function () { + let compileError = function () { try { throw new Error('Compile time error'); } catch (error) { @@ -294,8 +294,8 @@ describe('livereload-server', function() { expect(changedCount).to.equal(2); }); - describe('filter pattern', function() { - it('shouldTriggerReload must be true if there are no liveReloadFilterPatterns', function() { + describe('filter pattern', function () { + it('shouldTriggerReload must be true if there are no liveReloadFilterPatterns', function () { subject.project.liveReloadFilterPatterns = []; let result = subject.shouldTriggerReload({ filePath: '/home/user/my-project/app/styles/app.css', @@ -303,7 +303,7 @@ describe('livereload-server', function() { expect(result).to.be.true; }); - it('shouldTriggerReload is true when no liveReloadFilterPatterns matches the filePath', function() { + it('shouldTriggerReload is true when no liveReloadFilterPatterns matches the filePath', function () { let basePath = path.normalize('test/fixtures/proxy').replace(/\\/g, '\\\\'); let filter = new RegExp(`^${basePath}`); @@ -314,7 +314,7 @@ describe('livereload-server', function() { expect(result).to.be.true; }); - it('shouldTriggerReload is false when one or more of the liveReloadFilterPatterns matches filePath', function() { + it('shouldTriggerReload is false when one or more of the liveReloadFilterPatterns matches filePath', function () { let basePath = path.normalize('test/fixtures/proxy').replace(/\\/g, '\\\\'); let filter = new RegExp(`^${basePath}`); @@ -325,7 +325,7 @@ describe('livereload-server', function() { expect(result).to.be.false; }); - it('shouldTriggerReload writes a banner after skipping reload for a file', function() { + it('shouldTriggerReload writes a banner after skipping reload for a file', function () { let basePath = path.normalize('test/fixtures/proxy').replace(/\\/g, '\\\\'); let filter = new RegExp(`^${basePath}`); @@ -338,7 +338,7 @@ describe('livereload-server', function() { ); }); - it('triggers the livereload server of a change when no pattern matches', function() { + it('triggers the livereload server of a change when no pattern matches', function () { subject.getDirectoryEntries = createStubbedGetDirectoryEntries([]); subject.didChange({ filePath: '/home/user/my-project/test/fixtures/proxy/file-a.js', @@ -347,7 +347,7 @@ describe('livereload-server', function() { expect(trackCount).to.equal(1); }); - it('does not trigger livereload server of a change when there is a pattern match', function() { + it('does not trigger livereload server of a change when there is a pattern match', function () { // normalize test regex for windows // path.normalize with change forward slashes to back slashes if test is running on windows // we then replace backslashes with double backslahes to escape the backslash in the regex @@ -367,22 +367,22 @@ describe('livereload-server', function() { }); }); - describe('specific files', function() { + describe('specific files', function () { let reloadedFiles; - let stubbedChanged = function(options) { + let stubbedChanged = function (options) { reloadedFiles = options.body.files; }; - beforeEach(function() { + beforeEach(function () { liveReloadServer.changed = stubbedChanged; }); - afterEach(function() { + afterEach(function () { reloadedFiles = undefined; }); - it('triggers livereload with modified files', function() { + it('triggers livereload with modified files', function () { let changedFiles = ['assets/my-project.css', 'assets/my-project.js']; subject.getDirectoryEntries = createStubbedGetDirectoryEntries(changedFiles); @@ -393,7 +393,7 @@ describe('livereload-server', function() { expect(reloadedFiles).to.deep.equal(changedFiles); }); - it('triggers livereload with deleted directories', function() { + it('triggers livereload with deleted directories', function () { let changedFiles = ['assets/my-project.css', 'assets/my-project.js']; subject.getDirectoryEntries = createStubbedGetDirectoryEntries(changedFiles); @@ -410,7 +410,7 @@ describe('livereload-server', function() { expect(reloadedFiles).to.deep.equal([]); }); - it('triggers livereload ignoring source map files', function() { + it('triggers livereload ignoring source map files', function () { let changedFiles = ['assets/my-project.css', 'assets/my-project.css.map']; let expectedResult = ['assets/my-project.css']; @@ -423,7 +423,7 @@ describe('livereload-server', function() { expect(reloadedFiles).to.deep.equal(expectedResult); }); - it('triggers livereload with "LiveReload files" if no results.directory was provided', function() { + it('triggers livereload with "LiveReload files" if no results.directory was provided', function () { let changedOptions; subject.liveReloadServer = { changed(options) { @@ -441,21 +441,21 @@ describe('livereload-server', function() { }); }); }); - describe('livereload changes with custom port', function() { + describe('livereload changes with custom port', function () { let liveReloadServer; let changedCount; let oldChanged; - let stubbedChanged = function() { + let stubbedChanged = function () { changedCount += 1; }; let trackCount; let oldTrack; - let stubbedTrack = function() { + let stubbedTrack = function () { trackCount += 1; }; - let createStubbedGetDirectoryEntries = function(files) { - return function() { - return files.map(function(file) { + let createStubbedGetDirectoryEntries = function (files) { + return function () { + return files.map(function (file) { return { relativePath: file, isDirectory() { @@ -466,7 +466,7 @@ describe('livereload-server', function() { }; }; - beforeEach(function() { + beforeEach(function () { subject.setupMiddleware({ liveReload: true, liveReloadPort: 1337, @@ -485,13 +485,13 @@ describe('livereload-server', function() { subject.tree = FSTree.fromEntries([]); }); - afterEach(function() { + afterEach(function () { liveReloadServer.changed = oldChanged; subject.analytics.track = oldTrack; subject.project.liveReloadFilterPatterns = []; }); - describe('watcher events', function() { + describe('watcher events', function () { function watcherEventTest(eventName, expectedCount) { subject.getDirectoryEntries = createStubbedGetDirectoryEntries(['test/fixtures/proxy/file-a.js']); subject.project.liveReloadFilterPatterns = []; @@ -501,20 +501,20 @@ describe('livereload-server', function() { return expect(changedCount).to.equal(expectedCount); } - it('triggers a livereload change on a watcher change event', function() { + it('triggers a livereload change on a watcher change event', function () { return watcherEventTest('change', 1); }); - it('triggers a livereload change on a watcher error event', function() { + it('triggers a livereload change on a watcher error event', function () { return watcherEventTest('error', 1); }); - it('does not trigger a livereload change on other watcher events', function() { + it('does not trigger a livereload change on other watcher events', function () { return watcherEventTest('not-an-event', 0); }); - it('recovers from error when file is already cached in previous cache step', function() { - let compileError = function() { + it('recovers from error when file is already cached in previous cache step', function () { + let compileError = function () { try { throw new Error('Compile time error'); } catch (error) { @@ -534,8 +534,8 @@ describe('livereload-server', function() { expect(changedCount).to.equal(2); }); - describe('filter pattern', function() { - it('shouldTriggerReload must be true if there are no liveReloadFilterPatterns', function() { + describe('filter pattern', function () { + it('shouldTriggerReload must be true if there are no liveReloadFilterPatterns', function () { subject.project.liveReloadFilterPatterns = []; let result = subject.shouldTriggerReload({ filePath: '/home/user/my-project/app/styles/app.css', @@ -543,7 +543,7 @@ describe('livereload-server', function() { expect(result).to.be.true; }); - it('shouldTriggerReload is true when no liveReloadFilterPatterns matches the filePath', function() { + it('shouldTriggerReload is true when no liveReloadFilterPatterns matches the filePath', function () { let basePath = path.normalize('test/fixtures/proxy').replace(/\\/g, '\\\\'); let filter = new RegExp(`^${basePath}`); @@ -554,7 +554,7 @@ describe('livereload-server', function() { expect(result).to.be.true; }); - it('shouldTriggerReload is false when one or more of the liveReloadFilterPatterns matches filePath', function() { + it('shouldTriggerReload is false when one or more of the liveReloadFilterPatterns matches filePath', function () { let basePath = path.normalize('test/fixtures/proxy').replace(/\\/g, '\\\\'); let filter = new RegExp(`^${basePath}`); @@ -565,7 +565,7 @@ describe('livereload-server', function() { expect(result).to.be.false; }); - it('shouldTriggerReload writes a banner after skipping reload for a file', function() { + it('shouldTriggerReload writes a banner after skipping reload for a file', function () { let basePath = path.normalize('test/fixtures/proxy').replace(/\\/g, '\\\\'); let filter = new RegExp(`^${basePath}`); @@ -578,7 +578,7 @@ describe('livereload-server', function() { ); }); - it('triggers the livereload server of a change when no pattern matches', function() { + it('triggers the livereload server of a change when no pattern matches', function () { subject.getDirectoryEntries = createStubbedGetDirectoryEntries([]); subject.didChange({ filePath: '/home/user/my-project/test/fixtures/proxy/file-a.js', @@ -587,7 +587,7 @@ describe('livereload-server', function() { expect(trackCount).to.equal(1); }); - it('does not trigger livereload server of a change when there is a pattern match', function() { + it('does not trigger livereload server of a change when there is a pattern match', function () { // normalize test regex for windows // path.normalize with change forward slashes to back slashes if test is running on windows // we then replace backslashes with double backslahes to escape the backslash in the regex @@ -607,24 +607,24 @@ describe('livereload-server', function() { }); }); - describe('specific files', function() { + describe('specific files', function () { let reloadedFiles; let changedOptions; - let stubbedChanged = function(options) { + let stubbedChanged = function (options) { reloadedFiles = options.body.files; changedOptions = options; }; - beforeEach(function() { + beforeEach(function () { liveReloadServer.changed = stubbedChanged; }); - afterEach(function() { + afterEach(function () { reloadedFiles = undefined; }); - it('triggers livereload with modified files', function() { + it('triggers livereload with modified files', function () { let changedFiles = ['assets/my-project.css', 'assets/my-project.js']; subject.getDirectoryEntries = createStubbedGetDirectoryEntries(changedFiles); @@ -635,7 +635,7 @@ describe('livereload-server', function() { expect(reloadedFiles).to.deep.equal(changedFiles); }); - it('triggers livereload with deleted directories', function() { + it('triggers livereload with deleted directories', function () { let changedFiles = ['assets/my-project.css', 'assets/my-project.js']; subject.getDirectoryEntries = createStubbedGetDirectoryEntries(changedFiles); @@ -652,7 +652,7 @@ describe('livereload-server', function() { expect(reloadedFiles).to.deep.equal([]); }); - it('triggers livereload ignoring source map files', function() { + it('triggers livereload ignoring source map files', function () { let changedFiles = ['assets/my-project.css', 'assets/my-project.css.map']; let expectedResult = ['assets/my-project.css']; @@ -665,7 +665,7 @@ describe('livereload-server', function() { expect(reloadedFiles).to.deep.equal(expectedResult); }); - it('triggers livereload with "LiveReload files" if no results.directory was provided', function() { + it('triggers livereload with "LiveReload files" if no results.directory was provided', function () { subject.didChange({}); expect(changedOptions).to.deep.equal({ diff --git a/tests/unit/tasks/server/middleware/history-support-test.js b/tests/unit/tasks/server/middleware/history-support-test.js index fe1f4de1ac..4643174cf3 100644 --- a/tests/unit/tasks/server/middleware/history-support-test.js +++ b/tests/unit/tasks/server/middleware/history-support-test.js @@ -3,9 +3,9 @@ const expect = require('chai').expect; const HistorySupportAddon = require('../../../../../lib/tasks/server/middleware/history-support'); -describe('HistorySupportAddon', function() { - describe('.serverMiddleware', function() { - it('add middleware when locationType is auto', function() { +describe('HistorySupportAddon', function () { + describe('.serverMiddleware', function () { + it('add middleware when locationType is auto', function () { let addon = new HistorySupportAddon({ config() { return { @@ -17,7 +17,7 @@ describe('HistorySupportAddon', function() { expect(addon.shouldAddMiddleware()).to.true; }); - it('add middleware when locationType is history', function() { + it('add middleware when locationType is history', function () { let addon = new HistorySupportAddon({ config() { return { @@ -29,7 +29,7 @@ describe('HistorySupportAddon', function() { expect(addon.shouldAddMiddleware()).to.true; }); - it('add middleware when locationType is an unknown type', function() { + it('add middleware when locationType is an unknown type', function () { let addon = new HistorySupportAddon({ config() { return { @@ -42,7 +42,7 @@ describe('HistorySupportAddon', function() { expect(addon.shouldAddMiddleware()).to.true; }); - it('add middleware when historySupportMiddleware is true', function() { + it('add middleware when historySupportMiddleware is true', function () { let addon = new HistorySupportAddon({ config() { return { @@ -54,7 +54,7 @@ describe('HistorySupportAddon', function() { expect(addon.shouldAddMiddleware()).to.true; }); - it('do not add middleware when historySupportMiddleware is false and locationType is history', function() { + it('do not add middleware when historySupportMiddleware is false and locationType is history', function () { let addon = new HistorySupportAddon({ config() { return { diff --git a/tests/unit/tasks/server/middleware/proxy-server-test.js b/tests/unit/tasks/server/middleware/proxy-server-test.js index 636212b9c9..bed1087931 100644 --- a/tests/unit/tasks/server/middleware/proxy-server-test.js +++ b/tests/unit/tasks/server/middleware/proxy-server-test.js @@ -4,15 +4,15 @@ const MockProject = require('../../../../helpers/mock-project'); const ProxyServerAddon = require('../../../../../lib/tasks/server/middleware/proxy-server'); const expect = require('chai').expect; -describe('proxy-server', function() { +describe('proxy-server', function () { let project, proxyServer; - beforeEach(function() { + beforeEach(function () { project = new MockProject(); proxyServer = new ProxyServerAddon(project); }); - it(`bypass livereload request`, function() { + it(`bypass livereload request`, function () { let options = { liveReloadPrefix: 'test/', }; diff --git a/tests/unit/tasks/server/middleware/tests-server-test.js b/tests/unit/tasks/server/middleware/tests-server-test.js index 3591ef11bd..56dd569fcd 100644 --- a/tests/unit/tasks/server/middleware/tests-server-test.js +++ b/tests/unit/tasks/server/middleware/tests-server-test.js @@ -3,11 +3,11 @@ const expect = require('chai').expect; const TestsServerAddon = require('../../../../../lib/tasks/server/middleware/tests-server'); -describe('TestServerAddon', function() { - describe('.serverMiddleware', function() { +describe('TestServerAddon', function () { + describe('.serverMiddleware', function () { let addon, nextWasCalled, mockRequest, app; - beforeEach(function() { + beforeEach(function () { addon = new TestsServerAddon(); nextWasCalled = false; mockRequest = { @@ -18,14 +18,14 @@ describe('TestServerAddon', function() { }; app = { use(callback) { - return callback(mockRequest, null, function() { + return callback(mockRequest, null, function () { nextWasCalled = true; }); }, }; }); - it('invokes next when the watcher succeeds', function(done) { + it('invokes next when the watcher succeeds', function (done) { addon.serverMiddleware({ app, options: { @@ -44,7 +44,7 @@ describe('TestServerAddon', function() { }); }); - it('invokes next when the watcher fails', function(done) { + it('invokes next when the watcher fails', function (done) { let mockError = 'bad things are bad'; addon.serverMiddleware({ @@ -63,7 +63,7 @@ describe('TestServerAddon', function() { }); }); - it('allows baseURL containing `+` character', function(done) { + it('allows baseURL containing `+` character', function (done) { mockRequest.path = '/braden/+/tests/any-old-file'; mockRequest.headers.accept = ['*/*']; addon.serverMiddleware({ @@ -83,7 +83,7 @@ describe('TestServerAddon', function() { }); }); - it('allows rootURL containing `+` character', function(done) { + it('allows rootURL containing `+` character', function (done) { mockRequest.path = '/grayson/+/tests/any-old-file'; mockRequest.headers.accept = ['text/html']; addon.serverMiddleware({ diff --git a/tests/unit/tasks/test-server-test.js b/tests/unit/tasks/test-server-test.js index f25120f68c..e5da221fd4 100644 --- a/tests/unit/tasks/test-server-test.js +++ b/tests/unit/tasks/test-server-test.js @@ -7,10 +7,10 @@ const MockProject = require('../../helpers/mock-project'); const MockUI = require('console-ui/mock'); const MockWatcher = require('../../helpers/mock-watcher'); -describe('test server', function() { +describe('test server', function () { let subject; - it('transforms and sets defaultOptions in testem and invokes testem properly', function() { + it('transforms and sets defaultOptions in testem and invokes testem properly', function () { let ui = new MockUI(); let watcher = new MockWatcher(); @@ -48,17 +48,17 @@ describe('test server', function() { watcher, testPage: 'http://my/test/page', }) - .then(function(value) { + .then(function (value) { expect(value, 'expected exist status of 0').to.eql(0); }); watcher.emit('change'); return runResult; }); - describe('completion', function() { + describe('completion', function () { let ui, watcher, subject, runOptions; - before(function() { + before(function () { ui = new MockUI(); watcher = new MockWatcher(); @@ -83,18 +83,18 @@ describe('test server', function() { }); }); - describe('firstRun', function() { - it('rejects with testem exceptions', function() { + describe('firstRun', function () { + it('rejects with testem exceptions', function () { let error = new Error('OMG'); - subject.testem.setDefaultOptions = function(options) { + subject.testem.setDefaultOptions = function (options) { this.defaultOptions = options; }; - subject.testem.startDev = function(options, finalizer) { + subject.testem.startDev = function (options, finalizer) { finalizer(1, error); }; - let runResult = expect(subject.run(runOptions)).to.be.rejected.then(reason => { + let runResult = expect(subject.run(runOptions)).to.be.rejected.then((reason) => { expect(reason).to.eql(error); }); @@ -103,17 +103,17 @@ describe('test server', function() { return runResult; }); - it('rejects with exit status (1)', function() { + it('rejects with exit status (1)', function () { let error = new SilentError('Testem finished with non-zero exit code. Tests failed.'); - subject.testem.setDefaultOptions = function(options) { + subject.testem.setDefaultOptions = function (options) { this.defaultOptions = options; }; - subject.testem.startDev = function(options, finalizer) { + subject.testem.startDev = function (options, finalizer) { finalizer(1); }; - let runResult = expect(subject.run(runOptions)).to.be.rejected.then(reason => { + let runResult = expect(subject.run(runOptions)).to.be.rejected.then((reason) => { expect(reason).to.eql(error); }); @@ -121,16 +121,16 @@ describe('test server', function() { return runResult; }); - it('resolves with exit status (0)', function() { - subject.testem.setDefaultOptions = function(options) { + it('resolves with exit status (0)', function () { + subject.testem.setDefaultOptions = function (options) { this.defaultOptions = options; }; - subject.testem.startDev = function(options, finalizer) { + subject.testem.startDev = function (options, finalizer) { finalizer(0); }; - let runResult = subject.run(runOptions).then(function(value) { + let runResult = subject.run(runOptions).then(function (value) { expect(value, 'expected exist status of 0').to.eql(0); }); @@ -140,14 +140,14 @@ describe('test server', function() { }); }); - describe('restart', function() { - it('rejects with testem exceptions', function() { + describe('restart', function () { + it('rejects with testem exceptions', function () { let error = new Error('OMG'); - subject.testem.setDefaultOptions = function(options) { + subject.testem.setDefaultOptions = function (options) { this.defaultOptions = options; }; - subject.testem.startDev = function(options, finalizer) { + subject.testem.startDev = function (options, finalizer) { finalizer(0); }; @@ -155,12 +155,12 @@ describe('test server', function() { watcher.emit('change'); - return runResult.then(function() { - subject.testem.startDev = function(options, finalizer) { + return runResult.then(function () { + subject.testem.startDev = function (options, finalizer) { finalizer(0, error); }; - runResult = expect(subject.run(runOptions)).to.be.rejected.then(reason => { + runResult = expect(subject.run(runOptions)).to.be.rejected.then((reason) => { expect(reason).to.eql(error); }); diff --git a/tests/unit/tasks/test-test.js b/tests/unit/tasks/test-test.js index e2d7f28ee4..ebcf5503d1 100644 --- a/tests/unit/tasks/test-test.js +++ b/tests/unit/tasks/test-test.js @@ -4,10 +4,10 @@ const expect = require('chai').expect; const TestTask = require('../../../lib/tasks/test'); const MockProject = require('../../helpers/mock-project'); -describe('test task test', function() { +describe('test task test', function () { let subject; - it('transforms options for testem configuration', function() { + it('transforms options for testem configuration', function () { subject = new TestTask({ project: new MockProject(), addonMiddlewares() { @@ -55,7 +55,7 @@ describe('test task test', function() { }); }); - it('supports conditionally passing SSL configuration forward', function() { + it('supports conditionally passing SSL configuration forward', function () { subject = new TestTask({ project: new MockProject(), diff --git a/tests/unit/utilities/command-generator-test.js b/tests/unit/utilities/command-generator-test.js index def5978264..542788b356 100644 --- a/tests/unit/utilities/command-generator-test.js +++ b/tests/unit/utilities/command-generator-test.js @@ -3,19 +3,19 @@ const td = require('testdouble'); const Command = require('../../../tests/helpers/command-generator'); -describe('command-generator', function() { +describe('command-generator', function () { let yarn, _invoke; - beforeEach(function() { + beforeEach(function () { yarn = new Command('yarn'); _invoke = yarn._invoke = td.function('invoke'); }); - afterEach(function() { + afterEach(function () { td.reset(); }); - it('invoke passes options', function() { + it('invoke passes options', function () { // Works with subcommand or argument. yarn.invoke('install'); td.verify(_invoke(td.matchers.isA(Array), {})); @@ -45,7 +45,7 @@ describe('command-generator', function() { td.verify(_invoke(), { times: 8, ignoreExtraArgs: true }); }); - it('builds the proper invocation', function() { + it('builds the proper invocation', function () { yarn.invoke(); td.verify(_invoke([]), { ignoreExtraArgs: true }); diff --git a/tests/unit/utilities/ember-app-utils-test.js b/tests/unit/utilities/ember-app-utils-test.js index b4c6247028..f4f87b74f2 100644 --- a/tests/unit/utilities/ember-app-utils-test.js +++ b/tests/unit/utilities/ember-app-utils-test.js @@ -12,14 +12,14 @@ const normalizeUrl = emberAppUtils.normalizeUrl; const calculateBaseTag = emberAppUtils.calculateBaseTag; const convertObjectToString = emberAppUtils.convertObjectToString; -describe('ember-app-utils', function() { - describe(`rootURL`, function() { - it('`rootURL` regex accepts space-padded padded variation', function() { +describe('ember-app-utils', function () { + describe(`rootURL`, function () { + it('`rootURL` regex accepts space-padded padded variation', function () { const regex = configReplacePatterns()[0].match; const variations = ['{{rootURL}}', '{{ rootURL }}', 'foo']; const results = []; - variations.forEach(variation => { + variations.forEach((variation) => { const match = variation.match(regex); if (match !== null) { @@ -32,13 +32,13 @@ describe('ember-app-utils', function() { }); }); - describe(`EMBER_ENV`, function() { - it('`EMBER_ENV` regex accepts space-padded padded variation', function() { + describe(`EMBER_ENV`, function () { + it('`EMBER_ENV` regex accepts space-padded padded variation', function () { const regex = configReplacePatterns()[1].match; const variations = ['{{EMBER_ENV}}', '{{ EMBER_ENV }}', 'foo']; const results = []; - variations.forEach(variation => { + variations.forEach((variation) => { const match = variation.match(regex); if (match !== null) { @@ -51,13 +51,13 @@ describe('ember-app-utils', function() { }); }); - describe(`MODULE_PREFIX`, function() { - it('`MODULE_PREFIX` regex accepts space-padded padded variation', function() { + describe(`MODULE_PREFIX`, function () { + it('`MODULE_PREFIX` regex accepts space-padded padded variation', function () { const regex = configReplacePatterns()[3].match; const variations = ['{{MODULE_PREFIX}}', '{{ MODULE_PREFIX }}', 'foo']; const results = []; - variations.forEach(variation => { + variations.forEach((variation) => { const match = variation.match(regex); if (match !== null) { @@ -70,7 +70,7 @@ describe('ember-app-utils', function() { }); }); - describe(`contentFor`, function() { + describe(`contentFor`, function () { let config = { modulePrefix: 'cool-foo', }; @@ -83,7 +83,7 @@ describe('ember-app-utils', function() { addons: [], }; - it('`content-for` regex returns all matches presents in a same line', function() { + it('`content-for` regex returns all matches presents in a same line', function () { const contentForRegex = configReplacePatterns(defaultOptions)[2].match; const content = "{{content-for 'foo'}} {{content-for 'bar'}}"; const results = []; @@ -99,21 +99,21 @@ describe('ember-app-utils', function() { ]); }); - it('returns an empty string if invalid type is specified', function() { + it('returns an empty string if invalid type is specified', function () { expect(contentFor(config, defaultMatch, 'foo', defaultOptions)).to.equal(''); expect(contentFor(config, defaultMatch, 'body', defaultOptions)).to.equal(''); expect(contentFor(config, defaultMatch, 'blah', defaultOptions)).to.equal(''); }); - describe('"head"', function() { - it('returns `` tag by default', function() { + describe('"head"', function () { + it('returns `` tag by default', function () { let actual = contentFor(config, defaultMatch, 'head', defaultOptions); let expected = ``; expect(actual, '`` tag was included by default').to.contain(expected); }); - it('handles multibyte characters in `` tag', function() { + it('handles multibyte characters in `` tag', function () { let configWithMultibyteChars = { modulePrefix: 'cool-å' }; let actual = contentFor(configWithMultibyteChars, defaultMatch, 'head', defaultOptions); let escapedConfig = encodeURIComponent(JSON.stringify(configWithMultibyteChars)); @@ -122,7 +122,7 @@ describe('ember-app-utils', function() { expect(actual, '`` tag was included with multibyte characters').to.contain(expected); }); - it('omits `` tag if `storeConfigInMeta` is false', function() { + it('omits `` tag if `storeConfigInMeta` is false', function () { let options = Object.assign({}, defaultOptions, { storeConfigInMeta: false }); let output = contentFor(config, defaultMatch, 'head', options); @@ -131,7 +131,7 @@ describe('ember-app-utils', function() { expect(output, '`` tag was not included').not.to.contain(expected); }); - it('returns `` tag if `locationType` is "auto"', function() { + it('returns `` tag if `locationType` is "auto"', function () { config.locationType = 'auto'; config.baseURL = '/'; @@ -142,7 +142,7 @@ describe('ember-app-utils', function() { }); // this is required by testem - it('returns `` tag if `locationType` is "none"', function() { + it('returns `` tag if `locationType` is "none"', function () { config.locationType = 'none'; config.baseURL = '/'; @@ -152,7 +152,7 @@ describe('ember-app-utils', function() { expect(output, '`` tag was included').to.contain(expected); }); - it('omits `` tag if `locationType` is "hash"', function() { + it('omits `` tag if `locationType` is "hash"', function () { config.locationType = 'hash'; config.baseURL = '/foo/bar'; @@ -162,7 +162,7 @@ describe('ember-app-utils', function() { expect(output, '`` tag was not included').to.not.contain(expected); }); - it('omits `` tag if `baseURL` is `undefined`', function() { + it('omits `` tag if `baseURL` is `undefined`', function () { let expected = '` tag gathering snippet by default', function() { + describe('"config-module"', function () { + it('returns `` tag gathering snippet by default', function () { let metaSnippetPath = path.join(__dirname, '..', '..', '..', 'lib', 'broccoli', 'app-config-from-meta.js'); let expected = fs.readFileSync(metaSnippetPath, { encoding: 'utf8' }); @@ -180,7 +180,7 @@ describe('ember-app-utils', function() { expect(output, 'includes `` tag snippet').to.contain(expected); }); - it('returns "raw" config if `storeConfigInMeta` is false', function() { + it('returns "raw" config if `storeConfigInMeta` is false', function () { let options = Object.assign({}, defaultOptions, { storeConfigInMeta: false }); let expected = JSON.stringify(config); let output = contentFor(config, defaultMatch, 'config-module', options); @@ -189,8 +189,8 @@ describe('ember-app-utils', function() { }); }); - describe('"app-boot"', function() { - it('returns application bootstrap snippet by default', function() { + describe('"app-boot"', function () { + it('returns application bootstrap snippet by default', function () { let output = contentFor(config, defaultMatch, 'app-boot', defaultOptions); expect(output, 'includes application bootstrap snippet').to.contain( @@ -198,7 +198,7 @@ describe('ember-app-utils', function() { ); }); - it('omits application bootstrap snippet if `autoRun` is false', function() { + it('omits application bootstrap snippet if `autoRun` is false', function () { let options = Object.assign({}, defaultOptions, { autoRun: false }); let output = contentFor(config, defaultMatch, 'app-boot', options); @@ -206,8 +206,8 @@ describe('ember-app-utils', function() { }); }); - describe('"test-body-footer"', function() { - it('returns `