Skip to content

Commit

Permalink
[CHORE tests] replace mocha-only-detector with `mocha/no-exclusive-…
Browse files Browse the repository at this point in the history
…tests` rule (emberjs#6125)

fixes emberjs#6109
  • Loading branch information
makepanic authored and pliljegr committed Jul 23, 2019
1 parent 144cf29 commit 8d26f81
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 55 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module',
},
plugins: ['prettier', 'qunit'],
plugins: ['prettier', 'qunit', 'mocha'],
extends: ['eslint:recommended', 'prettier'],
rules: {
'mocha/no-exclusive-tests': 'error',
'prettier/prettier': 'error',

'no-unused-vars': [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"ember-try": "^1.2.1",
"eslint": "^5.15.1",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-mocha": "^5.3.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-qunit": "^4.0.0",
Expand All @@ -90,7 +91,6 @@
"lerna": "^3.14.1",
"loader.js": "^4.7.0",
"mocha": "^6.1.2",
"mocha-only-detector": "1.0.1",
"pre-commit": "^1.2.2",
"prettier": "^1.17.1",
"rimraf": "^2.6.2",
Expand Down
11 changes: 5 additions & 6 deletions packages/-build-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,22 @@
"babel6-plugin-strip-class-callcheck": "^6.0.0",
"broccoli-file-creator": "^2.1.1",
"calculate-cache-key-for-tree": "^2.0.0",
"ember-cli-blueprint-test-helpers": "^0.19.1",
"ember-cli-path-utils": "^1.0.0",
"ember-cli-string-utils": "^1.1.0",
"ember-cli-version-checker": "^3.1.2",
"git-repo-info": "^2.0.0",
"npm-git-info": "^1.0.3",
"silent-error": "^1.1.1",
"glob": "^7.1.3",
"mocha": "^6.1.2",
"mocha-only-detector": "1.0.1",
"npm-git-info": "^1.0.3",
"rimraf": "^2.6.2",
"rsvp": "^4.8.4",
"ember-cli-version-checker": "^3.1.2",
"ember-cli-blueprint-test-helpers": "^0.19.1"
"silent-error": "^1.1.1"
},
"devDependencies": {
"broccoli-babel-transpiler": "*",
"broccoli-test-helper": "*",
"co": "*",
"broccoli-babel-transpiler": "*",
"common-tags": "*"
},
"engines": {
Expand Down
33 changes: 1 addition & 32 deletions packages/-build-infra/src/node-test-helpers/nodetest-runner.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
'use strict';
var glob = require('glob');
var Mocha = require('mocha');
var RSVP = require('rsvp');
var rimraf = require('rimraf');
var mochaOnlyDetector = require('mocha-only-detector');

var root = 'node-tests/{blueprints,acceptance,unit}';
var _checkOnlyInTests = RSVP.denodeify(
mochaOnlyDetector.checkFolder.bind(null, root + '/**/*{-test}.js')
);

function addFiles(mocha, files) {
files = typeof files === 'string' ? glob.sync(root + files) : files;
files.forEach(mocha.addFile.bind(mocha));
}

function checkOnlyInTests() {
// eslint-disable-next-line no-console
console.log('Verifing `.only` in tests');
return _checkOnlyInTests().then(function() {
// eslint-disable-next-line no-console
console.log('No `.only` found');
});
}

function runMocha(mocha) {
mocha.run(function(failures) {
process.on('exit', function() {
Expand All @@ -33,14 +19,6 @@ function runMocha(mocha) {
});
}

function ciVerificationStep() {
if (process.env.CI === 'true') {
return checkOnlyInTests();
} else {
return RSVP.Promise.resolve();
}
}

/* eslint-disable no-console, no-process-exit */
module.exports = function runNodeTests() {
if (/^win/.test(require('os').platform())) {
Expand Down Expand Up @@ -68,14 +46,5 @@ module.exports = function runNodeTests() {
addFiles(mocha, testFiles);
}

return ciVerificationStep()
.then(function() {
runMocha(mocha);
})
.catch(function(error) {
// eslint-disable-next-line no-console
console.error(error);
// eslint-disable-next-line no-process-exit
process.exit(1);
});
return runMocha(mocha);
};
28 changes: 13 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5348,6 +5348,13 @@ eslint-plugin-es@^1.3.1:
eslint-utils "^1.3.0"
regexpp "^2.0.1"

eslint-plugin-mocha@^5.3.0:
version "5.3.0"
resolved "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-5.3.0.tgz#cf3eb18ae0e44e433aef7159637095a7cb19b15b"
integrity sha512-3uwlJVLijjEmBeNyH60nzqgA1gacUWLUmcKV8PIGNvj1kwP/CTgAWQHn2ayyJVwziX+KETkr9opNwT1qD/RZ5A==
dependencies:
ramda "^0.26.1"

eslint-plugin-node@^8.0.0:
version "8.0.1"
resolved "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-8.0.1.tgz#55ae3560022863d141fa7a11799532340a685964"
Expand Down Expand Up @@ -5454,7 +5461,7 @@ espree@^5.0.1:
acorn-jsx "^5.0.0"
eslint-visitor-keys "^1.0.0"

esprima@^4.0.0, esprima@^4.0.1:
esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
Expand All @@ -5469,11 +5476,6 @@ esprima@~3.1.0:
resolved "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=

esprimaq@^0.0.1:
version "0.0.1"
resolved "https://registry.npmjs.org/esprimaq/-/esprimaq-0.0.1.tgz#3ea3a41f55ba0ab98fc3564c875818bd890aa2a3"
integrity sha1-PqOkH1W6CrmPw1ZMh1gYvYkKoqM=

esquery@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708"
Expand Down Expand Up @@ -8443,15 +8445,6 @@ mktemp@~0.4.0:
resolved "https://registry.npmjs.org/mktemp/-/mktemp-0.4.0.tgz#6d0515611c8a8c84e484aa2000129b98e981ff0b"
integrity sha1-bQUVYRyKjITkhKogABKbmOmB/ws=

[email protected]:
version "1.0.1"
resolved "https://registry.npmjs.org/mocha-only-detector/-/mocha-only-detector-1.0.1.tgz#a60392d253653fb3da77d783ed96aec8eaa7293e"
integrity sha512-lTnCIwmL5xKS4dWa+vlYfTOwioG1Vot5KUE5bD1jvwCHGmJUk71g9QHuy1B99r52Mih2cFQmLWlfeOyFXVqRxw==
dependencies:
esprima "^4.0.1"
esprimaq "^0.0.1"
glob "^7.1.2"

mocha@^6.1.2:
version "6.1.4"
resolved "https://registry.npmjs.org/mocha/-/mocha-6.1.4.tgz#e35fada242d5434a7e163d555c705f6875951640"
Expand Down Expand Up @@ -9584,6 +9577,11 @@ qunit@^2.9.2:
node-watch "0.6.0"
resolve "1.9.0"

ramda@^0.26.1:
version "0.26.1"
resolved "https://registry.npmjs.org/ramda/-/ramda-0.26.1.tgz#8d41351eb8111c55353617fc3bbffad8e4d35d06"
integrity sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==

range-parser@~1.2.0:
version "1.2.0"
resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
Expand Down

0 comments on commit 8d26f81

Please sign in to comment.