Skip to content

Commit

Permalink
Autofix linter errors
Browse files Browse the repository at this point in the history
`yarn lint:js --fix`
  • Loading branch information
andreyfel committed Dec 28, 2023
1 parent 35cd64c commit 88c0a27
Show file tree
Hide file tree
Showing 33 changed files with 370 additions and 387 deletions.
4 changes: 2 additions & 2 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
module.exports = {
extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'],
rules: {
"selector-class-pattern": null,
}
'selector-class-pattern': null,
},
};
8 changes: 4 additions & 4 deletions addon-test-support/-private/async-iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -82,7 +82,7 @@ export default class AsyncIterator {
this._done = true;
this._testem.removeEventCallbacks(
this._response,
this._boundHandleResponse
this._boundHandleResponse,
);
}

Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class EmberExamMochaTestLoader extends TestLoader {
this._testModules = filterTestModules(
this._testModules,
modulePath,
filePath
filePath,
);
}

Expand Down
10 changes: 5 additions & 5 deletions addon-test-support/-private/ember-exam-qunit-test-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class EmberExamQUnitTestLoader extends TestLoader {
this._testModules = filterTestModules(
this._testModules,
modulePath,
filePath
filePath,
);
}

Expand All @@ -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);
Expand All @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions addon-test-support/-private/filter-test-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}

Expand All @@ -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)),
);
}

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions addon-test-support/-private/get-test-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
);
}
4 changes: 2 additions & 2 deletions addon-test-support/-private/split-test-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion addon-test-support/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()`.',
);
}

Expand Down
42 changes: 21 additions & 21 deletions lib/commands/exam.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module.exports = TestCommand.extend({
const validator = new Validator(
commandOptions,
this._getTestFramework(),
this.emberCliVersion
this.emberCliVersion,
);
return validator.validateCommands();
},
Expand Down Expand Up @@ -163,21 +163,21 @@ module.exports = TestCommand.extend({
commandOptions.query = addToQuery(
commandOptions.query,
'split',
commandOptions.split
commandOptions.split,
);

process.env.EMBER_EXAM_SPLIT_COUNT = commandOptions.split;

// 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],
);
}
}
Expand All @@ -187,44 +187,44 @@ module.exports = TestCommand.extend({
commandOptions.query = addToQuery(
commandOptions.query,
'modulePath',
commandOptions.modulePath
commandOptions.modulePath,
);
}

if (commandOptions.preserveTestName) {
commandOptions.query = addToQuery(
commandOptions.query,
'preserveTestName',
commandOptions.preserveTestName
commandOptions.preserveTestName,
);
}

if (commandOptions.filePath) {
commandOptions.query = addToQuery(
commandOptions.query,
'filePath',
commandOptions.filePath
commandOptions.filePath,
);
}

if (commandOptions.loadBalance) {
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,
);
}

Expand Down Expand Up @@ -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 (
Expand All @@ -288,7 +288,7 @@ module.exports = TestCommand.extend({
if (commandOptions.replayExecution) {
this.testemEvents.setReplayExecutionMap(
commandOptions.replayExecution,
commandOptions.replayBrowser
commandOptions.replayBrowser,
);
}

Expand All @@ -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
Expand All @@ -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.');
Expand All @@ -343,7 +343,7 @@ module.exports = TestCommand.extend({
launcherId,
ui,
commands,
Date.now()
Date.now(),
);
};

Expand All @@ -370,7 +370,7 @@ module.exports = TestCommand.extend({

return this._getModuleMetadataAndBrowserExitSocketEvents(
browserExitHandler,
browserTerminationHandler
browserTerminationHandler,
);
},

Expand All @@ -382,7 +382,7 @@ module.exports = TestCommand.extend({
*/
_getModuleMetadataAndBrowserExitSocketEvents(
browserExitHandler,
browserTerminationHandler
browserTerminationHandler,
) {
const events = {};
const testemEvents = this.testemEvents;
Expand Down Expand Up @@ -442,7 +442,7 @@ module.exports = TestCommand.extend({
*/
_getLoadBalancingBrowserSocketEvents(
{ isLoadBalance, isReplayExecution, isWriteExecutionFile },
testemEvents
testemEvents,
) {
const events = {};
const ui = this.ui;
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/exam/iterate.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module.exports = {
execa.sync(
'./node_modules/.bin/ember',
['build', '--output-path', `${this._outputDir}`],
['stdio', 'inherit']
['stdio', 'inherit'],
);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/config-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function _readFileByType(file) {
*/
module.exports = function readTestemConfig(
file,
potentialFiles = potentialConfigFiles
potentialFiles = potentialConfigFiles,
) {
if (file) {
potentialFiles.unshift(file);
Expand Down
Loading

0 comments on commit 88c0a27

Please sign in to comment.