[test] remove x-pack mocha configuration (#42979)

* update scripts

* run mocha from root

* rm mocha grunt task

* rm x-pack mocha setup

* rm x-pack/mocha*

* Revert "rm x-pack/mocha*"

This reverts commit fb56005e77.
This commit is contained in:
Jonathan Budzenski 2019-08-15 12:21:42 -05:00 committed by GitHub
parent 6c83702536
commit e6e92ac2bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 6 additions and 51 deletions

View file

@ -44,11 +44,10 @@
"test:quick": "grunt test:quick",
"test:browser": "grunt test:browser",
"test:jest": "node scripts/jest",
"test:mocha": "grunt test:mocha",
"test:mocha": "node scripts/mocha",
"test:ui": "node scripts/functional_tests",
"test:ui:server": "node scripts/functional_tests_server",
"test:ui:runner": "node scripts/functional_test_runner",
"test:server": "echo 'use yarn test:mocha instead'; exit 1",
"test:coverage": "grunt test:coverage",
"typespec": "typings-tester --config x-pack/legacy/plugins/canvas/public/lib/aeroelastic/tsconfig.json x-pack/legacy/plugins/canvas/public/lib/aeroelastic/__fixtures__/typescript/typespec_tests.ts",
"checkLicenses": "node scripts/check_licenses --dev",
@ -61,7 +60,6 @@
"lint:es": "node scripts/eslint",
"lint:sass": "node scripts/sasslint",
"makelogs": "node scripts/makelogs",
"mocha": "node scripts/mocha",
"uiFramework:start": "cd packages/kbn-ui-framework && yarn docSiteStart",
"uiFramework:build": "cd packages/kbn-ui-framework && yarn docSiteBuild",
"uiFramework:createComponent": "cd packages/kbn-ui-framework && yarn createComponent",

View file

@ -49,7 +49,7 @@ Currently there are two patterns used to test packages, one using Mocha and one
### 1. Mocha
Today a package can follow the pattern of having a `__tests__` directory in each source code directory of a package which contains the tests for that module. These are usually run by Mocha.
If a package's tests should be run with Mocha, you'll have to opt-in to run them by appending the package's test file pattern(s) to Kibana's `tasks/config/simplemocha.js` file. These will then be run by the unit test runner.
If a package's tests should be run with Mocha, you'll have to opt-in to run them by appending the package's test file pattern(s) to Kibana's `src/dev/mocha/run_mocha_cli.js` file. These will then be run by the unit test runner.
* `yarn test` or `yarn grunt test` runs all unit tests.
* `node scripts/mocha` runs all Mocha tests.

View file

@ -148,7 +148,7 @@ module.exports = function (grunt) {
]
}),
// used by the test:mocha task
// used by the test:quick task
// runs all node.js/server mocha tests
mocha: scriptWithGithubChecks({
title: 'Mocha tests',

View file

@ -31,8 +31,6 @@ module.exports = function (grunt) {
}
);
grunt.registerTask('test:mocha', ['checkPlugins', 'run:mocha']);
grunt.registerTask('test:browser', ['checkPlugins', 'run:browserSCSS', 'run:browserTestServer', 'karma:unit']);
grunt.registerTask('test:browser-ci', () => {
@ -49,7 +47,7 @@ module.exports = function (grunt) {
grunt.registerTask('test:quick', [
'checkPlugins',
'test:mocha',
'run:mocha',
'run:functionalTests',
'test:jest',
'test:jest_integration',

View file

@ -1,7 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { runMocha } from './run_mocha';

View file

@ -1,25 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export function runMocha() {
const debugInBand = process.execArgv.some(arg => {
switch (arg) {
case '--debug':
case '--debug-brk':
case '-d':
case '--inspect':
case '--inspect-brk':
return true;
}
});
if (debugInBand) {
process.argv.push('--no-timeouts');
require('mocha/bin/_mocha');
} else {
require('mocha/bin/mocha');
}
}

View file

@ -1,8 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
// referenced by test/mocha.opts which is read by the CLI
require('@kbn/plugin-helpers').babelRegister();

View file

@ -14,7 +14,7 @@
"test:browser:dev": "gulp testbrowser-dev",
"test:browser": "gulp testbrowser",
"test:jest": "node scripts/jest",
"test:mocha": "grunt test:mocha",
"test:mocha": "node scripts/mocha",
"test:server": "gulp testserver"
},
"kibana": {

View file

@ -4,5 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
require('@kbn/plugin-helpers').babelRegister();
require('../dev-tools/mocha').runMocha();
require('../scripts/mocha');