Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Remove karma (#73126) #73328

Merged
merged 6 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/developer/contributing/development-tests.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ root)
|Functional
|`test/*integration/**/config.js` `test/*functional/**/config.js` `test/accessibility/config.js`
|`yarn test:ftr:server --config test/[directory]/config.js``yarn test:ftr:runner --config test/[directory]/config.js --grep=regexp`

|Karma |`src/**/public/__tests__/*.js` |`yarn test:karma:debug`
|===

For X-Pack tests located in `x-pack/` see
Expand Down
33 changes: 0 additions & 33 deletions docs/developer/contributing/development-unit-tests.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,38 +95,6 @@ to proceed in this mode.
node scripts/mocha --debug <file>
----

With `yarn test:karma`, you can run only the browser tests. Coverage
reports are available for browser tests by running
`yarn test:coverage`. You can find the results under the `coverage/`
directory that will be created upon completion.

[source,bash]
----
yarn test:karma
----

Using `yarn test:karma:debug` initializes an environment for debugging
the browser tests. Includes an dedicated instance of the {kib} server
for building the test bundle, and a karma server. When running this task
the build is optimized for the first time and then a karma-owned
instance of the browser is opened. Click the "`debug`" button to open a
new tab that executes the unit tests.

[source,bash]
----
yarn test:karma:debug
----

In the screenshot below, you’ll notice the URL is
`localhost:9876/debug.html`. You can append a `grep` query parameter
to this URL and set it to a string value which will be used to exclude
tests which don’t match. For example, if you changed the URL to
`localhost:9876/debug.html?query=my test` and then refreshed the
browser, you’d only see tests run which contain "`my test`" in the test
description.

image:http://i.imgur.com/DwHxgfq.png[Browser test debugging]

[discrete]
=== Unit Testing Plugins

Expand All @@ -141,5 +109,4 @@ command from your plugin:
[source,bash]
----
yarn test:mocha
yarn test:karma:debug # remove the debug flag to run them once and close
----
11 changes: 0 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
"kbn": "node scripts/kbn",
"es": "node scripts/es",
"test": "grunt test",
"test:karma": "grunt test:karma",
"test:karma:debug": "grunt test:karmaDebug",
"test:jest": "node scripts/jest",
"test:jest_integration": "node scripts/jest_integration",
"test:mocha": "node scripts/mocha",
Expand Down Expand Up @@ -442,7 +440,6 @@
"grunt-available-tasks": "^0.6.3",
"grunt-cli": "^1.2.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-karma": "^3.0.2",
"grunt-peg": "^2.0.1",
"grunt-run": "0.8.1",
"gulp-babel": "^8.0.0",
Expand All @@ -460,14 +457,6 @@
"jest-raw-loader": "^1.0.1",
"jimp": "^0.9.6",
"json5": "^1.0.1",
"karma": "5.0.2",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.2",
"karma-firefox-launcher": "1.1.0",
"karma-ie-launcher": "1.0.0",
"karma-junit-reporter": "1.2.0",
"karma-mocha": "2.0.0",
"karma-safari-launcher": "1.0.0",
"license-checker": "^16.0.0",
"listr": "^0.14.1",
"load-grunt-config": "^3.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ exports.getWebpackConfig = function (kibanaPath, projectRoot, config) {
const alias = {
// Kibana defaults https://github.com/elastic/kibana/blob/6998f074542e8c7b32955db159d15661aca253d7/src/legacy/ui/ui_bundler_env.js#L30-L36
ui: fromKibana('src/legacy/ui/public'),
test_harness: fromKibana('src/test_harness/public'),

// Dev defaults for test bundle https://github.com/elastic/kibana/blob/6998f074542e8c7b32955db159d15661aca253d7/src/core_plugins/tests_bundle/index.js#L73-L78
ng_mock$: fromKibana('src/test_utils/public/ng_mock'),
'angular-mocks$': fromKibana(
'src/legacy/core_plugins/tests_bundle/webpackShims/angular-mocks.js'
),
fixtures: fromKibana('src/fixtures'),
test_utils: fromKibana('src/test_utils/public'),
};
Expand Down
4 changes: 0 additions & 4 deletions packages/kbn-plugin-generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ Generated plugins receive a handful of scripts that can be used during developme

Build a distributable archive of your plugin.

- `yarn test:karma`

Run the browser tests in a real web browser.

- `yarn test:mocha`

Run the server tests using mocha.
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-plugin-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ $ plugin-helpers help
start Start kibana and have it include this plugin
build [options] [files...] Build a distributable archive
test Run the server and browser tests
test:karma [options] Run the browser tests in a real web browser
test:mocha [files...] Run the server tests using mocha

Options:
Expand Down
19 changes: 0 additions & 19 deletions packages/kbn-plugin-helpers/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,6 @@ program
}))
);

program
.command('test')
.description('Run the server and browser tests')
.on('--help', docs('test/all'))
.action(createCommanderAction('testAll'));

program
.command('test:karma')
.description('Run the browser tests in a real web browser')
.option('--dev', 'Enable dev mode, keeps the test server running')
.option('-p, --plugins <plugin-ids>', "Manually specify which plugins' test bundles to run")
.on('--help', docs('test/karma'))
.action(
createCommanderAction('testKarma', (command) => ({
dev: Boolean(command.dev),
plugins: command.plugins,
}))
);

program
.command('test:mocha [files...]')
.description('Run the server tests using mocha')
Expand Down
6 changes: 0 additions & 6 deletions packages/kbn-plugin-helpers/src/lib/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@

import { buildTask } from '../tasks/build';
import { startTask } from '../tasks/start';
import { testAllTask } from '../tasks/test/all';
import { testKarmaTask } from '../tasks/test/karma';
import { testMochaTask } from '../tasks/test/mocha';

// define a tasks interface that we can extend in the tests
export interface Tasks {
build: typeof buildTask;
start: typeof startTask;
testAll: typeof testAllTask;
testKarma: typeof testKarmaTask;
testMocha: typeof testMochaTask;
}

export const tasks: Tasks = {
build: buildTask,
start: startTask,
testAll: testAllTask,
testKarma: testKarmaTask,
testMocha: testMochaTask,
};
3 changes: 0 additions & 3 deletions packages/kbn-plugin-helpers/src/tasks/test/all/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions packages/kbn-plugin-helpers/src/tasks/test/all/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions packages/kbn-plugin-helpers/src/tasks/test/all/test_all_task.ts

This file was deleted.

60 changes: 0 additions & 60 deletions packages/kbn-plugin-helpers/src/tasks/test/karma/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions packages/kbn-plugin-helpers/src/tasks/test/karma/index.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ const Fs = jest.requireActual('fs');

export const FTR_REPORT = Fs.readFileSync(require.resolve('./ftr_report.xml'), 'utf8');
export const JEST_REPORT = Fs.readFileSync(require.resolve('./jest_report.xml'), 'utf8');
export const KARMA_REPORT = Fs.readFileSync(require.resolve('./karma_report.xml'), 'utf8');
export const MOCHA_REPORT = Fs.readFileSync(require.resolve('./mocha_report.xml'), 'utf8');
export const CYPRESS_REPORT = Fs.readFileSync(require.resolve('./cypress_report.xml'), 'utf8');

This file was deleted.

Loading