From 88c0a273730ffbd78cd9f9c7640b8d3b1683fbb7 Mon Sep 17 00:00:00 2001 From: Andrey Fel Date: Wed, 27 Dec 2023 13:20:39 +0100 Subject: [PATCH] Autofix linter errors `yarn lint:js --fix` --- .stylelintrc.js | 4 +- addon-test-support/-private/async-iterator.js | 8 +- .../-private/ember-exam-mocha-test-loader.js | 2 +- .../-private/ember-exam-qunit-test-loader.js | 10 +-- .../-private/filter-test-modules.js | 14 ++-- .../-private/get-test-loader.js | 6 +- .../-private/split-test-modules.js | 4 +- addon-test-support/start.js | 2 +- lib/commands/exam.js | 42 +++++----- lib/commands/exam/iterate.js | 2 +- lib/utils/config-reader.js | 2 +- lib/utils/execution-state-manager.js | 4 +- lib/utils/file-system-helper.js | 2 +- lib/utils/test-page-helper.js | 4 +- lib/utils/testem-events.js | 26 +++--- lib/utils/tests-options-validator.js | 50 +++++------ node-tests/acceptance/exam-iterate-test.js | 40 ++++----- node-tests/acceptance/exam-test.js | 82 +++++++++---------- node-tests/unit/commands/exam-test.js | 6 +- node-tests/unit/utils/config-reader-test.js | 6 +- .../utils/execution-state-manager-test.js | 18 ++-- .../unit/utils/test-page-helper-test.js | 42 +++++----- node-tests/unit/utils/testem-events-test.js | 74 ++++++++--------- .../utils/tests-options-validator-test.js | 66 +++++++-------- tests/dummy/config/ember-try.js | 4 +- tests/test-helper.js | 2 +- tests/unit/mocha/filter-test-modules-test.js | 33 ++++---- tests/unit/mocha/test-loader-test.js | 42 ++++------ tests/unit/mocha/testem-output-test.js | 32 ++++---- tests/unit/qunit/async-iterator-test.js | 6 +- tests/unit/qunit/filter-test-modules-test.js | 43 +++++----- tests/unit/qunit/test-loader-test.js | 47 +++++------ tests/unit/qunit/testem-output-test.js | 32 ++++---- 33 files changed, 370 insertions(+), 387 deletions(-) diff --git a/.stylelintrc.js b/.stylelintrc.js index a2670ea2..fc2671a0 100644 --- a/.stylelintrc.js +++ b/.stylelintrc.js @@ -3,6 +3,6 @@ module.exports = { extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'], rules: { - "selector-class-pattern": null, - } + 'selector-class-pattern': null, + }, }; diff --git a/addon-test-support/-private/async-iterator.js b/addon-test-support/-private/async-iterator.js index 2a91cc88..db548a97 100644 --- a/addon-test-support/-private/async-iterator.js +++ b/addon-test-support/-private/async-iterator.js @@ -51,7 +51,7 @@ export default class AsyncIterator { handleResponse(response) { if (this._waiting === false) { throw new Error( - `${this.toString()} Was not expecting a response, but got a response` + `${this.toString()} Was not expecting a response, but got a response`, ); } else { this._waiting = false; @@ -82,7 +82,7 @@ export default class AsyncIterator { this._done = true; this._testem.removeEventCallbacks( this._response, - this._boundHandleResponse + this._boundHandleResponse, ); } @@ -111,13 +111,13 @@ export default class AsyncIterator { if (this._emberExamExitOnError) { let err = new Error( - `EmberExam: Promise timed out after ${this._timeout} s while waiting for response for ${this._request}` + `EmberExam: Promise timed out after ${this._timeout} s while waiting for response for ${this._request}`, ); reject(err); } else { // eslint-disable-next-line no-console console.error( - `EmberExam: Promise timed out after ${this._timeout} s while waiting for response for ${this._request}. Closing browser to exit gracefully.` + `EmberExam: Promise timed out after ${this._timeout} s while waiting for response for ${this._request}. Closing browser to exit gracefully.`, ); resolve(iteratorCompleteResponse); } diff --git a/addon-test-support/-private/ember-exam-mocha-test-loader.js b/addon-test-support/-private/ember-exam-mocha-test-loader.js index 00def8ba..c4cf7033 100644 --- a/addon-test-support/-private/ember-exam-mocha-test-loader.js +++ b/addon-test-support/-private/ember-exam-mocha-test-loader.js @@ -74,7 +74,7 @@ export default class EmberExamMochaTestLoader extends TestLoader { this._testModules = filterTestModules( this._testModules, modulePath, - filePath + filePath, ); } diff --git a/addon-test-support/-private/ember-exam-qunit-test-loader.js b/addon-test-support/-private/ember-exam-qunit-test-loader.js index c469ffa8..8a79282b 100644 --- a/addon-test-support/-private/ember-exam-qunit-test-loader.js +++ b/addon-test-support/-private/ember-exam-qunit-test-loader.js @@ -82,7 +82,7 @@ export default class EmberExamQUnitTestLoader extends TestLoader { this._testModules = filterTestModules( this._testModules, modulePath, - filePath + filePath, ); } @@ -91,18 +91,18 @@ export default class EmberExamQUnitTestLoader extends TestLoader { this._testModules = splitTestModules( weightTestModules(this._testModules), split, - partitions + partitions, ); this._testem.emit( 'testem:set-modules-queue', this._testModules, - browserId + browserId, ); } else { this._testModules = splitTestModules( this._testModules, split, - partitions + partitions, ); this._testModules.forEach((moduleName) => { super.require(moduleName); @@ -120,7 +120,7 @@ export default class EmberExamQUnitTestLoader extends TestLoader { loadIndividualModule(moduleName) { if (moduleName === undefined) { throw new Error( - 'Failed to load a test module. `moduleName` is undefined in `loadIndividualModule`.' + 'Failed to load a test module. `moduleName` is undefined in `loadIndividualModule`.', ); } super.require(moduleName); diff --git a/addon-test-support/-private/filter-test-modules.js b/addon-test-support/-private/filter-test-modules.js index 7d307cf4..5f9ffab1 100644 --- a/addon-test-support/-private/filter-test-modules.js +++ b/addon-test-support/-private/filter-test-modules.js @@ -41,7 +41,7 @@ function wildcardFilter(module, moduleFilter) { function stringFilter(modules, moduleFilter) { return modules.filter( (module) => - module.includes(moduleFilter) || wildcardFilter(module, moduleFilter) + module.includes(moduleFilter) || wildcardFilter(module, moduleFilter), ); } @@ -57,7 +57,7 @@ function regexFilter(modules, modulePathRegexFilter) { const exclude = modulePathRegexFilter[1]; return modules.filter( - (module) => (!exclude && re.test(module)) || (exclude && !re.test(module)) + (module) => (!exclude && re.test(module)) || (exclude && !re.test(module)), ); } @@ -98,21 +98,21 @@ function filterTestModules(modules, modulePath, filePath) { if (modulePathRegex) { return result.concat( regexFilter(modules, modulePathRegex).filter( - (module) => result.indexOf(module) === -1 - ) + (module) => result.indexOf(module) === -1, + ), ); } else { return result.concat( stringFilter(modules, modulePath).filter( - (module) => result.indexOf(module) === -1 - ) + (module) => result.indexOf(module) === -1, + ), ); } }, []); if (filteredTestModules.length === 0) { throw new Error( - `No tests matched with the filter: ${modulePath || filePath}.` + `No tests matched with the filter: ${modulePath || filePath}.`, ); } return filteredTestModules; diff --git a/addon-test-support/-private/get-test-loader.js b/addon-test-support/-private/get-test-loader.js index 5b6cd580..b84cf58a 100644 --- a/addon-test-support/-private/get-test-loader.js +++ b/addon-test-support/-private/get-test-loader.js @@ -14,17 +14,17 @@ import { export default function getTestLoader() { if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const EmberExamQUnitTestLoader = importSync( - './ember-exam-qunit-test-loader' + './ember-exam-qunit-test-loader', ); return EmberExamQUnitTestLoader['default']; } else if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { const EmberExamMochaTestLoader = importSync( - './ember-exam-mocha-test-loader' + './ember-exam-mocha-test-loader', ); return EmberExamMochaTestLoader['default']; } throw new Error( - 'Unable to find a suitable test loader. You should ensure that one of `ember-qunit` or `ember-mocha` are added as dependencies.' + 'Unable to find a suitable test loader. You should ensure that one of `ember-qunit` or `ember-mocha` are added as dependencies.', ); } diff --git a/addon-test-support/-private/split-test-modules.js b/addon-test-support/-private/split-test-modules.js index fbab530c..970a8a6b 100644 --- a/addon-test-support/-private/split-test-modules.js +++ b/addon-test-support/-private/split-test-modules.js @@ -43,14 +43,14 @@ export default function splitTestModules(modules, split, partitions) { throw new Error( "You must specify numbers for partition (you specified '" + partitions + - "')" + "')", ); } if (split < partition) { throw new Error( 'You must specify partitions numbered less than or equal to your split value of ' + - split + split, ); } else if (partition < 1) { throw new Error('You must specify partitions numbered greater than 0'); diff --git a/addon-test-support/start.js b/addon-test-support/start.js index 36e341aa..0f19040e 100644 --- a/addon-test-support/start.js +++ b/addon-test-support/start.js @@ -14,7 +14,7 @@ import { function loadTests(testLoader) { if (testLoader === undefined) { throw new Error( - 'A testLoader instance has not been created. You must call `loadEmberExam()` before calling `loadTest()`.' + 'A testLoader instance has not been created. You must call `loadEmberExam()` before calling `loadTest()`.', ); } diff --git a/lib/commands/exam.js b/lib/commands/exam.js index 498fd037..b3182748 100644 --- a/lib/commands/exam.js +++ b/lib/commands/exam.js @@ -126,7 +126,7 @@ module.exports = TestCommand.extend({ const validator = new Validator( commandOptions, this._getTestFramework(), - this.emberCliVersion + this.emberCliVersion, ); return validator.validateCommands(); }, @@ -163,7 +163,7 @@ module.exports = TestCommand.extend({ commandOptions.query = addToQuery( commandOptions.query, 'split', - commandOptions.split + commandOptions.split, ); process.env.EMBER_EXAM_SPLIT_COUNT = commandOptions.split; @@ -171,13 +171,13 @@ module.exports = TestCommand.extend({ // Ignore the partition option when paralleling (we'll fill it in later) if (!commandOptions.parallel && commandOptions.partition) { const partitions = combineOptionValueIntoArray( - commandOptions.partition + commandOptions.partition, ); for (let i = 0; i < partitions.length; i++) { commandOptions.query = addToQuery( commandOptions.query, 'partition', - partitions[i] + partitions[i], ); } } @@ -187,7 +187,7 @@ module.exports = TestCommand.extend({ commandOptions.query = addToQuery( commandOptions.query, 'modulePath', - commandOptions.modulePath + commandOptions.modulePath, ); } @@ -195,7 +195,7 @@ module.exports = TestCommand.extend({ commandOptions.query = addToQuery( commandOptions.query, 'preserveTestName', - commandOptions.preserveTestName + commandOptions.preserveTestName, ); } @@ -203,7 +203,7 @@ module.exports = TestCommand.extend({ commandOptions.query = addToQuery( commandOptions.query, 'filePath', - commandOptions.filePath + commandOptions.filePath, ); } @@ -211,20 +211,20 @@ module.exports = TestCommand.extend({ commandOptions.query = addToQuery( commandOptions.query, 'loadBalance', - commandOptions.loadBalance + commandOptions.loadBalance, ); } if (commandOptions.replayBrowser) { commandOptions.replayBrowser = combineOptionValueIntoArray( - commandOptions.replayBrowser + commandOptions.replayBrowser, ); } if (typeof commandOptions.random !== 'undefined') { commandOptions.query = this._randomize( commandOptions.random, - commandOptions.query + commandOptions.query, ); } @@ -266,14 +266,14 @@ module.exports = TestCommand.extend({ isReplayExecution: this.commands.get('replayExecution'), isWriteExecutionFile: this.commands.get('writeExecutionFile'), }, - this.testemEvents + this.testemEvents, ); additionalEvents = Object.assign(additionalEvents, loadBalancingEvents); } config.custom_browser_socket_events = Object.assign( config.custom_browser_socket_events || {}, - additionalEvents + additionalEvents, ); if ( @@ -288,7 +288,7 @@ module.exports = TestCommand.extend({ if (commandOptions.replayExecution) { this.testemEvents.setReplayExecutionMap( commandOptions.replayExecution, - commandOptions.replayBrowser + commandOptions.replayBrowser, ); } @@ -312,7 +312,7 @@ module.exports = TestCommand.extend({ log.info( `Browser ${browserId} exiting. [ # of modules in current module queue ${ testemEvents.stateManager.getTestModuleQueue().length - } ]` + } ]`, ); // if getBrowserId cannot get the browserId // but the test queue is not empty, report the number of test modules left in the queue @@ -322,7 +322,7 @@ module.exports = TestCommand.extend({ ui.writeLine( `[ # of modules in current module queue ${ testemEvents.stateManager.getTestModuleQueue().length - } ]` + } ]`, ); } else { throw new Error('testModuleQueue is not set.'); @@ -343,7 +343,7 @@ module.exports = TestCommand.extend({ launcherId, ui, commands, - Date.now() + Date.now(), ); }; @@ -370,7 +370,7 @@ module.exports = TestCommand.extend({ return this._getModuleMetadataAndBrowserExitSocketEvents( browserExitHandler, - browserTerminationHandler + browserTerminationHandler, ); }, @@ -382,7 +382,7 @@ module.exports = TestCommand.extend({ */ _getModuleMetadataAndBrowserExitSocketEvents( browserExitHandler, - browserTerminationHandler + browserTerminationHandler, ) { const events = {}; const testemEvents = this.testemEvents; @@ -442,7 +442,7 @@ module.exports = TestCommand.extend({ */ _getLoadBalancingBrowserSocketEvents( { isLoadBalance, isReplayExecution, isWriteExecutionFile }, - testemEvents + testemEvents, ) { const events = {}; const ui = this.ui; @@ -452,14 +452,14 @@ module.exports = TestCommand.extend({ browserId, modules, isLoadBalance, - isReplayExecution + isReplayExecution, ); }; events['testem:next-module-request'] = function (browserId) { testemEvents.nextModuleResponse( browserId, this.socket, - isWriteExecutionFile + isWriteExecutionFile, ); }; events['test-result'] = function (result) { diff --git a/lib/commands/exam/iterate.js b/lib/commands/exam/iterate.js index 8a7e9c53..affd5209 100644 --- a/lib/commands/exam/iterate.js +++ b/lib/commands/exam/iterate.js @@ -85,7 +85,7 @@ module.exports = { execa.sync( './node_modules/.bin/ember', ['build', '--output-path', `${this._outputDir}`], - ['stdio', 'inherit'] + ['stdio', 'inherit'], ); }, diff --git a/lib/utils/config-reader.js b/lib/utils/config-reader.js index a26d048b..b383a90b 100644 --- a/lib/utils/config-reader.js +++ b/lib/utils/config-reader.js @@ -59,7 +59,7 @@ function _readFileByType(file) { */ module.exports = function readTestemConfig( file, - potentialFiles = potentialConfigFiles + potentialFiles = potentialConfigFiles, ) { if (file) { potentialFiles.unshift(file); diff --git a/lib/utils/execution-state-manager.js b/lib/utils/execution-state-manager.js index 7f9bcf01..a1fd9d01 100644 --- a/lib/utils/execution-state-manager.js +++ b/lib/utils/execution-state-manager.js @@ -219,7 +219,7 @@ class ExecutionStateManager { failed, skipped, duration, - failedTests + failedTests, ) { this._moduleMetadata.set(moduleName, { moduleName, @@ -262,7 +262,7 @@ class ExecutionStateManager { ? curModuleMetadata.skipped + 1 : curModuleMetadata.skipped, curModuleMetadata.duration + metadata.duration, - curModuleMetadata.failedTests + curModuleMetadata.failedTests, ); } diff --git a/lib/utils/file-system-helper.js b/lib/utils/file-system-helper.js index 8fb7dac9..ccc31732 100644 --- a/lib/utils/file-system-helper.js +++ b/lib/utils/file-system-helper.js @@ -10,7 +10,7 @@ const fs = require('fs-extra'); module.exports = function writeJsonToFile( fileName, targetJsonObject, - option = {} + option = {}, ) { try { fs.writeJsonSync(fileName, targetJsonObject, option); diff --git a/lib/utils/test-page-helper.js b/lib/utils/test-page-helper.js index f77c815e..1c179f24 100644 --- a/lib/utils/test-page-helper.js +++ b/lib/utils/test-page-helper.js @@ -158,7 +158,7 @@ function getTestUrlFromTestemConfig(configFile) { if (!testPage) { // eslint-disable-next-line no-console console.warn( - 'No test_page value found in the config. Defaulting to "tests/index.html?hidepassed"' + 'No test_page value found in the config. Defaulting to "tests/index.html?hidepassed"', ); testPage = 'tests/index.html?hidepassed'; } @@ -218,7 +218,7 @@ function getMultipleTestPages(config, commandOptions) { if (Array.isArray(customBaseUrl)) { testPages = customBaseUrl.reduce(function (testPages, customBaseUrl) { return testPages.concat( - _generateTestPages(customBaseUrl, appendingParam, browserIds) + _generateTestPages(customBaseUrl, appendingParam, browserIds), ); }, []); } else { diff --git a/lib/utils/testem-events.js b/lib/utils/testem-events.js index 8b8bd007..df1b5df3 100644 --- a/lib/utils/testem-events.js +++ b/lib/utils/testem-events.js @@ -13,7 +13,7 @@ const writeJsonToFile = require('./file-system-helper'); */ function getSortedModuleMetaData(moduleMetadata) { return new Map( - [...moduleMetadata.entries()].sort((a, b) => b[1].duration - a[1].duration) + [...moduleMetadata.entries()].sort((a, b) => b[1].duration - a[1].duration), ); } @@ -52,14 +52,14 @@ class TestemEvents { browserIdsToReplay.forEach((browserId) => { browserModuleMap.set( browserId.toString(), - executionJson.executionMapping[browserId.toString()] + executionJson.executionMapping[browserId.toString()], ); }); } else if (executionJson.failedBrowsers.length > 0) { executionJson.failedBrowsers.forEach((browserId) => { browserModuleMap.set( browserId, - executionJson.executionMapping[browserId] + executionJson.executionMapping[browserId], ); }); } else { @@ -70,7 +70,7 @@ class TestemEvents { ) { browserModuleMap.set( browserId.toString(), - executionJson.executionMapping[browserId.toString()] + executionJson.executionMapping[browserId.toString()], ); } } @@ -97,7 +97,7 @@ class TestemEvents { // Only set the moduleQueue once, ignore repeated requests this.stateManager.setReplayExecutionModuleQueue( replayExecutionMap.get(browserId), - browserId + browserId, ); } } else if (loadBalance && !this.stateManager.getTestModuleQueue()) { @@ -136,7 +136,7 @@ class TestemEvents { if (moduleName && writeExecutionFile) { this.stateManager.addModuleNameToReplayExecutionMap( moduleName, - browserId + browserId, ); } } @@ -218,7 +218,7 @@ class TestemEvents { launcherId, ui, commands, - currentDate + currentDate, ) { const browsersStarted = this.stateManager.getStartedLaunchers(); let browsersCompleted = false; @@ -229,10 +229,10 @@ class TestemEvents { if (commands.get('writeModuleMetadataFile')) { const moduleDetailFileName = path.join( this.root, - `module-metadata-${currentDate}.json` + `module-metadata-${currentDate}.json`, ); const sortedModuleMetadata = getSortedModuleMetaData( - this.stateManager.getModuleMetadata() + this.stateManager.getModuleMetadata(), ); writeJsonToFile( @@ -242,10 +242,10 @@ class TestemEvents { launched: `${browsersStarted.size} browser(s)`, modules: Array.from(sortedModuleMetadata.values()), }, - { spaces: 2 } + { spaces: 2 }, ); ui.writeLine( - `\nExecution module details were recorded at ${moduleDetailFileName}` + `\nExecution module details were recorded at ${moduleDetailFileName}`, ); } @@ -253,7 +253,7 @@ class TestemEvents { const moduleMapJson = this._generatesModuleMapJsonObject(browserCount); const testExecutionPath = path.join( this.root, - `test-execution-${currentDate}.json` + `test-execution-${currentDate}.json`, ); writeJsonToFile(testExecutionPath, moduleMapJson, { spaces: 2 }); @@ -261,7 +261,7 @@ class TestemEvents { } ui.writeLine( - `Out of requested ${browserCount} browser(s), ${browsersStarted.size} browser(s) was launched & completed.` + `Out of requested ${browserCount} browser(s), ${browsersStarted.size} browser(s) was launched & completed.`, ); if (browserCount !== browsersStarted.size) { diff --git a/lib/utils/tests-options-validator.js b/lib/utils/tests-options-validator.js index 2753d173..a8648c92 100644 --- a/lib/utils/tests-options-validator.js +++ b/lib/utils/tests-options-validator.js @@ -35,7 +35,7 @@ function getNumberOfBrowser(fileName) { function validateReplayBrowser(replayExecution, replayBrowser) { if (!replayExecution) { throw new SilentError( - 'EmberExam: You must specify replay-execution when using the replay-browser option.' + 'EmberExam: You must specify replay-execution when using the replay-browser option.', ); } @@ -45,12 +45,12 @@ function validateReplayBrowser(replayExecution, replayBrowser) { const browserId = replayBrowser[i]; if (browserId < 1) { throw new SilentError( - 'EmberExam: You must specify replay-browser values greater than or equal to 1.' + 'EmberExam: You must specify replay-browser values greater than or equal to 1.', ); } if (browserId > numberOfBrowsers) { throw new SilentError( - 'EmberExam: You must specify replayBrowser value smaller than a number of browsers in the specified json file.' + 'EmberExam: You must specify replayBrowser value smaller than a number of browsers in the specified json file.', ); } } @@ -68,7 +68,7 @@ function validateReplayBrowser(replayExecution, replayBrowser) { function validatePartitionSplit(partitions, split) { if (!split) { throw new SilentError( - 'EmberExam: You must specify a `split` value in order to use `partition`.' + 'EmberExam: You must specify a `split` value in order to use `partition`.', ); } @@ -76,12 +76,12 @@ function validatePartitionSplit(partitions, split) { const partition = partitions[i]; if (partition < 1) { throw new SilentError( - 'EmberExam: Split tests are one-indexed, so you must specify partition values greater than or equal to 1.' + 'EmberExam: Split tests are one-indexed, so you must specify partition values greater than or equal to 1.', ); } if (partition > split) { throw new SilentError( - 'EmberExam: You must specify `partition` values that are less than or equal to your `split` value.' + 'EmberExam: You must specify `partition` values that are less than or equal to your `split` value.', ); } } @@ -146,7 +146,7 @@ module.exports = class TestsOptionsValidator { if (typeof this.options.writeExecutionFile !== 'undefined') { validatedOptions.set( 'writeExecutionFile', - this.validateWriteExecutionFile() + this.validateWriteExecutionFile(), ); } @@ -174,7 +174,7 @@ module.exports = class TestsOptionsValidator { if (typeof split !== 'undefined' && split < 2) { // eslint-disable-next-line no-console console.warn( - 'You should specify a number of files greater than 1 to split your tests across. Defaulting to 1 split which is the same as not using `split`.' + 'You should specify a number of files greater than 1 to split your tests across. Defaulting to 1 split which is the same as not using `split`.', ); split = 1; } @@ -184,13 +184,13 @@ module.exports = class TestsOptionsValidator { typeof this.options.replayBrowser !== 'undefined' ) { throw new SilentError( - 'EmberExam: You must not use the `replay-browser` option with the `split` option.' + 'EmberExam: You must not use the `replay-browser` option with the `split` option.', ); } if (typeof split !== 'undefined' && this.options.replayExecution) { throw new SilentError( - 'EmberExam: You must not use the `replay-execution` option with the `split` option.' + 'EmberExam: You must not use the `replay-execution` option with the `split` option.', ); } @@ -215,7 +215,7 @@ module.exports = class TestsOptionsValidator { if (shouldRandomize && this.framework === 'mocha') { // eslint-disable-next-line no-console console.warn( - 'Mocha does not currently support randomizing test order, so tests will run in normal order. Please see https://github.com/mochajs/mocha/issues/902 for more info.' + 'Mocha does not currently support randomizing test order, so tests will run in normal order. Please see https://github.com/mochajs/mocha/issues/902 for more info.', ); } @@ -234,12 +234,12 @@ module.exports = class TestsOptionsValidator { if (!this.options.loadBalance) { throw new SilentError( - 'EmberExam: You must run test suite with the `load-balance` option in order to use the `write-execution-file` option.' + 'EmberExam: You must run test suite with the `load-balance` option in order to use the `write-execution-file` option.', ); } else if (this.options.launch === 'false') { //When `--no-launch` option is passed, a value for launch in testem config is set to be string false. throw new SilentError( - 'EmberExam: You must not use no-launch with write-execution-file option.' + 'EmberExam: You must not use no-launch with write-execution-file option.', ); } @@ -257,38 +257,38 @@ module.exports = class TestsOptionsValidator { if (isNaN(parallelValue)) { throw new SilentError( - `EmberExam: You must specify a Numeric value to 'parallel'. Value passed: ${this.options.parallel}` + `EmberExam: You must specify a Numeric value to 'parallel'. Value passed: ${this.options.parallel}`, ); } this.options.parallel = parallelValue; if (typeof this.options.replayBrowser !== 'undefined') { throw new SilentError( - 'EmberExam: You must not use the `replay-browser` option with the `parallel` option.' + 'EmberExam: You must not use the `replay-browser` option with the `parallel` option.', ); } if (this.options.replayExecution) { throw new SilentError( - 'EmberExam: You must not use the `replay-execution` option with the `parallel` option.' + 'EmberExam: You must not use the `replay-execution` option with the `parallel` option.', ); } if (!this.options.loadBalance) { if (!this.options.split) { throw new SilentError( - 'EmberExam: You must specify the `split` option in order to run your tests in parallel.' + 'EmberExam: You must specify the `split` option in order to run your tests in parallel.', ); } else if (this.options.parallel !== 1) { throw new SilentError( - 'EmberExam: When used with `split` or `partition`, `parallel` does not accept a value other than 1.' + 'EmberExam: When used with `split` or `partition`, `parallel` does not accept a value other than 1.', ); } } if (this.options.parallel < 1) { throw new SilentError( - 'EmberExam: You must specify a value greater than 1 to `parallel`.' + 'EmberExam: You must specify a value greater than 1 to `parallel`.', ); } @@ -306,32 +306,32 @@ module.exports = class TestsOptionsValidator { const emberCliVersionRange = semver.validRange(this.emberCliVersion); if (semver.gtr('3.2.0', emberCliVersionRange)) { throw new SilentError( - 'EmberExam: You must be using ember-cli version ^3.2.0 for this feature to work properly.' + 'EmberExam: You must be using ember-cli version ^3.2.0 for this feature to work properly.', ); } if (typeof this.options.replayBrowser !== 'undefined') { throw new SilentError( - 'EmberExam: You must not use the `replay-browser` option with the `load-balance` option.' + 'EmberExam: You must not use the `replay-browser` option with the `load-balance` option.', ); } if (this.options.replayExecution) { throw new SilentError( - 'EmberExam: You must not use the `replay-execution` option with the `load-balance` option.' + 'EmberExam: You must not use the `replay-execution` option with the `load-balance` option.', ); } //When `--no-launch` option is passed, a value for launch in testem config is set to be string false. if (this.options.launch === 'false') { throw new SilentError( - 'EmberExam: You must not use `no-launch` option with the `load-balance` option.' + 'EmberExam: You must not use `no-launch` option with the `load-balance` option.', ); } if (!this.options.parallel) { throw new SilentError( - 'EmberExam: You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`.' + 'EmberExam: You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`.', ); } @@ -354,7 +354,7 @@ module.exports = class TestsOptionsValidator { if (this.options.launch === 'false') { throw new SilentError( - 'EmberExam: You must not use `no-launch` option with the `replay-execution` option.' + 'EmberExam: You must not use `no-launch` option with the `replay-execution` option.', ); } diff --git a/node-tests/acceptance/exam-iterate-test.js b/node-tests/acceptance/exam-iterate-test.js index ba5c7329..2225cd22 100644 --- a/node-tests/acceptance/exam-iterate-test.js +++ b/node-tests/acceptance/exam-iterate-test.js @@ -18,20 +18,20 @@ describe('Acceptance | Exam Iterate Command', function () { const stdout = child.stdout; assert.ok( stdout.includes('Building app for test iterations.'), - 'Logged building message from command' + 'Logged building message from command', ); assert.ok( stdout.includes('Built project successfully.'), - 'Built successfully according to Ember-CLI' + 'Built successfully according to Ember-CLI', ); assert.ok( stdout.includes('Running iteration #1.'), - 'Logs first iteration' + 'Logs first iteration', ); assert.ok( stdout.includes('Running iteration #2.'), - 'Logs second iteration' + 'Logs second iteration', ); const seedRE = /Randomizing tests with seed: (.*)/g; @@ -44,16 +44,16 @@ describe('Acceptance | Exam Iterate Command', function () { assert.notEqual( firstSeed, secondSeed, - 'the first and second seeds are not the same' + 'the first and second seeds are not the same', ); assert.ok( stdout.includes('Cleaning up test iterations.'), - 'Logged cleaning up message from command' + 'Logged cleaning up message from command', ); assert.throws( () => fs.accessSync('iteration-dist', fs.F_OK), - 'iteration-dist is cleaned up' + 'iteration-dist is cleaned up', ); }); }); @@ -71,7 +71,7 @@ describe('Acceptance | Exam Iterate Command', function () { assert.ok( splitErrorRE.test(error.stderr), - 'expected stderr to contain the appropriate error message' + 'expected stderr to contain the appropriate error message', ); assert.strictEqual(error.exitCode, 1); assert.strictEqual(error.failed, true); @@ -93,20 +93,20 @@ describe('Acceptance | Exam Iterate Command', function () { assert.ok( !stdout.includes('Building app for test iterations.'), - 'No logged building message from command' + 'No logged building message from command', ); assert.ok( !stdout.includes('Built project successfully.'), - 'Not built successfully according to Ember-CLI' + 'Not built successfully according to Ember-CLI', ); assert.ok( stdout.includes('Running iteration #1.'), - 'Logs first iteration' + 'Logs first iteration', ); assert.ok( stdout.includes('Running iteration #2.'), - 'Logs second iteration' + 'Logs second iteration', ); const seedRE = /Randomizing tests with seed: (.*)/g; @@ -119,23 +119,23 @@ describe('Acceptance | Exam Iterate Command', function () { assert.notEqual( firstSeed, secondSeed, - 'the first and second seeds are not the same' + 'the first and second seeds are not the same', ); assert.ok( !stdout.includes('Cleaning up test iterations.'), - 'No logged cleaning up message from command' + 'No logged cleaning up message from command', ); assert.throws( () => fs.accessSync('iteration-dist', fs.F_OK), - 'iteration-dist is non-existent' + 'iteration-dist is non-existent', ); assert.doesNotThrow( () => fs.accessSync(buildDir, fs.F_OK), - 'dist is not cleaned up' + 'dist is not cleaned up', ); - } + }, ); }); }); @@ -147,7 +147,7 @@ describe('Acceptance | Exam Iterate Command', function () { '..', 'tests', 'unit', - 'failing-test.js' + 'failing-test.js', ); beforeEach(function () { @@ -155,7 +155,7 @@ describe('Acceptance | Exam Iterate Command', function () { __dirname, '..', 'fixtures', - 'failure.js' + 'failure.js', ); fs.copySync(failingTestPath, destPath); }); @@ -170,7 +170,7 @@ describe('Acceptance | Exam Iterate Command', function () { (error) => { assert.strictEqual(error.exitCode, 1); assert.strictEqual(error.killed, false); - } + }, ); }); }); diff --git a/node-tests/acceptance/exam-test.js b/node-tests/acceptance/exam-test.js index bd365a8a..53f0a3b3 100644 --- a/node-tests/acceptance/exam-test.js +++ b/node-tests/acceptance/exam-test.js @@ -24,7 +24,7 @@ function getTotalNumberOfTests(output) { // which adds this Ember.onerror validation test. // As Ember.onerror validation test is added per browser the total number of tests executed should be the sum of TOTAL_NUM_TESTS defined and a number of browsers. const emberOnerror = output.match( - /ember-qunit: Ember.onerror validation: Ember.onerror is functioning properly/g + /ember-qunit: Ember.onerror validation: Ember.onerror is functioning properly/g, ); return TOTAL_NUM_TESTS + (emberOnerror ? emberOnerror.length : 0); } @@ -48,14 +48,14 @@ describe('Acceptance | Exam Command', function () { good.forEach(function (partition) { assert.ok( output.includes(`${text} ${partition} `), - `output has ${text} ${partition}` + `output has ${text} ${partition}`, ); }); (bad || []).forEach(function (partition) { assert.ok( !output.includes(`${text} ${partition} `), - `output does not have ${text} ${partition}` + `output does not have ${text} ${partition}`, ); }); } @@ -65,7 +65,7 @@ describe('Acceptance | Exam Command', function () { assert.strictEqual( getNumberOfTests(output), getTotalNumberOfTests(output), - 'ran all of the tests in the suite' + 'ran all of the tests in the suite', ); } @@ -73,7 +73,7 @@ describe('Acceptance | Exam Command', function () { assertOutput(output, 'Exam Partition', good, bad); assert.ok( getNumberOfTests(output) < getTotalNumberOfTests(output), - 'did not run all of the tests in the suite' + 'did not run all of the tests in the suite', ); } @@ -83,14 +83,14 @@ describe('Acceptance | Exam Command', function () { const stdout = child.stdout; assert.ok( !stdout.includes('Exam Partition'), - 'does not add any sort of partition info' + 'does not add any sort of partition info', ); assert.strictEqual( getNumberOfTests(stdout), getTotalNumberOfTests(stdout), - 'ran all of the tests in the suite' + 'ran all of the tests in the suite', ); - } + }, ); }); @@ -100,7 +100,7 @@ describe('Acceptance | Exam Command', function () { '..', '..', 'tests', - 'test-helper.js' + 'test-helper.js', ); const renamedOriginalTestHelperPath = path.join( @@ -108,14 +108,14 @@ describe('Acceptance | Exam Command', function () { '..', '..', 'tests', - 'test-helper-orig.js' + 'test-helper-orig.js', ); const testHelperWithLoadPath = path.join( __dirname, '..', 'fixtures', - 'test-helper-with-load.js' + 'test-helper-with-load.js', ); before(function () { // Use test-helper-with-load.js as the test-helper.js file @@ -147,12 +147,12 @@ describe('Acceptance | Exam Command', function () { const stdout = child.stdout; assert.ok( !stdout.includes('Exam Partition'), - 'does not add any sort of partition info' + 'does not add any sort of partition info', ); assert.strictEqual( getNumberOfTests(stdout), getTotalNumberOfTests(stdout), - 'ran all of the tests in the suite' + 'ran all of the tests in the suite', ); }); }); @@ -212,8 +212,8 @@ describe('Acceptance | Exam Command', function () { ]).then(assertExpectRejection, (error) => { assert.ok( error.stderr.includes( - 'You must specify `partition` values that are less than or equal to your `split` value.' - ) + 'You must specify `partition` values that are less than or equal to your `split` value.', + ), ); }); }); @@ -228,8 +228,8 @@ describe('Acceptance | Exam Command', function () { ]).then(assertExpectRejection, (error) => { assert.ok( error.stderr.includes( - 'You must specify a `split` value in order to use `partition`.' - ) + 'You must specify a `split` value in order to use `partition`.', + ), ); }); }); @@ -278,12 +278,12 @@ describe('Acceptance | Exam Command', function () { const stdout = child.stdout; assert.ok( stdout.includes('Randomizing tests with seed: 1337'), - 'logged the seed value' + 'logged the seed value', ); assert.strictEqual( getNumberOfTests(stdout), getTotalNumberOfTests(stdout), - 'ran all of the tests in the suite' + 'ran all of the tests in the suite', ); }); }); @@ -295,13 +295,13 @@ describe('Acceptance | Exam Command', function () { function assertTestExecutionFailedBrowsers(output, numberOfFailedBrowsers) { const testExecutionPath = path.join( process.cwd(), - output.match(/test-execution-([0-9]*).json/g)[0] + output.match(/test-execution-([0-9]*).json/g)[0], ); unlinkFiles.push(testExecutionPath); assert.ok( fs.existsSync(testExecutionPath), - 'test execution json written to root' + 'test execution json written to root', ); const testExecutionFile = fs.readJsonSync(testExecutionPath); @@ -309,19 +309,19 @@ describe('Acceptance | Exam Command', function () { assert.strictEqual( testExecutionFile.failedBrowsers.length, numberOfFailedBrowsers, - 'failed browsers array is correctly recorded' + 'failed browsers array is correctly recorded', ); } function assertModuleDetailJson(output) { let moduleRunDetailJsonPath = path.join( process.cwd(), - output.match(/module-metadata-([0-9]*).json/g)[0] + output.match(/module-metadata-([0-9]*).json/g)[0], ); unlinkFiles.push(moduleRunDetailJsonPath); assert.ok( fs.existsSync(moduleRunDetailJsonPath), - 'module run detail json written to root' + 'module run detail json written to root', ); } @@ -342,8 +342,8 @@ describe('Acceptance | Exam Command', function () { ]).then(assertExpectRejection, (error) => { assert.ok( error.stderr.includes( - 'You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`.' - ) + 'You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`.', + ), ); }); }); @@ -364,7 +364,7 @@ describe('Acceptance | Exam Command', function () { assert.strictEqual( getNumberOfTests(output), getTotalNumberOfTests(output), - 'ran all of the tests in the suite' + 'ran all of the tests in the suite', ); }); }); @@ -400,7 +400,7 @@ describe('Acceptance | Exam Command', function () { assert.strictEqual( getNumberOfTests(output), getTotalNumberOfTests(output), - 'ran all of the tests in the suite' + 'ran all of the tests in the suite', ); }); }); @@ -426,7 +426,7 @@ describe('Acceptance | Exam Command', function () { assertOutput(output, 'Browser Id', [1, 2, 3]); assert.ok( getNumberOfTests(output) < getTotalNumberOfTests(output), - 'did not run all of the tests in the suite' + 'did not run all of the tests in the suite', ); }); }); @@ -438,14 +438,14 @@ describe('Acceptance | Exam Command', function () { '..', 'tests', 'unit', - 'browser-exit-test.js' + 'browser-exit-test.js', ); beforeEach(function () { const failingTestPath = path.join( __dirname, '..', 'fixtures', - 'browser-exit.js' + 'browser-exit.js', ); fs.copySync(failingTestPath, destPath); return execa('ember', ['build', '--output-path', 'failure-dist']); @@ -469,9 +469,9 @@ describe('Acceptance | Exam Command', function () { const output = error.stdout; assert.ok( output.includes( - 'Error: Browser exited on request from test driver' + 'Error: Browser exited on request from test driver', ), - `browser exited during the test execution:\n${output}` + `browser exited during the test execution:\n${output}`, ); assertTestExecutionFailedBrowsers(output, 1); }); @@ -490,9 +490,9 @@ describe('Acceptance | Exam Command', function () { const output = error.stdout; assert.ok( output.includes( - 'Error: Browser exited on request from test driver' + 'Error: Browser exited on request from test driver', ), - `browser exited during the test execution:\n${output}` + `browser exited during the test execution:\n${output}`, ); assertModuleDetailJson(output); }); @@ -549,14 +549,14 @@ describe('Acceptance | Exam Command', function () { assert.strictEqual( output.match(/test-execution-([0-9]*).json/g), null, - 'no test execution json should be written' + 'no test execution json should be written', ); assertOutput(output, 'Browser Id', [1]); assert.strictEqual( getNumberOfTests(output), 27, - 'ran all of the tests for browser one' + 'ran all of the tests for browser one', ); }); }); @@ -577,14 +577,14 @@ describe('Acceptance | Exam Command', function () { assert.strictEqual( output.match(/test-execution-([0-9]*).json/g), null, - 'no test execution json should be written' + 'no test execution json should be written', ); assertOutput(output, 'Browser Id', [1, 2]); assert.strictEqual( getNumberOfTests(output), getTotalNumberOfTests(output), - 'ran all of the tests in the suite' + 'ran all of the tests in the suite', ); }); }); @@ -607,14 +607,14 @@ describe('Acceptance | Exam Command', function () { assert.strictEqual( output.match(/test-execution-([0-9]*).json/g), null, - 'no test execution json should be written' + 'no test execution json should be written', ); assertOutput(output, 'Browser Id', ['2']); assert.strictEqual( getNumberOfTests(output), 40, - 'ran all of the tests for browser two' + 'ran all of the tests for browser two', ); }); }); diff --git a/node-tests/unit/commands/exam-test.js b/node-tests/unit/commands/exam-test.js index b5a5107e..58ae0030 100644 --- a/node-tests/unit/commands/exam-test.js +++ b/node-tests/unit/commands/exam-test.js @@ -91,7 +91,7 @@ describe('ExamCommand', function () { return command.run({ split: 2, partition: [1, 2] }).then(function () { assert.strictEqual( called.testRunOptions.query, - 'split=2&partition=1&partition=2' + 'split=2&partition=1&partition=2', ); }); }); @@ -102,7 +102,7 @@ describe('ExamCommand', function () { .then(function () { assert.strictEqual( called.testRunOptions.query, - 'someQuery=derp&hidepassed&split=2&partition=2' + 'someQuery=derp&hidepassed&split=2&partition=2', ); }); }); @@ -133,7 +133,7 @@ describe('ExamCommand', function () { .then(function () { assert.strictEqual( called.testRunOptions.query, - 'someQuery=derp&hidepassed&seed=1337' + 'someQuery=derp&hidepassed&seed=1337', ); }); }); diff --git a/node-tests/unit/utils/config-reader-test.js b/node-tests/unit/utils/config-reader-test.js index 036ae8e3..ee99ef02 100644 --- a/node-tests/unit/utils/config-reader-test.js +++ b/node-tests/unit/utils/config-reader-test.js @@ -40,7 +40,7 @@ describe('ConfigReader | readTestemConfig', function () { it('should require a specified `js` file and return an object in the module when the file exsits and potential files are empty list', function () { assert.deepEqual( readTestemConfig('testem.simple-test-page.js', []).foo, - 'bar' + 'bar', ); }); @@ -51,7 +51,7 @@ describe('ConfigReader | readTestemConfig', function () { assert.deepEqual( readTestemConfig(path.join(fixturifyDir, 'testem.json-file.json'), []) .foo, - 'bar' + 'bar', ); }); @@ -62,7 +62,7 @@ describe('ConfigReader | readTestemConfig', function () { assert.deepEqual( readTestemConfig(path.join(fixturifyDir, 'testem.yaml-file.yaml'), []) .foo, - 'bar' + 'bar', ); }); }); diff --git a/node-tests/unit/utils/execution-state-manager-test.js b/node-tests/unit/utils/execution-state-manager-test.js index b28ac38e..0f8356cc 100644 --- a/node-tests/unit/utils/execution-state-manager-test.js +++ b/node-tests/unit/utils/execution-state-manager-test.js @@ -24,7 +24,7 @@ describe('ExecutionStateManager', function () { assert.deepEqual( this.stateManager.getTestModuleQueue(), this.moduleQueue, - 'the correct moduleQueue was returned' + 'the correct moduleQueue was returned', ); }); @@ -34,12 +34,12 @@ describe('ExecutionStateManager', function () { assert.strictEqual( this.stateManager.getNextModuleTestModuleQueue(), 'foo', - 'correctly returns the next module' + 'correctly returns the next module', ); assert.deepEqual( this.stateManager.getTestModuleQueue(), ['bar', 'baz', 'boo', 'far', 'faz'], - 'the moduleQueue state was updated' + 'the moduleQueue state was updated', ); }); @@ -47,7 +47,7 @@ describe('ExecutionStateManager', function () { assert.strictEqual( this.stateManager.getNextModuleTestModuleQueue(), null, - 'returns null when moduleQueue has not been set' + 'returns null when moduleQueue has not been set', ); }); @@ -58,11 +58,11 @@ describe('ExecutionStateManager', function () { assert.deepEqual( this.stateManager.getReplayExecutionModuleQueue(1), - this.moduleQueue + this.moduleQueue, ); assert.deepEqual( this.stateManager.getReplayExecutionModuleQueue(2), - anotherQueue + anotherQueue, ); }); @@ -72,12 +72,12 @@ describe('ExecutionStateManager', function () { assert.strictEqual( this.stateManager.getNextModuleReplayExecutionModuleQueue(1), 'foo', - 'correctly returns the next module' + 'correctly returns the next module', ); assert.deepEqual( this.stateManager.getReplayExecutionModuleQueue(1), ['bar', 'baz', 'boo', 'far', 'faz'], - 'the moduleQueue state was updated' + 'the moduleQueue state was updated', ); }); @@ -85,7 +85,7 @@ describe('ExecutionStateManager', function () { assert.strictEqual( this.stateManager.getNextModuleReplayExecutionModuleQueue(1), null, - 'returns null when moduleQueue has not been set' + 'returns null when moduleQueue has not been set', ); }); }); diff --git a/node-tests/unit/utils/test-page-helper-test.js b/node-tests/unit/utils/test-page-helper-test.js index 10029b85..6fa6f251 100644 --- a/node-tests/unit/utils/test-page-helper-test.js +++ b/node-tests/unit/utils/test-page-helper-test.js @@ -35,7 +35,7 @@ describe('TestPageHelper', function () { it('should have a number of array when a specified option is a combination of number and string in range', function () { assert.deepEqual( combineOptionValueIntoArray([1, '3..6']), - [1, 3, 4, 5, 6] + [1, 3, 4, 5, 6], ); }); }); @@ -76,7 +76,7 @@ describe('TestPageHelper', function () { sinon.assert.calledOnce(warnStub); sinon.assert.calledWithExactly( warnStub, - 'No test_page value found in the config. Defaulting to "tests/index.html?hidepassed"' + 'No test_page value found in the config. Defaulting to "tests/index.html?hidepassed"', ); warnStub.restore(); @@ -84,7 +84,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages specified in testem config file with test-page specified in the file', function () { const testPages = getTestUrlFromTestemConfig( - 'testem.multiple-test-page.js' + 'testem.multiple-test-page.js', ); assert.deepEqual(testPages, [ @@ -98,7 +98,7 @@ describe('TestPageHelper', function () { it('should add `split` when `split` option is used', function () { const appendedUrl = getCustomBaseUrl( { split: 3 }, - 'tests/index.html?hidepassed' + 'tests/index.html?hidepassed', ); assert.deepEqual(appendedUrl, 'tests/index.html?hidepassed&split=3'); @@ -107,7 +107,7 @@ describe('TestPageHelper', function () { it('should add `split` when `split` and `parallel` option are used', function () { const appendedUrl = getCustomBaseUrl( { split: 5, parallel: true }, - 'tests/index.html?hidepassed' + 'tests/index.html?hidepassed', ); assert.deepEqual(appendedUrl, 'tests/index.html?hidepassed&split=5'); @@ -116,7 +116,7 @@ describe('TestPageHelper', function () { it('should add `loadBalance` when `load-balance` option is used', function () { const appendedUrl = getCustomBaseUrl( { loadBalance: 2 }, - 'tests/index.html?hidepassed' + 'tests/index.html?hidepassed', ); assert.deepEqual(appendedUrl, 'tests/index.html?hidepassed&loadBalance'); @@ -125,12 +125,12 @@ describe('TestPageHelper', function () { it('should add `split`, `loadBalance`, and `partition` when `split`, `loadBalance`, and `partition` are used.', function () { const appendedUrl = getCustomBaseUrl( { split: 5, partition: [1, 2, 3], loadBalance: 2 }, - 'tests/index.html?hidepassed' + 'tests/index.html?hidepassed', ); assert.deepEqual( appendedUrl, - 'tests/index.html?hidepassed&split=5&loadBalance&partition=1&partition=2&partition=3' + 'tests/index.html?hidepassed&split=5&loadBalance&partition=1&partition=2&partition=3', ); }); @@ -140,7 +140,7 @@ describe('TestPageHelper', function () { replayExecution: 'test-execution-0000000.json', replayBrowser: [1, 2], }, - 'tests/index.html?hidepassed' + 'tests/index.html?hidepassed', ); assert.deepEqual(appendedUrl, 'tests/index.html?hidepassed&loadBalance'); @@ -188,7 +188,7 @@ describe('TestPageHelper', function () { [ 'tests/index.html?hidepassed&derp=herp', 'tests/index.html?hidepassed&foo=bar', - ] + ], ); assert.deepEqual(appendedUrl, [ @@ -206,7 +206,7 @@ describe('TestPageHelper', function () { [ 'tests/index.html?hidepassed&derp=herp', 'tests/index.html?hidepassed&foo=bar', - ] + ], ); assert.deepEqual(appendedUrl, [ @@ -220,7 +220,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages with no partitions specified', function () { const testPages = getMultipleTestPages( { testPage: 'tests/index.html?hidepassed' }, - { parallel: 1, split: 2 } + { parallel: 1, split: 2 }, ); assert.deepEqual(testPages, [ @@ -232,7 +232,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages with specified partitions', function () { const testPages = getMultipleTestPages( { testPage: 'tests/index.html?hidepassed' }, - { parallel: 1, split: 4, partition: [3, 4] } + { parallel: 1, split: 4, partition: [3, 4] }, ); assert.deepEqual(testPages, [ @@ -244,7 +244,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages for each test_page in the config file with no partitions specified', function () { const testPages = getMultipleTestPages( { configFile: 'testem.multiple-test-page.js' }, - { parallel: 1, split: 2 } + { parallel: 1, split: 2 }, ); assert.deepEqual(testPages, [ @@ -258,7 +258,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages for each test_page in the config file with partitions specified', function () { const testPages = getMultipleTestPages( { configFile: 'testem.multiple-test-page.js' }, - { parallel: 1, split: 4, partition: [3, 4] } + { parallel: 1, split: 4, partition: [3, 4] }, ); assert.deepEqual(testPages, [ @@ -272,7 +272,7 @@ describe('TestPageHelper', function () { it('should have a test page with `loadBalance` when no specified number of browser', function () { const testPages = getMultipleTestPages( { testPage: 'tests/index.html?hidepassed' }, - { loadBalance: true, parallel: 1 } + { loadBalance: true, parallel: 1 }, ); assert.deepEqual(testPages, [ @@ -283,7 +283,7 @@ describe('TestPageHelper', function () { it('should have multiple test page with `loadBalance` with splitting when no specified number of browser', function () { const testPages = getMultipleTestPages( { testPage: 'tests/index.html?hidepassed' }, - { loadBalance: true, parallel: 1, split: 2 } + { loadBalance: true, parallel: 1, split: 2 }, ); assert.deepEqual(testPages, [ @@ -294,7 +294,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages with test loading balanced, no specified partitions and no splitting', function () { const testPages = getMultipleTestPages( { testPage: 'tests/index.html?hidepassed' }, - { loadBalance: true, parallel: 2 } + { loadBalance: true, parallel: 2 }, ); assert.deepEqual(testPages, [ @@ -306,7 +306,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages with test loading balanced, no specified partitions and no splitting', function () { const testPages = getMultipleTestPages( { testPage: 'tests/index.html?hidepassed' }, - { loadBalance: true, parallel: 2, split: 3, partition: [2, 3] } + { loadBalance: true, parallel: 2, split: 3, partition: [2, 3] }, ); assert.deepEqual(testPages, [ @@ -318,7 +318,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages for each test_page in the config file with partitions specified and test loading balanced', function () { const testPages = getMultipleTestPages( { configFile: 'testem.multiple-test-page.js' }, - { loadBalance: true, parallel: 1, split: 4, partition: [3, 4] } + { loadBalance: true, parallel: 1, split: 4, partition: [3, 4] }, ); assert.deepEqual(testPages, [ @@ -330,7 +330,7 @@ describe('TestPageHelper', function () { it('should have multiple test pages with test replay execution', function () { const testPages = getMultipleTestPages( { testPage: 'tests/index.html?hidepassed' }, - { replayExecution: 'abc.json', replayBrowser: [2] } + { replayExecution: 'abc.json', replayBrowser: [2] }, ); assert.deepEqual(testPages, [ diff --git a/node-tests/unit/utils/testem-events-test.js b/node-tests/unit/utils/testem-events-test.js index 5571e41e..bd6a2c7a 100644 --- a/node-tests/unit/utils/testem-events-test.js +++ b/node-tests/unit/utils/testem-events-test.js @@ -39,7 +39,7 @@ describe('TestemEvents', function () { assert.deepEqual( this.testemEvents.stateManager.getTestModuleQueue(), - this.moduleQueue + this.moduleQueue, ); }); @@ -50,7 +50,7 @@ describe('TestemEvents', function () { assert.deepEqual( this.testemEvents.stateManager.getTestModuleQueue(), - this.moduleQueue + this.moduleQueue, ); }); @@ -60,7 +60,7 @@ describe('TestemEvents', function () { assert.deepEqual( this.testemEvents.stateManager.getReplayExecutionModuleQueue('1'), - testExecutionJson.executionMapping['1'] + testExecutionJson.executionMapping['1'], ); }); @@ -70,7 +70,7 @@ describe('TestemEvents', function () { assert.deepEqual( this.testemEvents.stateManager.getReplayExecutionModuleQueue('1'), - testExecutionJson.executionMapping['1'] + testExecutionJson.executionMapping['1'], ); }); @@ -79,7 +79,7 @@ describe('TestemEvents', function () { () => this.testemEvents.setModuleQueue(1, this.moduleQueue, false, true), /No replay execution map was set on the stateManager/, - 'Error is thrown' + 'Error is thrown', ); }); }); @@ -117,12 +117,12 @@ describe('TestemEvents', function () { assert.deepEqual( socket.events, ['testem:next-module-response', fooResponse], - 'testem:next-module-response event was emitted with payload foo' + 'testem:next-module-response event was emitted with payload foo', ); assert.deepEqual( this.testemEvents.stateManager.getModuleMap().values().next().value, ['foo'], - 'module was correctly saved to the moduleMap' + 'module was correctly saved to the moduleMap', ); }); @@ -133,7 +133,7 @@ describe('TestemEvents', function () { assert.deepEqual( this.testemEvents.stateManager.getModuleMap(), emptyMap, - 'moduleMap should be in its initial state' + 'moduleMap should be in its initial state', ); }); @@ -141,7 +141,7 @@ describe('TestemEvents', function () { assert.throws( () => this.testemEvents.nextModuleResponse(1, socket, false, 'dev'), /No moduleQueue was set/, - 'No moduleQueue error was thrown' + 'No moduleQueue error was thrown', ); }); }); @@ -159,7 +159,7 @@ describe('TestemEvents', function () { assert.deepEqual( this.testemEvents.stateManager.getFailedBrowsers(), [1], - 'failed browserId 1 is correctly recorded' + 'failed browserId 1 is correctly recorded', ); }); @@ -170,7 +170,7 @@ describe('TestemEvents', function () { assert.deepEqual( this.testemEvents.stateManager.getFailedBrowsers(), [1], - 'failed browserId 1 is correctly recorded only once' + 'failed browserId 1 is correctly recorded only once', ); }); }); @@ -189,13 +189,13 @@ describe('TestemEvents', function () { ['loadBalance', true], ['writeExecutionFile', false], ]), - '0000' + '0000', ); assert.strictEqual( this.testemEvents.stateManager.getCompletedBrowser(), 1, - 'completedBrowsers was incremented' + 'completedBrowsers was incremented', ); }); @@ -211,11 +211,11 @@ describe('TestemEvents', function () { ['loadBalance', true], ['writeExecutionFile', true], ]), - '0000' + '0000', ); const actual = fs.readFileSync( - path.join(fixtureDir, 'test-execution-0000.json') + path.join(fixtureDir, 'test-execution-0000.json'), ); assert.deepEqual(JSON.parse(actual), { @@ -246,11 +246,11 @@ describe('TestemEvents', function () { ['loadBalance', true], ['writeModuleMetadataFile', true], ]), - '0000' + '0000', ); const actual = fs.readFileSync( - path.join(fixtureDir, 'module-metadata-0000.json') + path.join(fixtureDir, 'module-metadata-0000.json'), ); assert.deepEqual(JSON.parse(actual).modules, [ @@ -302,11 +302,11 @@ describe('TestemEvents', function () { ['loadBalance', true], ['writeModuleMetadataFile', true], ]), - '0000' + '0000', ); const actual = fs.readFileSync( - path.join(fixtureDir, 'module-metadata-0000.json') + path.join(fixtureDir, 'module-metadata-0000.json'), ); assert.deepEqual(JSON.parse(actual).modules, [ @@ -383,11 +383,11 @@ describe('TestemEvents', function () { ['loadBalance', true], ['writeModuleMetadataFile', true], ]), - '0000' + '0000', ); const actual = fs.readFileSync( - path.join(fixtureDir, 'module-metadata-0000.json') + path.join(fixtureDir, 'module-metadata-0000.json'), ); assert.deepEqual(JSON.parse(actual).modules, [ @@ -421,13 +421,13 @@ describe('TestemEvents', function () { ['loadBalance', false], ['writeExecutionFile', false], ]), - '0000' + '0000', ); assert.strictEqual( this.testemEvents.stateManager.getCompletedBrowser(), 1, - 'completedBrowsers was incremented' + 'completedBrowsers was incremented', ); }); @@ -440,7 +440,7 @@ describe('TestemEvents', function () { 1011, mockUi, new Map([['loadBalance', true]]), - '0000' + '0000', ); assert.deepEqual(this.testemEvents.stateManager.getModuleMap().size, 2); @@ -450,7 +450,7 @@ describe('TestemEvents', function () { const mockReplayExecutionMap = { 1: ['a'] }; this.testemEvents.stateManager.addModuleNameToReplayExecutionMap('a', 1); this.testemEvents.stateManager.setReplayExecutionMap( - mockReplayExecutionMap + mockReplayExecutionMap, ); this.testemEvents.stateManager.addToStartedLaunchers(1010); @@ -459,21 +459,21 @@ describe('TestemEvents', function () { 1010, mockUi, new Map([['loadBalance', true]]), - '0000' + '0000', ); assert.deepEqual(this.testemEvents.stateManager.getModuleMap().size, 0); assert.deepEqual( this.testemEvents.stateManager.getTestModuleQueue(), - null + null, ); assert.deepEqual( this.testemEvents.stateManager.getReplayExecutionModuleQueue(), - null + null, ); assert.deepEqual( this.testemEvents.stateManager.getReplayExecutionMap(), - mockReplayExecutionMap + mockReplayExecutionMap, ); }); @@ -481,7 +481,7 @@ describe('TestemEvents', function () { const mockReplayExecutionMap = { 1: ['a'] }; this.testemEvents.stateManager.addModuleNameToReplayExecutionMap('a', 1); this.testemEvents.stateManager.setReplayExecutionMap( - mockReplayExecutionMap + mockReplayExecutionMap, ); this.testemEvents.stateManager.addToStartedLaunchers(1010); @@ -490,21 +490,21 @@ describe('TestemEvents', function () { 1010, mockUi, new Map([['loadBalance', true]]), - '0000' + '0000', ); assert.deepEqual(this.testemEvents.stateManager.getModuleMap().size, 0); assert.deepEqual( this.testemEvents.stateManager.getTestModuleQueue(), - null + null, ); assert.deepEqual( this.testemEvents.stateManager.getReplayExecutionModuleQueue(), - null + null, ); assert.deepEqual( this.testemEvents.stateManager.getReplayExecutionMap(), - mockReplayExecutionMap + mockReplayExecutionMap, ); }); @@ -518,7 +518,7 @@ describe('TestemEvents', function () { 1010, mockUi, new Map([['loadBalance', true]]), - '0000' + '0000', ); assert.deepEqual(this.testemEvents.stateManager.getModuleMap().size, 0); @@ -529,12 +529,12 @@ describe('TestemEvents', function () { 1011, mockUi, new Map([['loadBalance', true]]), - '0000' + '0000', ); assert.deepEqual( this.testemEvents.stateManager.getTestModuleQueue(), - null + null, ); }); }); diff --git a/node-tests/unit/utils/tests-options-validator-test.js b/node-tests/unit/utils/tests-options-validator-test.js index ee956ae7..733fe952 100644 --- a/node-tests/unit/utils/tests-options-validator-test.js +++ b/node-tests/unit/utils/tests-options-validator-test.js @@ -36,7 +36,7 @@ describe('TestOptionsValidator', function () { const validator = new TestOptionsValidator( options, options.framework, - emberCliVer + emberCliVer, ); assert.throws(() => validateCommand(validator, cmd), message); } @@ -45,7 +45,7 @@ describe('TestOptionsValidator', function () { const validator = new TestOptionsValidator( options, options.framework, - emberCliVer + emberCliVer, ); assert.strictEqual(validateCommand(validator, cmd), value); } @@ -63,7 +63,7 @@ describe('TestOptionsValidator', function () { const validator = new TestOptionsValidator( options, options.framework, - emberCliVer + emberCliVer, ); assert.notEqual(validateCommand(validator, cmd), undefined); assert.strictEqual(warnCalled, 1); @@ -86,35 +86,35 @@ describe('TestOptionsValidator', function () { shouldWarn( 'Split', { split: 1 }, - 'You should specify a number of files greater than 1 to split your tests across. Defaulting to 1 split which is the same as not using `split`.' + 'You should specify a number of files greater than 1 to split your tests across. Defaulting to 1 split which is the same as not using `split`.', ); }); it('should throw an error if `partition` is used without `split`', function () { shouldSplitThrows( { partition: [1] }, - /You must specify a `split` value in order to use `partition`/ + /You must specify a `split` value in order to use `partition`/, ); }); it('should throw an error if `partition` contains a value less than 1', function () { shouldSplitThrows( { split: 2, partition: [1, 0] }, - /Split tests are one-indexed, so you must specify partition values greater than or equal to 1./ + /Split tests are one-indexed, so you must specify partition values greater than or equal to 1./, ); }); it('should throw an error if `partition` contains a value greater than `split`', function () { shouldSplitThrows( { split: 2, partition: [1, 3] }, - /You must specify `partition` values that are less than or equal to your `split` value./ + /You must specify `partition` values that are less than or equal to your `split` value./, ); }); it('should throw an error if `partition` contains duplicate values', function () { shouldSplitThrows( { split: 2, partition: [1, 2, 1] }, - /You cannot specify the same partition value twice. 1 is repeated./ + /You cannot specify the same partition value twice. 1 is repeated./, ); }); @@ -156,7 +156,7 @@ describe('TestOptionsValidator', function () { shouldWarn( 'Random', { random: '', framework: 'mocha' }, - 'Mocha does not currently support randomizing test order, so tests will run in normal order. Please see https://github.com/mochajs/mocha/issues/902 for more info.' + 'Mocha does not currently support randomizing test order, so tests will run in normal order. Please see https://github.com/mochajs/mocha/issues/902 for more info.', ); }); }); @@ -166,7 +166,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'Parallel', { parallel: '--reporter' }, - /EmberExam: You must specify a Numeric value to 'parallel'. Value passed: --reporter/ + /EmberExam: You must specify a Numeric value to 'parallel'. Value passed: --reporter/, ); }); @@ -174,7 +174,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'Parallel', { parallel: 1 }, - /You must specify the `split` option in order to run your tests in parallel/ + /You must specify the `split` option in order to run your tests in parallel/, ); }); @@ -182,7 +182,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'Parallel', { replayExecution: 'abc', parallel: 1 }, - /You must not use the `replay-execution` option with the `parallel` option./ + /You must not use the `replay-execution` option with the `parallel` option./, ); }); @@ -190,7 +190,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'Parallel', { replayBrowser: 2, parallel: 1 }, - /You must not use the `replay-browser` option with the `parallel` option./ + /You must not use the `replay-browser` option with the `parallel` option./, ); }); @@ -198,7 +198,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'Parallel', { split: 2, parallel: 2 }, - /When used with `split` or `partition`, `parallel` does not accept a value other than 1./ + /When used with `split` or `partition`, `parallel` does not accept a value other than 1./, ); }); @@ -206,7 +206,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'Parallel', { loadBalance: 2, parallel: 0 }, - /You must specify a value greater than 1 to `parallel`./ + /You must specify a value greater than 1 to `parallel`./, ); }); @@ -224,7 +224,7 @@ describe('TestOptionsValidator', function () { parallel: 2, launch: 'false', }, - false + false, ); }); @@ -232,7 +232,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'writeExecutionFile', { writeExecutionFile: true }, - /You must run test suite with the `load-balance` option in order to use the `write-execution-file` option./ + /You must run test suite with the `load-balance` option in order to use the `write-execution-file` option./, ); }); @@ -244,7 +244,7 @@ describe('TestOptionsValidator', function () { partition: 1, writeExecutionFile: true, }, - /You must run test suite with the `load-balance` option in order to use the `write-execution-file` option./ + /You must run test suite with the `load-balance` option in order to use the `write-execution-file` option./, ); }); @@ -256,7 +256,7 @@ describe('TestOptionsValidator', function () { replayBrowser: [1, 2], writeExecutionFile: true, }, - /You must run test suite with the `load-balance` option in order to use the `write-execution-file` option./ + /You must run test suite with the `load-balance` option in order to use the `write-execution-file` option./, ); }); @@ -269,7 +269,7 @@ describe('TestOptionsValidator', function () { launch: 'false', writeExecutionFile: true, }, - /You must not use no-launch with write-execution-file option./ + /You must not use no-launch with write-execution-file option./, ); }); @@ -281,7 +281,7 @@ describe('TestOptionsValidator', function () { parallel: 2, writeExecutionFile: true, }, - true + true, ); }); }); @@ -292,7 +292,7 @@ describe('TestOptionsValidator', function () { 'LoadBalance', { loadBalance: true, replayExecution: 'abc' }, /You must be using ember-cli version \^3.2.0 for this feature to work properly./, - '3.0.0' + '3.0.0', ); }); @@ -301,7 +301,7 @@ describe('TestOptionsValidator', function () { 'LoadBalance', { loadBalance: true, replayExecution: 'abc' }, /You must be using ember-cli version \^3.2.0 for this feature to work properly./, - '~3.1.0' + '~3.1.0', ); }); @@ -309,7 +309,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'LoadBalance', { loadBalance: true, replayExecution: 'abc' }, - /You must not use the `replay-execution` option with the `load-balance` option./ + /You must not use the `replay-execution` option with the `load-balance` option./, ); }); @@ -317,7 +317,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'LoadBalance', { loadBalance: true, replayBrowser: 3 }, - /You must not use the `replay-browser` option with the `load-balance` option./ + /You must not use the `replay-browser` option with the `load-balance` option./, ); }); @@ -325,7 +325,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'LoadBalance', { loadBalance: true }, - /You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`./ + /You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`./, ); }); @@ -333,7 +333,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'LoadBalance', { loadBalance: true, parallel: 0 }, - /You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`./ + /You should specify the number of browsers to load-balance against using `parallel` when using `load-balance`./, ); }); @@ -341,7 +341,7 @@ describe('TestOptionsValidator', function () { shouldThrow( 'LoadBalance', { loadBalance: true, parallel: 0, launch: 'false' }, - /You must not use `no-launch` option with the `load-balance` option./ + /You must not use `no-launch` option with the `load-balance` option./, ); }); @@ -367,7 +367,7 @@ describe('TestOptionsValidator', function () { replayExecution: 'test-execution-0000000.json', replayBrowser: [1, 0], }, - /You must specify replay-browser values greater than or equal to 1./ + /You must specify replay-browser values greater than or equal to 1./, ); }); @@ -378,7 +378,7 @@ describe('TestOptionsValidator', function () { replayExecution: 'test-execution-0000000.json', replayBrowser: [1, 2, 1], }, - /You cannot specify the same replayBrowser value twice. 1 is repeated./ + /You cannot specify the same replayBrowser value twice. 1 is repeated./, ); }); @@ -389,7 +389,7 @@ describe('TestOptionsValidator', function () { replayExecution: 'test-execution-0000000.json', replayBrowser: [3, 1], }, - /You must specify replayBrowser value smaller than a number of browsers in the specified json file./ + /You must specify replayBrowser value smaller than a number of browsers in the specified json file./, ); }); @@ -400,7 +400,7 @@ describe('TestOptionsValidator', function () { replayExecution: 'test-execution-0000000.json', launch: 'false', }, - /You must not use `no-launch` option with the `replay-execution` option./ + /You must not use `no-launch` option with the `replay-execution` option./, ); }); @@ -411,7 +411,7 @@ describe('TestOptionsValidator', function () { replayExecution: 'test-execution-0000000.json', replayBrowser: [1, 2], }, - true + true, ); }); }); diff --git a/tests/dummy/config/ember-try.js b/tests/dummy/config/ember-try.js index 92d1d3da..e833bfca 100644 --- a/tests/dummy/config/ember-try.js +++ b/tests/dummy/config/ember-try.js @@ -112,13 +112,13 @@ module.exports = async function () { embroiderSafe( mochaScenario({ name: 'embroider-safe-with-mocha', - }) + }), ), embroiderOptimized(), embroiderOptimized( mochaScenario({ name: 'embroider-optimized-with-mocha', - }) + }), ), { name: 'ember-qunit-4', diff --git a/tests/test-helper.js b/tests/test-helper.js index 9667ac6b..b698e2df 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -6,7 +6,7 @@ import start from 'ember-exam/test-support/start'; import { macroCondition, dependencySatisfies } from '@embroider/macros'; const oppositeFramework = macroCondition( - dependencySatisfies('ember-qunit', '*') + dependencySatisfies('ember-qunit', '*'), ) ? 'mocha' : 'qunit'; diff --git a/tests/unit/mocha/filter-test-modules-test.js b/tests/unit/mocha/filter-test-modules-test.js index b8b2fd9c..e5c44398 100644 --- a/tests/unit/mocha/filter-test-modules-test.js +++ b/tests/unit/mocha/filter-test-modules-test.js @@ -16,19 +16,19 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { describe('convertFilePathToModulePath', () => { it('should return an input string without file extension when the input contains file extension', () => { expect( - convertFilePathToModulePath('/tests/integration/foo.js') + convertFilePathToModulePath('/tests/integration/foo.js'), ).to.equal('/tests/integration/foo'); }); it(`should return an input string without file extension when the input doesn't contain file extension`, () => { expect(convertFilePathToModulePath('/tests/integration/foo')).to.equal( - '/tests/integration/foo' + '/tests/integration/foo', ); }); it('should return an input string after `tests` when the input is a full test file path', () => { expect( - convertFilePathToModulePath('dummy/tests/integration/foo.js') + convertFilePathToModulePath('dummy/tests/integration/foo.js'), ).to.equal('/tests/integration/foo'); }); }); @@ -37,10 +37,7 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { let modules = []; beforeEach(() => { - modules = [ - 'foo-test', - 'bar-test', - ]; + modules = ['foo-test', 'bar-test']; }); afterEach(() => { @@ -62,7 +59,9 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { }); it('should return a list of tests matched with a regular expression that excluses foo', () => { - expect(filterTestModules(modules, '!/foo/')).to.deep.equal(['bar-test']); + expect(filterTestModules(modules, '!/foo/')).to.deep.equal([ + 'bar-test', + ]); }); it('should return a list of tests matches with a list of string options', () => { @@ -73,7 +72,9 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { }); it('should return a list of unique tests matches when options are repeated', () => { - expect(filterTestModules(modules, 'foo, foo')).to.deep.equal(['foo-test']); + expect(filterTestModules(modules, 'foo, foo')).to.deep.equal([ + 'foo-test', + ]); }); }); @@ -94,13 +95,13 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { it('should return a test module matches with full test file path', () => { expect( - filterTestModules(modules, null, 'app/tests/integration/foo-test.js') + filterTestModules(modules, null, 'app/tests/integration/foo-test.js'), ).to.deep.equal(['dummy/tests/integration/foo-test']); }); it('should return a test module matches with relative test file path', () => { expect( - filterTestModules(modules, null, '/tests/unit/foo-test') + filterTestModules(modules, null, '/tests/unit/foo-test'), ).to.deep.equal(['dummy/tests/unit/foo-test']); }); @@ -113,7 +114,7 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { it('should return a test module matched with test file path with wildcard', () => { expect(filterTestModules(modules, null, '/tests/*/foo*')).to.deep.equal( - ['dummy/tests/integration/foo-test', 'dummy/tests/unit/foo-test'] + ['dummy/tests/integration/foo-test', 'dummy/tests/unit/foo-test'], ); }); @@ -128,8 +129,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { filterTestModules( modules, null, - '/tests/integration/*, dummy/tests/unit/foo-test' - ) + '/tests/integration/*, dummy/tests/unit/foo-test', + ), ).to.deep.equal([ 'dummy/tests/integration/foo-test', 'dummy/tests/unit/foo-test', @@ -141,8 +142,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { filterTestModules( modules, null, - 'app/tests/unit/bar-test.js, /tests/unit/*' - ) + 'app/tests/unit/bar-test.js, /tests/unit/*', + ), ).to.deep.equal([ 'dummy/tests/unit/bar-test', 'dummy/tests/unit/foo-test', diff --git a/tests/unit/mocha/test-loader-test.js b/tests/unit/mocha/test-loader-test.js index 05498fa4..a46788cf 100644 --- a/tests/unit/mocha/test-loader-test.js +++ b/tests/unit/mocha/test-loader-test.js @@ -45,19 +45,17 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { it('loads modules from a specified partition', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('partition', 3).set('split', 4) + new Map().set('partition', 3).set('split', 4), ); testLoader.loadModules(); - expect(this.requiredModules).to.deep.equal([ - 'test-3-test', - ]); + expect(this.requiredModules).to.deep.equal(['test-3-test']); }); it('loads modules from multiple specified partitions', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('partition', [1, 3]).set('split', 4) + new Map().set('partition', [1, 3]).set('split', 4), ); testLoader.loadModules(); @@ -70,31 +68,27 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { it('loads modules from the first partition by default', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('split', 4) + new Map().set('split', 4), ); testLoader.loadModules(); - expect(this.requiredModules).to.deep.equal([ - 'test-1-test', - ]); + expect(this.requiredModules).to.deep.equal(['test-1-test']); }); it('handles params as strings', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('partition', '3').set('split', '4') + new Map().set('partition', '3').set('split', '4'), ); testLoader.loadModules(); - expect(this.requiredModules).to.deep.equal([ - 'test-3-test', - ]); + expect(this.requiredModules).to.deep.equal(['test-3-test']); }); it('throws an error if splitting less than one', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('split', 0) + new Map().set('split', 0), ); expect(() => { @@ -105,59 +99,59 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { it("throws an error if partition isn't a number", function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('split', 2).set('partition', 'foo') + new Map().set('split', 2).set('partition', 'foo'), ); expect(() => { testLoader.loadModules(); }).to.throw( - /You must specify numbers for partition \(you specified 'foo'\)/ + /You must specify numbers for partition \(you specified 'foo'\)/, ); }); it("throws an error if partition isn't a number with multiple partitions", function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('split', 2).set('partition', [1, 'foo']) + new Map().set('split', 2).set('partition', [1, 'foo']), ); expect(() => { testLoader.loadModules(); }).to.throw( - /You must specify numbers for partition \(you specified '1,foo'\)/ + /You must specify numbers for partition \(you specified '1,foo'\)/, ); }); it('throws an error if loading partition greater than split number', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('split', 2).set('partition', 3) + new Map().set('split', 2).set('partition', 3), ); expect(() => { testLoader.loadModules(); }).to.throw( - /You must specify partitions numbered less than or equal to your split value/ + /You must specify partitions numbered less than or equal to your split value/, ); }); it('throws an error if loading partition greater than split number with multiple partitions', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('split', 2).set('partition', [2, 3]) + new Map().set('split', 2).set('partition', [2, 3]), ); expect(() => { testLoader.loadModules(); }).to.throw( - /You must specify partitions numbered less than or equal to your split value/ + /You must specify partitions numbered less than or equal to your split value/, ); }); it('throws an error if loading partition less than one', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('split', 2).set('partition', 0) + new Map().set('split', 2).set('partition', 0), ); expect(() => { @@ -168,7 +162,7 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { it('load works with a double-digit single partition', function () { const testLoader = new EmberExamTestLoader( this.testem, - new Map().set('partition', '10').set('split', 10) + new Map().set('partition', '10').set('split', 10), ); window.requirejs.entries = { diff --git a/tests/unit/mocha/testem-output-test.js b/tests/unit/mocha/testem-output-test.js index cd182393..dd33c391 100644 --- a/tests/unit/mocha/testem-output-test.js +++ b/tests/unit/mocha/testem-output-test.js @@ -15,8 +15,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { expect( TestemOutput.updateTestName( new Map().set('split', 2).set('preserveTestName', true), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('test_module | test_name'); }); @@ -27,8 +27,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { .set('split', 2) .set('partition', 2) .set('preserveTestName', true), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('test_module | test_name'); }); @@ -39,8 +39,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { .set('loadBalance', 2) .set('browser', 1) .set('preserveTestName', true), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('test_module | test_name'); }); @@ -53,8 +53,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { .set('browser', 1) .set('loadBalance', 2) .set('preserveTestName', true), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('test_module | test_name'); }); }); @@ -63,8 +63,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { expect( TestemOutput.updateTestName( new Map().set('split', 2), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('Exam Partition 1 - test_module | test_name'); }); @@ -72,8 +72,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { expect( TestemOutput.updateTestName( new Map().set('split', 2).set('partition', 2), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('Exam Partition 2 - test_module | test_name'); }); @@ -81,8 +81,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { expect( TestemOutput.updateTestName( new Map().set('loadBalance', 2).set('browser', 1), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('Browser Id 1 - test_module | test_name'); }); @@ -94,8 +94,8 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) { .set('partition', 2) .set('browser', 1) .set('loadBalance', 2), - 'test_module | test_name' - ) + 'test_module | test_name', + ), ).to.equal('Exam Partition 2 - Browser Id 1 - test_module | test_name'); }); }); diff --git a/tests/unit/qunit/async-iterator-test.js b/tests/unit/qunit/async-iterator-test.js index 30e0be0b..663ebc9f 100644 --- a/tests/unit/qunit/async-iterator-test.js +++ b/tests/unit/qunit/async-iterator-test.js @@ -182,9 +182,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { (err) => { assert.deepEqual( err.message, - 'EmberExam: Promise timed out after 2 s while waiting for response for next-module-request' + 'EmberExam: Promise timed out after 2 s while waiting for response for next-module-request', ); - } + }, ); }); @@ -196,7 +196,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { assert.throws( () => iteratorOfPromises.handleResponse({}), - /Was not expecting a response, but got a response/ + /Was not expecting a response, but got a response/, ); }); } diff --git a/tests/unit/qunit/filter-test-modules-test.js b/tests/unit/qunit/filter-test-modules-test.js index a3ea5fb9..ba957cf7 100644 --- a/tests/unit/qunit/filter-test-modules-test.js +++ b/tests/unit/qunit/filter-test-modules-test.js @@ -19,31 +19,28 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { test('should return an input string without file extension when the input contains file extension', function (assert) { assert.strictEqual( convertFilePathToModulePath('/tests/integration/foo.js'), - '/tests/integration/foo' + '/tests/integration/foo', ); }); test(`should return an input string without file extension when the input doesn't contain file extension`, function (assert) { assert.strictEqual( convertFilePathToModulePath('/tests/integration/foo'), - '/tests/integration/foo' + '/tests/integration/foo', ); }); test('should return an input string after `tests` when the input is a full test file path', function (assert) { assert.strictEqual( convertFilePathToModulePath('dummy/tests/integration/foo.js'), - '/tests/integration/foo' + '/tests/integration/foo', ); }); }), module('modulePath | Qunit', function (hooks) { setupTest(hooks); hooks.beforeEach(function () { - this.modules = [ - 'foo-test', - 'bar-test', - ]; + this.modules = ['foo-test', 'bar-test']; }); hooks.afterEach(function () { @@ -53,42 +50,42 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { test('should return a list of filtered tests', function (assert) { assert.deepEqual( ['foo-test'], - filterTestModules(this.modules, 'foo') + filterTestModules(this.modules, 'foo'), ); }); test('should return an empty list when there is no match', function (assert) { assert.throws( () => filterTestModules(this.modules, 'no-match'), - /No tests matched with the filter:/ + /No tests matched with the filter:/, ); }); test('should return a list of tests matched with a regular expression', function (assert) { assert.deepEqual( ['foo-test'], - filterTestModules(this.modules, '/foo/') + filterTestModules(this.modules, '/foo/'), ); }); test('should return a list of tests matched with a regular expression that excluse foo', function (assert) { assert.deepEqual( ['bar-test'], - filterTestModules(this.modules, '!/foo/') + filterTestModules(this.modules, '!/foo/'), ); }); test('should return a list of tests matches with a list of string options', function (assert) { assert.deepEqual( ['foo-test', 'bar-test'], - filterTestModules(this.modules, 'foo, bar') + filterTestModules(this.modules, 'foo, bar'), ); }); test('should return a list of unique tests matches when options are repeated', function (assert) { assert.deepEqual( ['foo-test'], - filterTestModules(this.modules, 'foo, foo') + filterTestModules(this.modules, 'foo, foo'), ); }); }), @@ -112,36 +109,36 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { filterTestModules( this.modules, null, - 'app/tests/integration/foo-test.js' - ) + 'app/tests/integration/foo-test.js', + ), ); }); test('should return a test module matched with relative test file path', function (assert) { assert.deepEqual( ['dummy/tests/unit/foo-test'], - filterTestModules(this.modules, null, '/unit/foo-test') + filterTestModules(this.modules, null, '/unit/foo-test'), ); }); test('should return a test module matched with test folder path with wildcard', function (assert) { assert.deepEqual( ['dummy/tests/unit/foo-test', 'dummy/tests/unit/bar-test'], - filterTestModules(this.modules, null, '/unit/*') + filterTestModules(this.modules, null, '/unit/*'), ); }); test('should return a test module matched with test file path with wildcard', function (assert) { assert.deepEqual( ['dummy/tests/integration/foo-test', 'dummy/tests/unit/foo-test'], - filterTestModules(this.modules, null, '/tests/*/foo*') + filterTestModules(this.modules, null, '/tests/*/foo*'), ); }); test('should return an empty list when there is no match', function (assert) { assert.throws( () => filterTestModules(this.modules, null, 'no-match'), - /No tests matched with the filter:/ + /No tests matched with the filter:/, ); }); @@ -151,8 +148,8 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { filterTestModules( this.modules, null, - '/tests/integration/*, dummy/tests/unit/foo-test' - ) + '/tests/integration/*, dummy/tests/unit/foo-test', + ), ); }); @@ -162,8 +159,8 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { filterTestModules( this.modules, null, - 'app/tests/unit/bar-test.js, /tests/unit/*' - ) + 'app/tests/unit/bar-test.js, /tests/unit/*', + ), ); }); }); diff --git a/tests/unit/qunit/test-loader-test.js b/tests/unit/qunit/test-loader-test.js index 0da38dc4..9d970cf3 100644 --- a/tests/unit/qunit/test-loader-test.js +++ b/tests/unit/qunit/test-loader-test.js @@ -50,7 +50,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map(), - this.qunit + this.qunit, ); testLoader.loadModules(); @@ -67,7 +67,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( undefinedTestem, new Map(), - this.qunit + this.qunit, ); testLoader.loadModules(); @@ -83,60 +83,51 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('partition', 3).set('split', 4), - this.qunit + this.qunit, ); testLoader.loadModules(); - assert.deepEqual(this.requiredModules, [ - 'test-3-test', - ]); + assert.deepEqual(this.requiredModules, ['test-3-test']); }); test('loads modules from multiple specified partitions', function (assert) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('partition', [1, 3]).set('split', 4), - this.qunit + this.qunit, ); testLoader.loadModules(); - assert.deepEqual(this.requiredModules, [ - 'test-1-test', - 'test-3-test', - ]); + assert.deepEqual(this.requiredModules, ['test-1-test', 'test-3-test']); }); test('loads modules from the first partition by default', function (assert) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('split', 4), - this.qunit + this.qunit, ); testLoader.loadModules(); - assert.deepEqual(this.requiredModules, [ - 'test-1-test', - ]); + assert.deepEqual(this.requiredModules, ['test-1-test']); }); test('handles params as strings', function (assert) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('partition', 3).set('split', 4), - this.qunit + this.qunit, ); testLoader.loadModules(); - assert.deepEqual(this.requiredModules, [ - 'test-3-test', - ]); + assert.deepEqual(this.requiredModules, ['test-3-test']); }); test('throws an error if splitting less than one', function (assert) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('split', 0), - this.qunit + this.qunit, ); assert.throws(() => { @@ -148,7 +139,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('split', 2).set('partition', 'foo'), - this.qunit + this.qunit, ); assert.throws(() => { @@ -160,7 +151,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('split', 2).set('partition', [1, 'foo']), - this.qunit + this.qunit, ); assert.throws(() => { @@ -172,7 +163,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('split', 2).set('partition', 3), - this.qunit + this.qunit, ); assert.throws(() => { @@ -184,7 +175,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('split', 2).set('partition', [2, 3]), - this.qunit + this.qunit, ); assert.throws(() => { @@ -196,7 +187,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('split', 2).set('partition', 0), - this.qunit + this.qunit, ); assert.throws(() => { @@ -221,7 +212,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('partition', '10').set('split', 10), - this.qunit + this.qunit, ); testLoader.loadModules(); @@ -233,7 +224,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { const testLoader = new EmberExamTestLoader( this.testem, new Map().set('loadBalance', true), - this.qunit + this.qunit, ); testLoader.loadModules(); @@ -241,7 +232,7 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { assert.deepEqual( this.testem.eventQueue, ['testem:set-modules-queue'], - 'testem:set-modules-queue event was fired' + 'testem:set-modules-queue event was fired', ); }); } diff --git a/tests/unit/qunit/testem-output-test.js b/tests/unit/qunit/testem-output-test.js index 9401bf85..72c9adf0 100644 --- a/tests/unit/qunit/testem-output-test.js +++ b/tests/unit/qunit/testem-output-test.js @@ -14,9 +14,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { assert.deepEqual( TestemOutput.updateTestName( new Map().set('split', 2).set('preserveTestName', true), - 'test_module | test_name' + 'test_module | test_name', ), - 'test_module | test_name' + 'test_module | test_name', ); }); @@ -27,9 +27,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { .set('split', 2) .set('partition', 2) .set('preserveTestName', true), - 'test_module | test_name' + 'test_module | test_name', ), - 'test_module | test_name' + 'test_module | test_name', ); }); @@ -40,9 +40,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { .set('loadBalance', 2) .set('browser', 1) .set('preserveTestName', true), - 'test_module | test_name' + 'test_module | test_name', ), - 'test_module | test_name' + 'test_module | test_name', ); }); @@ -55,9 +55,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { .set('browser', 1) .set('loadBalance', 2) .set('preserveTestName', true), - 'test_module | test_name' + 'test_module | test_name', ), - 'test_module | test_name' + 'test_module | test_name', ); }); }); @@ -66,9 +66,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { assert.deepEqual( TestemOutput.updateTestName( new Map().set('split', 2), - 'test_module | test_name' + 'test_module | test_name', ), - 'Exam Partition 1 - test_module | test_name' + 'Exam Partition 1 - test_module | test_name', ); }); @@ -76,9 +76,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { assert.deepEqual( TestemOutput.updateTestName( new Map().set('split', 2).set('partition', 2), - 'test_module | test_name' + 'test_module | test_name', ), - 'Exam Partition 2 - test_module | test_name' + 'Exam Partition 2 - test_module | test_name', ); }); @@ -86,9 +86,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { assert.deepEqual( TestemOutput.updateTestName( new Map().set('loadBalance', 2).set('browser', 1), - 'test_module | test_name' + 'test_module | test_name', ), - 'Browser Id 1 - test_module | test_name' + 'Browser Id 1 - test_module | test_name', ); }); @@ -100,9 +100,9 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) { .set('partition', 2) .set('browser', 1) .set('loadBalance', 2), - 'test_module | test_name' + 'test_module | test_name', ), - 'Exam Partition 2 - Browser Id 1 - test_module | test_name' + 'Exam Partition 2 - Browser Id 1 - test_module | test_name', ); }); });