mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* chore(NA): merge and solve conflicts with 7.x branch * docs(NA): fix docs build with page headers.
This commit is contained in:
parent
7bbc916fa3
commit
4213441df7
162 changed files with 3725 additions and 4172 deletions
|
@ -15,4 +15,6 @@ include::core/development-modules.asciidoc[]
|
|||
|
||||
include::core/development-elasticsearch.asciidoc[]
|
||||
|
||||
include::core/development-unit-tests.asciidoc[]
|
||||
|
||||
include::core/development-functional-tests.asciidoc[]
|
||||
|
|
82
docs/development/core/development-unit-tests.asciidoc
Normal file
82
docs/development/core/development-unit-tests.asciidoc
Normal file
|
@ -0,0 +1,82 @@
|
|||
[[development-unit-tests]]
|
||||
=== Unit Testing
|
||||
|
||||
We use unit tests to make sure that individual software units of {kib} perform as they were designed to.
|
||||
|
||||
[float]
|
||||
=== Current Frameworks
|
||||
|
||||
{kib} is migrating unit testing from `Mocha` to `Jest`. Legacy unit tests still exist in `Mocha` but all new unit tests should be written in `Jest`.
|
||||
|
||||
[float]
|
||||
==== Mocha (legacy)
|
||||
|
||||
Mocha tests are contained in `__tests__` directories.
|
||||
|
||||
*Running Mocha Unit Tests*
|
||||
|
||||
["source","shell"]
|
||||
-----------
|
||||
yarn test:mocha
|
||||
-----------
|
||||
|
||||
[float]
|
||||
==== Jest
|
||||
Jest tests are stored in the same directory as source code files with the `.test.{js,ts,tsx}` suffix.
|
||||
|
||||
*Running Jest Unit Tests*
|
||||
|
||||
["source","shell"]
|
||||
-----------
|
||||
yarn test:jest
|
||||
-----------
|
||||
|
||||
[float]
|
||||
===== Writing Jest Unit Tests
|
||||
|
||||
In order to write those tests there are two main things you need to be aware of.
|
||||
The first one is the different between `jest.mock` and `jest.doMock`
|
||||
and the second one our `jest mocks file pattern`. As we are running `js` and `ts`
|
||||
test files with `babel-jest` both techniques are needed
|
||||
specially for the tests implemented on Typescript in order to benefit from the
|
||||
auto-inference types feature.
|
||||
|
||||
[float]
|
||||
===== Jest.mock vs Jest.doMock
|
||||
|
||||
Both methods are essentially the same on their roots however the `jest.mock`
|
||||
calls will get hoisted to the top of the file and can only reference variables
|
||||
prefixed with `mock`. On the other hand, `jest.doMock` won't be hoisted and can
|
||||
reference pretty much any variable we want, however we have to assure those referenced
|
||||
variables are instantiated at the time we need them which lead us to the next
|
||||
section where we'll talk about our jest mock files pattern.
|
||||
|
||||
[float]
|
||||
===== Jest Mock Files Pattern
|
||||
|
||||
Specially on typescript it is pretty common to have in unit tests
|
||||
`jest.doMock` calls which reference for example imported types. Any error
|
||||
will thrown from doing that however the test will fail. The reason behind that
|
||||
is because despite the `jest.doMock` isn't being hoisted by `babel-jest` the
|
||||
import with the types we are referencing will be hoisted to the top and at the
|
||||
time we'll call the function that variable would not be defined.
|
||||
|
||||
In order to prevent that we develop a protocol that should be followed:
|
||||
|
||||
- Each module could provide a standard mock in `mymodule.mock.ts` in case
|
||||
there are other tests that could benefit from using definitions here.
|
||||
This file would not have any `jest.mock` calls, just dummy objects.
|
||||
|
||||
- Each test defines its mocks in `mymodule.test.mocks.ts`. This file
|
||||
could import relevant mocks from the generalised module's mocks
|
||||
file `(*.mock.ts)` and call `jest.mock` for each of them. If there is
|
||||
any relevant dummy mock objects to generalise (and to be used by
|
||||
other tests), the dummy objects could be defined directly on this file.
|
||||
|
||||
- Each test would import its mocks from the test mocks
|
||||
file mymodule.test.mocks.ts. `mymodule.test.ts` has an import
|
||||
like: `import * as Mocks from './mymodule.test.mocks'`,
|
||||
`import { mockX } from './mymodule.test.mocks'`
|
||||
or just `import './mymodule.test.mocks'` if there isn't anything
|
||||
exported to be used.
|
||||
|
39
package.json
39
package.json
|
@ -93,6 +93,9 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/polyfill": "^7.2.5",
|
||||
"@babel/register": "^7.0.0",
|
||||
"@elastic/datemath": "5.0.2",
|
||||
"@elastic/eui": "9.4.2",
|
||||
"@elastic/filesaver": "1.1.2",
|
||||
|
@ -120,10 +123,7 @@
|
|||
"angular-sanitize": "1.6.5",
|
||||
"angular-sortable-view": "0.0.15",
|
||||
"autoprefixer": "^9.1.0",
|
||||
"babel-core": "6.26.3",
|
||||
"babel-loader": "7.1.5",
|
||||
"babel-polyfill": "6.26.0",
|
||||
"babel-register": "6.26.0",
|
||||
"babel-loader": "8.0.5",
|
||||
"bluebird": "3.5.3",
|
||||
"boom": "^7.2.0",
|
||||
"brace": "0.11.1",
|
||||
|
@ -260,7 +260,7 @@
|
|||
"@octokit/rest": "^15.10.0",
|
||||
"@types/angular": "1.6.50",
|
||||
"@types/angular-mocks": "^1.7.0",
|
||||
"@types/babel-core": "^6.25.5",
|
||||
"@types/babel__core": "^7.1.0",
|
||||
"@types/bluebird": "^3.1.1",
|
||||
"@types/boom": "^7.2.0",
|
||||
"@types/chance": "^1.0.0",
|
||||
|
@ -272,7 +272,7 @@
|
|||
"@types/delete-empty": "^2.0.0",
|
||||
"@types/elasticsearch": "^5.0.30",
|
||||
"@types/enzyme": "^3.1.12",
|
||||
"@types/eslint": "^4.16.2",
|
||||
"@types/eslint": "^4.16.6",
|
||||
"@types/execa": "^0.9.0",
|
||||
"@types/fetch-mock": "7.2.1",
|
||||
"@types/getopts": "^2.0.0",
|
||||
|
@ -317,8 +317,8 @@
|
|||
"@types/zen-observable": "^0.8.0",
|
||||
"angular-mocks": "1.4.7",
|
||||
"archiver": "^3.0.0",
|
||||
"babel-eslint": "^9.0.0",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^24.1.0",
|
||||
"backport": "4.4.1",
|
||||
"chai": "3.5.0",
|
||||
"chance": "1.0.10",
|
||||
|
@ -332,17 +332,17 @@
|
|||
"enzyme-adapter-react-16": "^1.9.0",
|
||||
"enzyme-adapter-utils": "^1.10.0",
|
||||
"enzyme-to-json": "^3.3.4",
|
||||
"eslint": "^5.6.0",
|
||||
"eslint-config-prettier": "^3.1.0",
|
||||
"eslint-plugin-babel": "^5.2.0",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-jest": "^21.26.2",
|
||||
"eslint-plugin-jsx-a11y": "^6.1.2",
|
||||
"eslint-plugin-mocha": "^5.2.0",
|
||||
"eslint": "^5.15.1",
|
||||
"eslint-config-prettier": "^4.1.0",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"eslint-plugin-jest": "^22.3.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.1",
|
||||
"eslint-plugin-mocha": "^5.3.0",
|
||||
"eslint-plugin-no-unsanitized": "^3.0.2",
|
||||
"eslint-plugin-prefer-object-spread": "^1.2.1",
|
||||
"eslint-plugin-prettier": "^2.6.2",
|
||||
"eslint-plugin-react": "^7.11.1",
|
||||
"eslint-plugin-prettier": "^3.0.1",
|
||||
"eslint-plugin-react": "^7.12.4",
|
||||
"faker": "1.1.0",
|
||||
"fetch-mock": "7.3.0",
|
||||
"geckodriver": "1.12.2",
|
||||
|
@ -353,7 +353,7 @@
|
|||
"grunt-karma": "2.0.0",
|
||||
"grunt-peg": "^2.0.1",
|
||||
"grunt-run": "0.7.0",
|
||||
"gulp-babel": "^7.0.1",
|
||||
"gulp-babel": "^8.0.0",
|
||||
"gulp-sourcemaps": "2.6.4",
|
||||
"has-ansi": "^3.0.0",
|
||||
"image-diff": "1.6.0",
|
||||
|
@ -399,9 +399,6 @@
|
|||
"supertest": "^3.1.0",
|
||||
"supertest-as-promised": "^4.0.2",
|
||||
"tree-kill": "^1.1.0",
|
||||
"ts-jest": "^23.1.4",
|
||||
"ts-loader": "^5.2.2",
|
||||
"ts-node": "^7.0.1",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.15.0",
|
||||
"tslint-microsoft-contrib": "^6.0.0",
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
{
|
||||
"presets": [["env", {
|
||||
"targets": {
|
||||
"node": "current",
|
||||
"browsers": [
|
||||
"last 2 versions",
|
||||
"> 5%",
|
||||
"Safari 7",
|
||||
]
|
||||
"presets": [
|
||||
["@babel/preset-env", {
|
||||
"targets": {
|
||||
"node": "current",
|
||||
"browsers": [
|
||||
"last 2 versions",
|
||||
"> 5%",
|
||||
"Safari 7"
|
||||
]
|
||||
}
|
||||
}
|
||||
}]],
|
||||
]
|
||||
],
|
||||
"plugins": ["add-module-exports"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"babel-plugin-add-module-exports": "^1.0.0",
|
||||
"moment": "^2.13.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
},
|
||||
"homepage": "https://github.com/elastic/eslint-config-kibana#readme",
|
||||
"peerDependencies": {
|
||||
"babel-eslint": "^9.0.0",
|
||||
"eslint": "^5.6.0",
|
||||
"eslint-plugin-babel": "^5.2.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.1.2",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-jest": "^21.22.1",
|
||||
"eslint-plugin-mocha": "^5.2.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"eslint": "^5.14.1",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.1",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"eslint-plugin-jest": "^22.3.0",
|
||||
"eslint-plugin-mocha": "^5.3.0",
|
||||
"eslint-plugin-no-unsanitized": "^3.0.2",
|
||||
"eslint-plugin-prefer-object-spread": "^1.2.1",
|
||||
"eslint-plugin-react": "^7.11.1"
|
||||
"eslint-plugin-react": "^7.12.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0"
|
||||
"@babel/cli": "^7.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
|
|
|
@ -19,20 +19,33 @@
|
|||
|
||||
module.exports = {
|
||||
presets: [
|
||||
require.resolve('babel-preset-react'),
|
||||
require.resolve('@babel/preset-typescript'),
|
||||
require.resolve('@babel/preset-react')
|
||||
],
|
||||
plugins: [
|
||||
require.resolve('babel-plugin-add-module-exports'),
|
||||
// stage 3
|
||||
require.resolve('babel-plugin-transform-async-generator-functions'),
|
||||
require.resolve('babel-plugin-transform-object-rest-spread'),
|
||||
|
||||
// the class properties proposal was merged with the private fields proposal
|
||||
// The class properties proposal was merged with the private fields proposal
|
||||
// into the "class fields" proposal. Babel doesn't support this combined
|
||||
// proposal yet, which includes private field, so this transform is
|
||||
// TECHNICALLY stage 2, but for all intents and purposes it's stage 3
|
||||
//
|
||||
// See https://github.com/babel/proposals/issues/12 for progress
|
||||
require.resolve('babel-plugin-transform-class-properties'),
|
||||
require.resolve('@babel/plugin-proposal-class-properties'),
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
// Babel 7 don't support the namespace feature on typescript code.
|
||||
// With namespaces only used for type declarations, we can securely
|
||||
// strip them off for babel on x-pack infra plugin
|
||||
//
|
||||
// See https://github.com/babel/babel/issues/8244#issuecomment-466548733
|
||||
test: /x-pack[\/\\]plugins[\/\\]infra[\/\\].*[\/\\]graphql/,
|
||||
plugins: [
|
||||
[
|
||||
require.resolve('babel-plugin-typescript-strip-namespaces'),
|
||||
],
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
require.resolve('@babel/preset-react'),
|
||||
require.resolve('@babel/preset-typescript'),
|
||||
],
|
||||
plugins: [
|
||||
require.resolve('babel7-plugin-add-module-exports'),
|
||||
// stage 3
|
||||
require.resolve('@babel/plugin-proposal-async-generator-functions'),
|
||||
require.resolve('@babel/plugin-proposal-object-rest-spread'),
|
||||
|
||||
// the class properties proposal was merged with the private fields proposal
|
||||
// into the "class fields" proposal. Babel doesn't support this combined
|
||||
// proposal yet, which includes private field, so this transform is
|
||||
// TECHNICALLY stage 2, but for all intents and purposes it's stage 3
|
||||
//
|
||||
// See https://github.com/babel/proposals/issues/12 for progress
|
||||
require.resolve('@babel/plugin-proposal-class-properties'),
|
||||
],
|
||||
};
|
|
@ -17,34 +17,37 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
require.resolve('babel-preset-env'),
|
||||
{
|
||||
targets: {
|
||||
// only applies the necessary transformations based on the
|
||||
// current node.js processes version. For example: running
|
||||
// `nvm install 8 && node ./src/cli` will run kibana in node
|
||||
// version 8 and babel will stop transpiling async/await
|
||||
// because they are supported in the "current" version of node
|
||||
node: 'current',
|
||||
},
|
||||
module.exports = () => {
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
require.resolve('@babel/preset-env'),
|
||||
{
|
||||
targets: {
|
||||
// only applies the necessary transformations based on the
|
||||
// current node.js processes version. For example: running
|
||||
// `nvm install 8 && node ./src/cli` will run kibana in node
|
||||
// version 8 and babel will stop transpiling async/await
|
||||
// because they are supported in the "current" version of node
|
||||
node: 'current',
|
||||
},
|
||||
|
||||
// replaces `import "babel-polyfill"` with a list of require statements
|
||||
// for just the polyfills that the target versions don't already supply
|
||||
// on their own
|
||||
useBuiltIns: true,
|
||||
},
|
||||
// replaces `import "@babel/polyfill"` with a list of require statements
|
||||
// for just the polyfills that the target versions don't already supply
|
||||
// on their own
|
||||
useBuiltIns: 'entry',
|
||||
modules: 'cjs'
|
||||
},
|
||||
],
|
||||
require('./common_preset'),
|
||||
],
|
||||
require('./common_preset'),
|
||||
],
|
||||
plugins: [
|
||||
[
|
||||
require.resolve('babel-plugin-transform-define'),
|
||||
{
|
||||
'global.__BUILT_WITH_BABEL__': 'true'
|
||||
}
|
||||
plugins: [
|
||||
[
|
||||
require.resolve('babel-plugin-transform-define'),
|
||||
{
|
||||
'global.__BUILT_WITH_BABEL__': 'true'
|
||||
}
|
||||
]
|
||||
]
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = () => ({
|
||||
presets: [
|
||||
[
|
||||
require.resolve('@babel/preset-env'),
|
||||
{
|
||||
targets: {
|
||||
// only applies the necessary transformations based on the
|
||||
// current node.js processes version. For example: running
|
||||
// `nvm install 8 && node ./src/cli` will run kibana in node
|
||||
// version 8 and babel will stop transpiling async/await
|
||||
// because they are supported in the "current" version of node
|
||||
node: 'current',
|
||||
},
|
||||
|
||||
// replaces `import "babel-polyfill"` with a list of require statements
|
||||
// for just the polyfills that the target versions don't already supply
|
||||
// on their own
|
||||
useBuiltIns: 'entry',
|
||||
},
|
||||
],
|
||||
require('./common_preset_7'),
|
||||
],
|
||||
plugins: [
|
||||
[
|
||||
require.resolve('babel-plugin-transform-define'),
|
||||
{
|
||||
'global.__BUILT_WITH_BABEL__': 'true'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
|
@ -4,20 +4,12 @@
|
|||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/plugin-proposal-async-generator-functions": "^7.2.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.3.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
|
||||
"@babel/preset-react":"^7.0.0",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@babel/preset-typescript": "^7.3.3",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-transform-async-generator-functions": "^6.24.1",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
"babel-plugin-add-module-exports": "^1.0.0",
|
||||
"babel-plugin-transform-define": "^1.3.1",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel7-plugin-add-module-exports": "npm:babel-plugin-add-module-exports@^1.0.0"
|
||||
"babel-plugin-typescript-strip-namespaces": "^1.1.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,21 +17,24 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
require.resolve('babel-preset-env'),
|
||||
{
|
||||
targets: {
|
||||
browsers: [
|
||||
'last 2 versions',
|
||||
'> 5%',
|
||||
'Safari 7', // for PhantomJS support: https://github.com/elastic/kibana/issues/27136
|
||||
],
|
||||
module.exports = () => {
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
require.resolve('@babel/preset-env'),
|
||||
{
|
||||
targets: {
|
||||
browsers: [
|
||||
'last 2 versions',
|
||||
'> 5%',
|
||||
'Safari 7', // for PhantomJS support: https://github.com/elastic/kibana/issues/27136
|
||||
],
|
||||
},
|
||||
useBuiltIns: 'entry',
|
||||
modules: 'cjs'
|
||||
},
|
||||
useBuiltIns: true,
|
||||
},
|
||||
],
|
||||
require('./common_preset'),
|
||||
]
|
||||
],
|
||||
require('./common_preset'),
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
"tslib": "^1.9.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/expect": "1.0.0",
|
||||
"babel-cli": "^6.26.0",
|
||||
"chance": "1.0.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"peerDependencies": {
|
||||
"eslint": "^5.6.0",
|
||||
"babel-eslint": "^9.0.0"
|
||||
"eslint": "^5.14.1",
|
||||
"babel-eslint": "^10.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"dedent": "^0.7.0"
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"types/intl_format_cache.d.ts",
|
||||
"types/intl_relativeformat.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"target"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationDir": "./target/types",
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"types/intl_format_cache.d.ts",
|
||||
"types/intl_relativeformat.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"target"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationDir": "./target/types",
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"presets": ["@kbn/babel-preset/webpack_preset"],
|
||||
"plugins": [
|
||||
["babel-plugin-transform-runtime", {
|
||||
"polyfill": false,
|
||||
["@babel/plugin-transform-runtime", {
|
||||
"regenerator": true
|
||||
}]
|
||||
]
|
||||
|
|
|
@ -9,19 +9,20 @@
|
|||
"kbn:watch": "node scripts/build --dev --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.3.4",
|
||||
"@kbn/i18n": "1.0.0",
|
||||
"lodash": "npm:@elastic/lodash@3.10.1-kibana1",
|
||||
"lodash.clone": "^4.5.0",
|
||||
"uuid": "3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "7.3.4",
|
||||
"@babel/plugin-transform-runtime": "^7.3.4",
|
||||
"@babel/polyfill": "7.2.5",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "6.26.3",
|
||||
"babel-loader": "7.1.5",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-polyfill": "6.20.0",
|
||||
"babel-loader": "8.0.5",
|
||||
"copy-webpack-plugin": "^4.6.0",
|
||||
"css-loader": "1.0.0",
|
||||
"del": "^3.0.0",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
const { extname } = require('path');
|
||||
|
||||
const { transform } = require('babel-core');
|
||||
const { transform } = require('@babel/core');
|
||||
|
||||
exports.createServerCodeTransformer = (sourceMaps) => {
|
||||
return (content, path) => {
|
||||
|
|
|
@ -28,15 +28,14 @@ describe('js support', () => {
|
|||
it('transpiles js file', () => {
|
||||
const transformer = createServerCodeTransformer();
|
||||
expect(transformer(JS_FIXTURE, JS_FIXTURE_PATH)).toMatchInlineSnapshot(`
|
||||
"'use strict';
|
||||
"\\"use strict\\";
|
||||
|
||||
var _util = require('util');
|
||||
|
||||
var _util2 = _interopRequireDefault(_util);
|
||||
var _util = _interopRequireDefault(require(\\"util\\"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
console.log(_util2.default.format('hello world')); /* eslint-disable */"
|
||||
/* eslint-disable */
|
||||
console.log(_util.default.format('hello world'));"
|
||||
`);
|
||||
});
|
||||
|
||||
|
|
|
@ -27,15 +27,15 @@
|
|||
"@elastic/eslint-import-resolver-kibana": "link:../../kibana/packages/kbn-eslint-import-resolver-kibana",
|
||||
"@kbn/expect": "1.0.0",
|
||||
"@kbn/plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers",
|
||||
"babel-eslint": "^9.0.0",
|
||||
"eslint": "^5.6.0",
|
||||
"eslint-plugin-babel": "^5.2.0",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-jest": "^21.26.2",
|
||||
"eslint-plugin-jsx-a11y": "^6.1.2",
|
||||
"eslint-plugin-mocha": "^5.2.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"eslint": "^5.14.1",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"eslint-plugin-jest": "^22.3.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.1",
|
||||
"eslint-plugin-mocha": "^5.3.0",
|
||||
"eslint-plugin-no-unsanitized": "^3.0.2",
|
||||
"eslint-plugin-prefer-object-spread": "^1.2.1",
|
||||
"eslint-plugin-react": "^7.11.1"
|
||||
"eslint-plugin-react": "^7.12.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ function babelRegister() {
|
|||
const plugin = pluginConfig();
|
||||
|
||||
try {
|
||||
// add support for moved babel-register source: https://github.com/elastic/kibana/pull/13973
|
||||
// add support for moved @babel/register source: https://github.com/elastic/kibana/pull/13973
|
||||
require(resolve(plugin.kibanaRoot, 'src/setup_node_env/babel_register')); // eslint-disable-line import/no-dynamic-require
|
||||
} catch (error) {
|
||||
if (error.code === 'MODULE_NOT_FOUND') {
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
{
|
||||
"presets": [
|
||||
"stage-3",
|
||||
["env", {
|
||||
"@babel/typescript",
|
||||
["@babel/preset-env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/proposal-class-properties",
|
||||
"@babel/proposal-object-rest-spread"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
3584
packages/kbn-pm/dist/index.js
vendored
3584
packages/kbn-pm/dist/index.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,11 @@
|
|||
"prettier": "prettier --write './src/**/*.ts'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/plugin-proposal-class-properties": "^7.3.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"@babel/preset-typescript": "^7.3.3",
|
||||
"@types/cmd-shim": "^2.0.0",
|
||||
"@types/cpy": "^5.1.0",
|
||||
"@types/dedent": "^0.7.0",
|
||||
|
@ -32,10 +37,7 @@
|
|||
"@types/tempy": "^0.1.0",
|
||||
"@types/wrap-ansi": "^2.0.14",
|
||||
"@types/write-pkg": "^3.1.0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.5",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-stage-3": "^6.24.1",
|
||||
"babel-loader": "^8.0.5",
|
||||
"chalk": "^2.4.1",
|
||||
"cmd-shim": "^2.0.2",
|
||||
"cpy": "^7.0.1",
|
||||
|
@ -60,7 +62,6 @@
|
|||
"strip-ansi": "^4.0.0",
|
||||
"strong-log-transformer": "^2.1.0",
|
||||
"tempy": "^0.2.1",
|
||||
"ts-loader": "^5.2.2",
|
||||
"typescript": "^3.3.3333",
|
||||
"unlazy-loader": "^0.1.3",
|
||||
"webpack": "^4.23.1",
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
"private": true,
|
||||
"main": "./target/index.js",
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1"
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/preset-env": "^7.3.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel --presets env --out-dir target src"
|
||||
"build": "babel --presets=@babel/preset-env --out-dir target src"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
"@elastic/bar": "link:../bar"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"moment": "2.20.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel --presets env --out-dir target src"
|
||||
"build": "babel --presets=@babel/preset-env --out-dir target src"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,14 +20,15 @@ Array [
|
|||
exports[`kbn-pm production builds and copies projects for production: packages/bar/package.json 1`] = `
|
||||
Object {
|
||||
"devDependencies": Object {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
},
|
||||
"main": "./target/index.js",
|
||||
"name": "@elastic/bar",
|
||||
"private": true,
|
||||
"scripts": Object {
|
||||
"build": "babel --presets env --out-dir target src",
|
||||
"build": "babel --presets=@babel/preset-env --out-dir target src",
|
||||
},
|
||||
"version": "1.0.0",
|
||||
}
|
||||
|
@ -47,15 +48,16 @@ Object {
|
|||
"@elastic/bar": "link:../bar",
|
||||
},
|
||||
"devDependencies": Object {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"moment": "2.20.1",
|
||||
},
|
||||
"main": "./target/index.js",
|
||||
"name": "@elastic/foo",
|
||||
"private": true,
|
||||
"scripts": Object {
|
||||
"build": "babel --presets env --out-dir target src",
|
||||
"build": "babel --presets=@babel/preset-env --out-dir target src",
|
||||
},
|
||||
"version": "1.0.0",
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"dist"
|
||||
],
|
||||
"include": [
|
||||
"./src/**/*.ts"
|
||||
"./src/**/*.ts",
|
||||
],
|
||||
"compilerOptions": {
|
||||
"types": [
|
||||
|
|
|
@ -44,15 +44,6 @@ module.exports = {
|
|||
{
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
{
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
compilerOptions: {
|
||||
// enable esnext modules so webpack can do its thing better
|
||||
module: 'esnext',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
|
|
|
@ -18,6 +18,6 @@
|
|||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: ['@kbn/babel-preset/node_preset_7'],
|
||||
presets: ['@kbn/babel-preset/node_preset'],
|
||||
ignore: ['**/*.test.js'],
|
||||
};
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@babel/cli": "^7.2.3"
|
||||
"@kbn/dev-utils": "1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^2.4.1",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
require('./main.scss');
|
||||
|
||||
import 'babel-polyfill';
|
||||
import '@babel/polyfill';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
|
|
|
@ -26,16 +26,16 @@
|
|||
"uuid": "3.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"enzyme": "3.2.0",
|
||||
"enzyme-adapter-react-16": "^1.1.1"
|
||||
"enzyme": "^3.8.0",
|
||||
"enzyme-adapter-react-16": "^1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/polyfill": "^7.2.5",
|
||||
"@elastic/eui": "0.0.23",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"autoprefixer": "6.5.4",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.5",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"babel-loader": "^8.0.5",
|
||||
"brace": "0.10.0",
|
||||
"chalk": "^2.4.1",
|
||||
"chokidar": "1.6.0",
|
||||
|
@ -43,7 +43,7 @@
|
|||
"expose-loader": "^0.7.5",
|
||||
"file-loader": "^2.0.0",
|
||||
"grunt": "1.0.3",
|
||||
"grunt-babel": "^7.0.0",
|
||||
"grunt-babel": "^8.0.0",
|
||||
"grunt-contrib-clean": "^1.1.0",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"highlight.js": "9.0.0",
|
||||
|
|
92
src/core/public/core_system.test.mocks.ts
Normal file
92
src/core/public/core_system.test.mocks.ts
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { basePathServiceMock } from './base_path/base_path_service.mock';
|
||||
import { chromeServiceMock } from './chrome/chrome_service.mock';
|
||||
import { fatalErrorsServiceMock } from './fatal_errors/fatal_errors_service.mock';
|
||||
import { httpServiceMock } from './http/http_service.mock';
|
||||
import { i18nServiceMock } from './i18n/i18n_service.mock';
|
||||
import { injectedMetadataServiceMock } from './injected_metadata/injected_metadata_service.mock';
|
||||
import { legacyPlatformServiceMock } from './legacy/legacy_service.mock';
|
||||
import { notificationServiceMock } from './notifications/notifications_service.mock';
|
||||
import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
|
||||
|
||||
export const MockLegacyPlatformService = legacyPlatformServiceMock.create();
|
||||
export const LegacyPlatformServiceConstructor = jest
|
||||
.fn()
|
||||
.mockImplementation(() => MockLegacyPlatformService);
|
||||
jest.doMock('./legacy', () => ({
|
||||
LegacyPlatformService: LegacyPlatformServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockInjectedMetadataService = injectedMetadataServiceMock.create();
|
||||
export const InjectedMetadataServiceConstructor = jest
|
||||
.fn()
|
||||
.mockImplementation(() => MockInjectedMetadataService);
|
||||
jest.doMock('./injected_metadata', () => ({
|
||||
InjectedMetadataService: InjectedMetadataServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockFatalErrorsService = fatalErrorsServiceMock.create();
|
||||
export const FatalErrorsServiceConstructor = jest
|
||||
.fn()
|
||||
.mockImplementation(() => MockFatalErrorsService);
|
||||
jest.doMock('./fatal_errors', () => ({
|
||||
FatalErrorsService: FatalErrorsServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockI18nService = i18nServiceMock.create();
|
||||
export const I18nServiceConstructor = jest.fn().mockImplementation(() => MockI18nService);
|
||||
jest.doMock('./i18n', () => ({
|
||||
I18nService: I18nServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockNotificationsService = notificationServiceMock.create();
|
||||
export const NotificationServiceConstructor = jest
|
||||
.fn()
|
||||
.mockImplementation(() => MockNotificationsService);
|
||||
jest.doMock('./notifications', () => ({
|
||||
NotificationsService: NotificationServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockHttpService = httpServiceMock.create();
|
||||
export const HttpServiceConstructor = jest.fn().mockImplementation(() => MockHttpService);
|
||||
jest.doMock('./http', () => ({
|
||||
HttpService: HttpServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockBasePathService = basePathServiceMock.create();
|
||||
export const BasePathServiceConstructor = jest.fn().mockImplementation(() => MockBasePathService);
|
||||
jest.doMock('./base_path', () => ({
|
||||
BasePathService: BasePathServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockUiSettingsService = uiSettingsServiceMock.create();
|
||||
export const UiSettingsServiceConstructor = jest
|
||||
.fn()
|
||||
.mockImplementation(() => MockUiSettingsService);
|
||||
jest.doMock('./ui_settings', () => ({
|
||||
UiSettingsService: UiSettingsServiceConstructor,
|
||||
}));
|
||||
|
||||
export const MockChromeService = chromeServiceMock.create();
|
||||
export const ChromeServiceConstructor = jest.fn().mockImplementation(() => MockChromeService);
|
||||
jest.doMock('./chrome', () => ({
|
||||
ChromeService: ChromeServiceConstructor,
|
||||
}));
|
|
@ -17,73 +17,26 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { basePathServiceMock } from './base_path/base_path_service.mock';
|
||||
import { chromeServiceMock } from './chrome/chrome_service.mock';
|
||||
import { fatalErrorsServiceMock } from './fatal_errors/fatal_errors_service.mock';
|
||||
import { httpServiceMock } from './http/http_service.mock';
|
||||
import { i18nServiceMock } from './i18n/i18n_service.mock';
|
||||
import { injectedMetadataServiceMock } from './injected_metadata/injected_metadata_service.mock';
|
||||
import { legacyPlatformServiceMock } from './legacy/legacy_service.mock';
|
||||
import { notificationServiceMock } from './notifications/notifications_service.mock';
|
||||
import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock';
|
||||
|
||||
const MockLegacyPlatformService = legacyPlatformServiceMock.create();
|
||||
const LegacyPlatformServiceConstructor = jest
|
||||
.fn()
|
||||
.mockImplementation(() => MockLegacyPlatformService);
|
||||
jest.mock('./legacy', () => ({
|
||||
LegacyPlatformService: LegacyPlatformServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockInjectedMetadataService = injectedMetadataServiceMock.create();
|
||||
const InjectedMetadataServiceConstructor = jest
|
||||
.fn()
|
||||
.mockImplementation(() => MockInjectedMetadataService);
|
||||
jest.mock('./injected_metadata', () => ({
|
||||
InjectedMetadataService: InjectedMetadataServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockFatalErrorsService = fatalErrorsServiceMock.create();
|
||||
const FatalErrorsServiceConstructor = jest.fn().mockImplementation(() => MockFatalErrorsService);
|
||||
jest.mock('./fatal_errors', () => ({
|
||||
FatalErrorsService: FatalErrorsServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockI18nService = i18nServiceMock.create();
|
||||
const I18nServiceConstructor = jest.fn().mockImplementation(() => MockI18nService);
|
||||
jest.mock('./i18n', () => ({
|
||||
I18nService: I18nServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockNotificationsService = notificationServiceMock.create();
|
||||
const NotificationServiceConstructor = jest.fn().mockImplementation(() => MockNotificationsService);
|
||||
jest.mock('./notifications', () => ({
|
||||
NotificationsService: NotificationServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockHttpService = httpServiceMock.create();
|
||||
const HttpServiceConstructor = jest.fn().mockImplementation(() => MockHttpService);
|
||||
jest.mock('./http', () => ({
|
||||
HttpService: HttpServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockBasePathService = basePathServiceMock.create();
|
||||
const BasePathServiceConstructor = jest.fn().mockImplementation(() => MockBasePathService);
|
||||
jest.mock('./base_path', () => ({
|
||||
BasePathService: BasePathServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockUiSettingsService = uiSettingsServiceMock.create();
|
||||
const UiSettingsServiceConstructor = jest.fn().mockImplementation(() => MockUiSettingsService);
|
||||
jest.mock('./ui_settings', () => ({
|
||||
UiSettingsService: UiSettingsServiceConstructor,
|
||||
}));
|
||||
|
||||
const MockChromeService = chromeServiceMock.create();
|
||||
const ChromeServiceConstructor = jest.fn().mockImplementation(() => MockChromeService);
|
||||
jest.mock('./chrome', () => ({
|
||||
ChromeService: ChromeServiceConstructor,
|
||||
}));
|
||||
import {
|
||||
BasePathServiceConstructor,
|
||||
ChromeServiceConstructor,
|
||||
FatalErrorsServiceConstructor,
|
||||
HttpServiceConstructor,
|
||||
I18nServiceConstructor,
|
||||
InjectedMetadataServiceConstructor,
|
||||
LegacyPlatformServiceConstructor,
|
||||
MockBasePathService,
|
||||
MockChromeService,
|
||||
MockFatalErrorsService,
|
||||
MockHttpService,
|
||||
MockI18nService,
|
||||
MockInjectedMetadataService,
|
||||
MockLegacyPlatformService,
|
||||
MockNotificationsService,
|
||||
MockUiSettingsService,
|
||||
NotificationServiceConstructor,
|
||||
UiSettingsServiceConstructor,
|
||||
} from './core_system.test.mocks';
|
||||
|
||||
import { CoreSystem } from './core_system';
|
||||
jest.spyOn(CoreSystem.prototype, 'stop');
|
||||
|
|
|
@ -52,8 +52,7 @@ exports[`rendering render matches snapshot 1`] = `
|
|||
body={
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="Try refreshing the page. If that doesn't work, go back to the previous page or
|
||||
clear your session data."
|
||||
defaultMessage="Try refreshing the page. If that doesn't work, go back to the previous page or clear your session data."
|
||||
id="core.fatalErrors.tryRefreshingPageDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockRender = jest.fn();
|
||||
jest.mock('react-dom', () => {
|
||||
return {
|
||||
render: mockRender,
|
||||
};
|
||||
});
|
|
@ -24,12 +24,7 @@ expect.addSnapshotSerializer({
|
|||
print: () => `Rx.Observable`,
|
||||
});
|
||||
|
||||
const mockRender = jest.fn();
|
||||
jest.mock('react-dom', () => {
|
||||
return {
|
||||
render: mockRender,
|
||||
};
|
||||
});
|
||||
import { mockRender } from './fatal_errors_service.test.mocks';
|
||||
|
||||
import { FatalErrorsService } from './fatal_errors_service';
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockReactDomRender = jest.fn();
|
||||
export const mockReactDomUnmount = jest.fn();
|
||||
jest.mock('react-dom', () => ({
|
||||
render: mockReactDomRender,
|
||||
unmountComponentAtNode: mockReactDomUnmount,
|
||||
}));
|
|
@ -17,12 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockReactDomRender = jest.fn();
|
||||
const mockReactDomUnmount = jest.fn();
|
||||
jest.mock('react-dom', () => ({
|
||||
render: mockReactDomRender,
|
||||
unmountComponentAtNode: mockReactDomUnmount,
|
||||
}));
|
||||
import { mockReactDomRender, mockReactDomUnmount } from './toasts_service.test.mocks';
|
||||
|
||||
import { ToastsService } from './toasts_service';
|
||||
import { ToastsSetup } from './toasts_start';
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
function mockClass<T>(
|
||||
module: string,
|
||||
Class: { new (...args: any[]): T },
|
||||
setup: (instance: any, args: any[]) => void
|
||||
) {
|
||||
const MockClass = jest.fn(function(this: any, ...args: any[]) {
|
||||
setup(this, args);
|
||||
});
|
||||
|
||||
// define the mock name which is used in some snapshots
|
||||
MockClass.mockName(`Mock${Class.name}`);
|
||||
|
||||
// define the class name for the MockClass which is used in other snapshots
|
||||
Object.defineProperty(MockClass, 'name', {
|
||||
value: `Mock${Class.name}`,
|
||||
});
|
||||
|
||||
jest.doMock(module, () => ({
|
||||
[Class.name]: MockClass,
|
||||
}));
|
||||
|
||||
return MockClass;
|
||||
}
|
||||
|
||||
// Mock the UiSettingsApi class
|
||||
import { UiSettingsApi } from './ui_settings_api';
|
||||
export const MockUiSettingsApi = mockClass('./ui_settings_api', UiSettingsApi, inst => {
|
||||
inst.stop = jest.fn();
|
||||
inst.getLoadingCount$ = jest.fn().mockReturnValue({
|
||||
loadingCountObservable: true,
|
||||
});
|
||||
});
|
||||
|
||||
// Mock the UiSettingsClient class
|
||||
import { UiSettingsClient } from './ui_settings_client';
|
||||
export const MockUiSettingsClient = mockClass('./ui_settings_client', UiSettingsClient, inst => {
|
||||
inst.stop = jest.fn();
|
||||
});
|
|
@ -17,44 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
function mockClass<T>(
|
||||
module: string,
|
||||
Class: { new (...args: any[]): T },
|
||||
setup: (instance: any, args: any[]) => void
|
||||
) {
|
||||
const MockClass = jest.fn(function(this: any, ...args: any[]) {
|
||||
setup(this, args);
|
||||
});
|
||||
|
||||
// define the mock name which is used in some snapshots
|
||||
MockClass.mockName(`Mock${Class.name}`);
|
||||
|
||||
// define the class name for the MockClass which is used in other snapshots
|
||||
Object.defineProperty(MockClass, 'name', {
|
||||
value: `Mock${Class.name}`,
|
||||
});
|
||||
|
||||
jest.mock(module, () => ({
|
||||
[Class.name]: MockClass,
|
||||
}));
|
||||
|
||||
return MockClass;
|
||||
}
|
||||
|
||||
// Mock the UiSettingsApi class
|
||||
import { UiSettingsApi } from './ui_settings_api';
|
||||
const MockUiSettingsApi = mockClass('./ui_settings_api', UiSettingsApi, inst => {
|
||||
inst.stop = jest.fn();
|
||||
inst.getLoadingCount$ = jest.fn().mockReturnValue({
|
||||
loadingCountObservable: true,
|
||||
});
|
||||
});
|
||||
|
||||
// Mock the UiSettingsClient class
|
||||
import { UiSettingsClient } from './ui_settings_client';
|
||||
const MockUiSettingsClient = mockClass('./ui_settings_client', UiSettingsClient, inst => {
|
||||
inst.stop = jest.fn();
|
||||
});
|
||||
import { MockUiSettingsApi, MockUiSettingsClient } from './ui_settings_service.test.mocks';
|
||||
|
||||
import { basePathServiceMock } from '../base_path/base_path_service.mock';
|
||||
import { httpServiceMock } from '../http/http_service.mock';
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { ObjectToConfigAdapter } from './object_to_config_adapter';
|
||||
|
||||
|
|
21
src/core/server/config/config_service.test.mocks.ts
Normal file
21
src/core/server/config/config_service.test.mocks.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../../package.json', () => mockPackage);
|
|
@ -22,8 +22,7 @@
|
|||
import { BehaviorSubject } from 'rxjs';
|
||||
import { first } from 'rxjs/operators';
|
||||
|
||||
const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../../package.json', () => mockPackage);
|
||||
import { mockPackage } from './config_service.test.mocks';
|
||||
|
||||
import { schema, Type, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
|
|
33
src/core/server/config/env.test.mocks.ts
Normal file
33
src/core/server/config/env.test.mocks.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
jest.mock('process', () => ({
|
||||
cwd() {
|
||||
return '/test/cwd';
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock('path', () => ({
|
||||
resolve(...pathSegments: string[]) {
|
||||
return pathSegments.join('/');
|
||||
},
|
||||
}));
|
||||
|
||||
export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../../package.json', () => mockPackage);
|
|
@ -17,20 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
jest.mock('process', () => ({
|
||||
cwd() {
|
||||
return '/test/cwd';
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock('path', () => ({
|
||||
resolve(...pathSegments: string[]) {
|
||||
return pathSegments.join('/');
|
||||
},
|
||||
}));
|
||||
|
||||
const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../../package.json', () => mockPackage);
|
||||
import { mockPackage } from './env.test.mocks';
|
||||
|
||||
import { Env } from '.';
|
||||
import { getEnvOptions } from './__mocks__/env';
|
||||
|
|
24
src/core/server/config/raw_config_service.test.mocks.ts
Normal file
24
src/core/server/config/raw_config_service.test.mocks.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockGetConfigFromFiles = jest.fn();
|
||||
|
||||
jest.mock('./read_config', () => ({
|
||||
getConfigFromFiles: mockGetConfigFromFiles,
|
||||
}));
|
|
@ -17,11 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockGetConfigFromFiles = jest.fn();
|
||||
|
||||
jest.mock('./read_config', () => ({
|
||||
getConfigFromFiles: mockGetConfigFromFiles,
|
||||
}));
|
||||
import { mockGetConfigFromFiles } from './raw_config_service.test.mocks';
|
||||
|
||||
import { first } from 'rxjs/operators';
|
||||
import { RawConfigService } from '.';
|
||||
|
|
35
src/core/server/elasticsearch/cluster_client.test.mocks.ts
Normal file
35
src/core/server/elasticsearch/cluster_client.test.mocks.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const MockClient = jest.fn();
|
||||
jest.mock('elasticsearch', () => ({
|
||||
// Jest types don't include `requireActual` right now.
|
||||
...jest.requireActual('elasticsearch'),
|
||||
Client: MockClient,
|
||||
}));
|
||||
|
||||
export const MockScopedClusterClient = jest.fn();
|
||||
jest.mock('./scoped_cluster_client', () => ({
|
||||
ScopedClusterClient: MockScopedClusterClient,
|
||||
}));
|
||||
|
||||
export const mockParseElasticsearchClientConfig = jest.fn();
|
||||
jest.mock('./elasticsearch_client_config', () => ({
|
||||
parseElasticsearchClientConfig: mockParseElasticsearchClientConfig,
|
||||
}));
|
|
@ -19,22 +19,11 @@
|
|||
|
||||
import { ElasticsearchConfig } from './elasticsearch_config';
|
||||
|
||||
const MockClient = jest.fn();
|
||||
jest.mock('elasticsearch', () => ({
|
||||
// Jest types don't include `requireActual` right now.
|
||||
...(jest as any).requireActual('elasticsearch'),
|
||||
Client: MockClient,
|
||||
}));
|
||||
|
||||
const MockScopedClusterClient = jest.fn();
|
||||
jest.mock('./scoped_cluster_client', () => ({
|
||||
ScopedClusterClient: MockScopedClusterClient,
|
||||
}));
|
||||
|
||||
const mockParseElasticsearchClientConfig = jest.fn();
|
||||
jest.mock('./elasticsearch_client_config', () => ({
|
||||
parseElasticsearchClientConfig: mockParseElasticsearchClientConfig,
|
||||
}));
|
||||
import {
|
||||
MockClient,
|
||||
mockParseElasticsearchClientConfig,
|
||||
MockScopedClusterClient,
|
||||
} from './cluster_client.test.mocks';
|
||||
|
||||
import { errors } from 'elasticsearch';
|
||||
import { get } from 'lodash';
|
||||
|
|
|
@ -17,5 +17,5 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
require('../../setup_node_env');
|
||||
module.exports = require('./ts_transform.ts');
|
||||
export const mockReadFileSync = jest.fn();
|
||||
jest.mock('fs', () => ({ readFileSync: mockReadFileSync }));
|
|
@ -17,8 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockReadFileSync = jest.fn();
|
||||
jest.mock('fs', () => ({ readFileSync: mockReadFileSync }));
|
||||
import { mockReadFileSync } from './elasticsearch_client_config.test.mocks';
|
||||
|
||||
import { duration } from 'moment';
|
||||
import { loggingServiceMock } from '../logging/logging_service.mock';
|
||||
|
@ -67,7 +66,7 @@ Object {
|
|||
});
|
||||
|
||||
test('parses fully specified config', () => {
|
||||
mockReadFileSync.mockImplementation(path => `content-of-${path}`);
|
||||
mockReadFileSync.mockImplementation((path: string) => `content-of-${path}`);
|
||||
|
||||
const elasticsearchConfig: ElasticsearchClientConfig = {
|
||||
apiVersion: 'v7.0.0',
|
||||
|
@ -607,7 +606,7 @@ Object {
|
|||
});
|
||||
|
||||
test('#ignoreCertAndKey = true', () => {
|
||||
mockReadFileSync.mockImplementation(path => `content-of-${path}`);
|
||||
mockReadFileSync.mockImplementation((path: string) => `content-of-${path}`);
|
||||
|
||||
expect(
|
||||
parseElasticsearchClientConfig(
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { ClusterClient } from './cluster_client';
|
||||
import { ElasticsearchConfig } from './elasticsearch_config';
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const MockClusterClient = jest.fn();
|
||||
jest.mock('./cluster_client', () => ({ ClusterClient: MockClusterClient }));
|
|
@ -19,8 +19,7 @@
|
|||
|
||||
import { first } from 'rxjs/operators';
|
||||
|
||||
const MockClusterClient = jest.fn();
|
||||
jest.mock('./cluster_client', () => ({ ClusterClient: MockClusterClient }));
|
||||
import { MockClusterClient } from './elasticsearch_service.test.mocks';
|
||||
|
||||
import { BehaviorSubject, combineLatest } from 'rxjs';
|
||||
import { Config, ConfigService, Env, ObjectToConfigAdapter } from '../config';
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { Server, ServerOptions } from 'hapi';
|
||||
import { HttpService } from './http_service';
|
||||
|
||||
|
|
24
src/core/server/http/http_service.test.mocks.ts
Normal file
24
src/core/server/http/http_service.test.mocks.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockHttpServer = jest.fn();
|
||||
|
||||
jest.mock('./http_server', () => ({
|
||||
HttpServer: mockHttpServer,
|
||||
}));
|
|
@ -17,11 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockHttpServer = jest.fn();
|
||||
|
||||
jest.mock('./http_server', () => ({
|
||||
HttpServer: mockHttpServer,
|
||||
}));
|
||||
import { mockHttpServer } from './http_service.test.mocks';
|
||||
|
||||
import { noop } from 'lodash';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
|
40
src/core/server/index.test.mocks.ts
Normal file
40
src/core/server/index.test.mocks.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { httpServiceMock } from './http/http_service.mock';
|
||||
export const httpService = httpServiceMock.create();
|
||||
jest.doMock('./http/http_service', () => ({
|
||||
HttpService: jest.fn(() => httpService),
|
||||
}));
|
||||
|
||||
export const mockPluginsService = { setup: jest.fn(), stop: jest.fn() };
|
||||
jest.doMock('./plugins/plugins_service', () => ({
|
||||
PluginsService: jest.fn(() => mockPluginsService),
|
||||
}));
|
||||
|
||||
import { elasticsearchServiceMock } from './elasticsearch/elasticsearch_service.mock';
|
||||
export const elasticsearchService = elasticsearchServiceMock.create();
|
||||
jest.doMock('./elasticsearch/elasticsearch_service', () => ({
|
||||
ElasticsearchService: jest.fn(() => elasticsearchService),
|
||||
}));
|
||||
|
||||
export const mockLegacyService = { setup: jest.fn(), stop: jest.fn() };
|
||||
jest.mock('./legacy/legacy_service', () => ({
|
||||
LegacyService: jest.fn(() => mockLegacyService),
|
||||
}));
|
|
@ -28,6 +28,7 @@ Array [
|
|||
"valueInBytes": 1073741824,
|
||||
},
|
||||
},
|
||||
"httpsAgent": undefined,
|
||||
"log": Object {
|
||||
"context": Array [
|
||||
"server",
|
||||
|
@ -52,6 +53,7 @@ Array [
|
|||
"trace": [MockFunction],
|
||||
"warn": [MockFunction],
|
||||
},
|
||||
"server": undefined,
|
||||
},
|
||||
],
|
||||
]
|
||||
|
|
29
src/core/server/logging/appenders/appenders.test.mocks.ts
Normal file
29
src/core/server/logging/appenders/appenders.test.mocks.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockCreateLayout = jest.fn();
|
||||
jest.mock('../layouts/layouts', () => {
|
||||
const { schema } = require('@kbn/config-schema');
|
||||
return {
|
||||
Layouts: {
|
||||
configSchema: schema.object({ kind: schema.literal('mock') }),
|
||||
create: mockCreateLayout,
|
||||
},
|
||||
};
|
||||
});
|
|
@ -17,16 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockCreateLayout = jest.fn();
|
||||
jest.mock('../layouts/layouts', () => {
|
||||
const { schema } = require('@kbn/config-schema');
|
||||
return {
|
||||
Layouts: {
|
||||
configSchema: schema.object({ kind: schema.literal('mock') }),
|
||||
create: mockCreateLayout,
|
||||
},
|
||||
};
|
||||
});
|
||||
import { mockCreateLayout } from './appenders.test.mocks';
|
||||
|
||||
import { LegacyAppender } from '../../legacy/logging/appenders/legacy_appender';
|
||||
import { Appenders } from './appenders';
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
jest.mock('../../layouts/layouts', () => {
|
||||
const { schema } = require('@kbn/config-schema');
|
||||
return {
|
||||
Layouts: {
|
||||
configSchema: schema.object({
|
||||
kind: schema.literal('mock'),
|
||||
}),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const mockCreateWriteStream = jest.fn();
|
||||
jest.mock('fs', () => ({ createWriteStream: mockCreateWriteStream }));
|
|
@ -17,19 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
jest.mock('../../layouts/layouts', () => {
|
||||
const { schema } = require('@kbn/config-schema');
|
||||
return {
|
||||
Layouts: {
|
||||
configSchema: schema.object({
|
||||
kind: schema.literal('mock'),
|
||||
}),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const mockCreateWriteStream = jest.fn();
|
||||
jest.mock('fs', () => ({ createWriteStream: mockCreateWriteStream }));
|
||||
import { mockCreateWriteStream } from './file_appender.test.mocks';
|
||||
|
||||
import { LogLevel } from '../../log_level';
|
||||
import { LogRecord } from '../../log_record';
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockReaddir = jest.fn();
|
||||
export const mockReadFile = jest.fn();
|
||||
export const mockStat = jest.fn();
|
||||
jest.mock('fs', () => ({
|
||||
readdir: mockReaddir,
|
||||
readFile: mockReadFile,
|
||||
stat: mockStat,
|
||||
}));
|
||||
|
||||
export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../../../package.json', () => mockPackage);
|
|
@ -17,17 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockReaddir = jest.fn();
|
||||
const mockReadFile = jest.fn();
|
||||
const mockStat = jest.fn();
|
||||
jest.mock('fs', () => ({
|
||||
readdir: mockReaddir,
|
||||
readFile: mockReadFile,
|
||||
stat: mockStat,
|
||||
}));
|
||||
|
||||
const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../../../package.json', () => mockPackage);
|
||||
import { mockPackage, mockReaddir, mockReadFile, mockStat } from './plugin_discovery.test.mocks';
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockReadFile = jest.fn();
|
||||
const mockStat = jest.fn();
|
||||
jest.mock('fs', () => ({ readFile: mockReadFile, stat: mockStat }));
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
import { PluginDiscoveryErrorType } from './plugin_discovery_error';
|
||||
|
||||
const mockReadFile = jest.fn();
|
||||
const mockStat = jest.fn();
|
||||
jest.mock('fs', () => ({ readFile: mockReadFile, stat: mockStat }));
|
||||
import { mockReadFile } from './plugin_manifest_parser.test.mocks';
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { parseManifest } from './plugin_manifest_parser';
|
||||
|
|
|
@ -30,15 +30,15 @@ import { createPluginInitializerContext, createPluginSetupContext } from './plug
|
|||
|
||||
const mockPluginInitializer = jest.fn();
|
||||
const logger = loggingServiceMock.create();
|
||||
jest.mock(
|
||||
jest.doMock(
|
||||
join('plugin-with-initializer-path', 'server'),
|
||||
() => ({ plugin: mockPluginInitializer }),
|
||||
{ virtual: true }
|
||||
);
|
||||
jest.mock(join('plugin-without-initializer-path', 'server'), () => ({}), {
|
||||
jest.doMock(join('plugin-without-initializer-path', 'server'), () => ({}), {
|
||||
virtual: true,
|
||||
});
|
||||
jest.mock(join('plugin-with-wrong-initializer-path', 'server'), () => ({ plugin: {} }), {
|
||||
jest.doMock(join('plugin-with-wrong-initializer-path', 'server'), () => ({ plugin: {} }), {
|
||||
virtual: true,
|
||||
});
|
||||
|
||||
|
|
26
src/core/server/plugins/plugins_service.test.mocks.ts
Normal file
26
src/core/server/plugins/plugins_service.test.mocks.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../legacy/utils/package_json', () => ({ pkg: mockPackage }));
|
||||
|
||||
export const mockDiscover = jest.fn();
|
||||
jest.mock('./discovery/plugins_discovery', () => ({ discover: mockDiscover }));
|
||||
|
||||
jest.mock('./plugins_system');
|
|
@ -17,13 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||
jest.mock('../../../legacy/utils/package_json', () => ({ pkg: mockPackage }));
|
||||
|
||||
const mockDiscover = jest.fn();
|
||||
jest.mock('./discovery/plugins_discovery', () => ({ discover: mockDiscover }));
|
||||
|
||||
jest.mock('./plugins_system');
|
||||
import { mockDiscover, mockPackage } from './plugins_service.test.mocks';
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { BehaviorSubject, from } from 'rxjs';
|
||||
|
|
23
src/core/server/plugins/plugins_system.test.mocks.ts
Normal file
23
src/core/server/plugins/plugins_system.test.mocks.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockCreatePluginSetupContext = jest.fn();
|
||||
jest.mock('./plugin_context', () => ({
|
||||
createPluginSetupContext: mockCreatePluginSetupContext,
|
||||
}));
|
|
@ -17,16 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { CoreContext } from '../core_context';
|
||||
|
||||
const mockCreatePluginSetupContext = jest.fn();
|
||||
jest.mock('./plugin_context', () => ({
|
||||
createPluginSetupContext: mockCreatePluginSetupContext,
|
||||
}));
|
||||
import { mockCreatePluginSetupContext } from './plugins_system.test.mocks';
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { Config, ConfigService, Env, ObjectToConfigAdapter } from '../config';
|
||||
import { getEnvOptions } from '../config/__mocks__/env';
|
||||
import { CoreContext } from '../core_context';
|
||||
import { elasticsearchServiceMock } from '../elasticsearch/elasticsearch_service.mock';
|
||||
import { loggingServiceMock } from '../logging/logging_service.mock';
|
||||
import { Plugin, PluginName } from './plugin';
|
||||
|
|
33
src/core/server/root/index.test.mocks.ts
Normal file
33
src/core/server/root/index.test.mocks.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { loggingServiceMock } from '../logging/logging_service.mock';
|
||||
export const logger = loggingServiceMock.create();
|
||||
jest.doMock('../logging', () => ({
|
||||
LoggingService: jest.fn(() => logger),
|
||||
}));
|
||||
|
||||
import { configServiceMock } from '../config/config_service.mock';
|
||||
export const configService = configServiceMock.create();
|
||||
jest.doMock('../config/config_service', () => ({
|
||||
ConfigService: jest.fn(() => configService),
|
||||
}));
|
||||
|
||||
export const mockServer = { setup: jest.fn(), stop: jest.fn() };
|
||||
jest.mock('../server', () => ({ Server: jest.fn(() => mockServer) }));
|
|
@ -17,20 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { loggingServiceMock } from '../logging/logging_service.mock';
|
||||
const logger = loggingServiceMock.create();
|
||||
jest.mock('../logging', () => ({
|
||||
LoggingService: jest.fn(() => logger),
|
||||
}));
|
||||
|
||||
import { configServiceMock } from '../config/config_service.mock';
|
||||
const configService = configServiceMock.create();
|
||||
jest.mock('../config/config_service', () => ({
|
||||
ConfigService: jest.fn(() => configService),
|
||||
}));
|
||||
|
||||
const mockServer = { setup: jest.fn(), stop: jest.fn() };
|
||||
jest.mock('../server', () => ({ Server: jest.fn(() => mockServer) }));
|
||||
import { configService, logger, mockServer } from './index.test.mocks';
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { filter, first } from 'rxjs/operators';
|
||||
|
|
|
@ -16,27 +16,13 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { httpServiceMock } from './http/http_service.mock';
|
||||
const httpService = httpServiceMock.create();
|
||||
jest.mock('./http/http_service', () => ({
|
||||
HttpService: jest.fn(() => httpService),
|
||||
}));
|
||||
|
||||
const mockPluginsService = { setup: jest.fn(), stop: jest.fn() };
|
||||
jest.mock('./plugins/plugins_service', () => ({
|
||||
PluginsService: jest.fn(() => mockPluginsService),
|
||||
}));
|
||||
|
||||
import { elasticsearchServiceMock } from './elasticsearch/elasticsearch_service.mock';
|
||||
const elasticsearchService = elasticsearchServiceMock.create();
|
||||
jest.mock('./elasticsearch/elasticsearch_service', () => ({
|
||||
ElasticsearchService: jest.fn(() => elasticsearchService),
|
||||
}));
|
||||
|
||||
const mockLegacyService = { setup: jest.fn(), stop: jest.fn() };
|
||||
jest.mock('./legacy/legacy_service', () => ({
|
||||
LegacyService: jest.fn(() => mockLegacyService),
|
||||
}));
|
||||
import {
|
||||
elasticsearchService,
|
||||
httpService,
|
||||
mockLegacyService,
|
||||
mockPluginsService,
|
||||
} from './index.test.mocks';
|
||||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { Env } from './config';
|
||||
|
|
|
@ -47,8 +47,8 @@ import {
|
|||
RemovePackageJsonDepsTask,
|
||||
RemoveWorkspacesTask,
|
||||
TranspileBabelTask,
|
||||
TranspileTypescriptTask,
|
||||
TranspileScssTask,
|
||||
TypecheckTypescriptTask,
|
||||
UpdateLicenseFileTask,
|
||||
VerifyEnvTask,
|
||||
VerifyExistingNodeBuildsTask,
|
||||
|
@ -107,15 +107,14 @@ export async function buildDistributables(options) {
|
|||
* run platform-generic build tasks
|
||||
*/
|
||||
await run(CopySourceTask);
|
||||
await run(TypecheckTypescriptTask);
|
||||
await run(CreateEmptyDirsAndFilesTask);
|
||||
await run(CreateReadmeTask);
|
||||
await run(TranspileBabelTask);
|
||||
await run(TranspileTypescriptTask);
|
||||
await run(BuildPackagesTask);
|
||||
await run(CreatePackageJsonTask);
|
||||
await run(InstallDependenciesTask);
|
||||
await run(RemoveWorkspacesTask);
|
||||
await run(CleanTypescriptTask);
|
||||
await run(CleanPackagesTask);
|
||||
await run(CreateNoticeFileTask);
|
||||
await run(UpdateLicenseFileTask);
|
||||
|
@ -123,6 +122,7 @@ export async function buildDistributables(options) {
|
|||
await run(TranspileScssTask);
|
||||
await run(OptimizeBuildTask);
|
||||
await run(CleanClientModulesOnDLLTask);
|
||||
await run(CleanTypescriptTask);
|
||||
await run(CleanExtraFilesFromModulesTask);
|
||||
await run(CleanEmptyFoldersTask);
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ export const CopySourceTask = {
|
|||
select: [
|
||||
'yarn.lock',
|
||||
'src/**',
|
||||
'!src/**/*.test.{js,ts,tsx}',
|
||||
'!src/**/*.{test,test.mocks,mock}.{js,ts,tsx}',
|
||||
'!src/**/mocks.ts', // special file who imports .mock files
|
||||
'!src/**/{__tests__,__snapshots__}/**',
|
||||
'!src/test_utils/**',
|
||||
'!src/fixtures/**',
|
||||
|
|
|
@ -33,7 +33,7 @@ export * from './notice_file_task';
|
|||
export * from './optimize_task';
|
||||
export * from './os_packages';
|
||||
export * from './transpile_babel_task';
|
||||
export * from './transpile_typescript_task';
|
||||
export * from './typecheck_typescript_task';
|
||||
export * from './transpile_scss_task';
|
||||
export * from './verify_env_task';
|
||||
export * from './write_sha_sums_task';
|
||||
|
|
|
@ -22,31 +22,59 @@ import vfs from 'vinyl-fs';
|
|||
|
||||
import { createPromiseFromStreams } from '../../../legacy/utils';
|
||||
|
||||
const transpileWithBabel = async (srcGlobs, build, presets) => {
|
||||
const buildRoot = build.resolvePath();
|
||||
|
||||
await createPromiseFromStreams([
|
||||
vfs.src(
|
||||
srcGlobs.concat([
|
||||
'!**/*.d.ts',
|
||||
'!packages/**',
|
||||
'!**/node_modules/**',
|
||||
'!**/bower_components/**',
|
||||
'!**/__tests__/**',
|
||||
]),
|
||||
{
|
||||
cwd: buildRoot,
|
||||
}
|
||||
),
|
||||
|
||||
gulpBabel({
|
||||
babelrc: false,
|
||||
presets,
|
||||
}),
|
||||
|
||||
vfs.dest(buildRoot),
|
||||
]);
|
||||
};
|
||||
|
||||
export const TranspileBabelTask = {
|
||||
description: 'Transpiling sources with babel',
|
||||
|
||||
async run(config, log, build) {
|
||||
await createPromiseFromStreams([
|
||||
vfs.src(
|
||||
[
|
||||
'**/*.js',
|
||||
'!packages/**',
|
||||
'!**/public/**',
|
||||
'!**/node_modules/**',
|
||||
'!**/bower_components/**',
|
||||
'!**/__tests__/**',
|
||||
],
|
||||
{
|
||||
cwd: build.resolvePath(),
|
||||
}
|
||||
),
|
||||
// Transpile server code
|
||||
await transpileWithBabel(
|
||||
[
|
||||
'**/*.{js,ts,tsx}',
|
||||
'!**/public/**',
|
||||
],
|
||||
build,
|
||||
[
|
||||
require.resolve('@kbn/babel-preset/node_preset')
|
||||
]
|
||||
);
|
||||
|
||||
gulpBabel({
|
||||
babelrc: false,
|
||||
presets: [require.resolve('@kbn/babel-preset/node_preset')],
|
||||
}),
|
||||
|
||||
vfs.dest(build.resolvePath()),
|
||||
]);
|
||||
// Transpile client code
|
||||
// NOTE: For the client, as we have the optimizer, we are only
|
||||
// pre-transpiling the typescript based files
|
||||
await transpileWithBabel(
|
||||
[
|
||||
'**/public/**/*.{ts,tsx}',
|
||||
],
|
||||
build,
|
||||
[
|
||||
require.resolve('@kbn/babel-preset/webpack_preset')
|
||||
]
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -20,22 +20,13 @@
|
|||
import { exec, write } from '../lib';
|
||||
import { Project } from '../../typescript';
|
||||
|
||||
export const TranspileTypescriptTask = {
|
||||
description: 'Transpiling sources with typescript compiler',
|
||||
export const TypecheckTypescriptTask = {
|
||||
description: 'Typechecking sources with typescript compiler',
|
||||
|
||||
async run(config, log, build) {
|
||||
// these projects are built in the build folder
|
||||
const defaultProject = new Project(build.resolvePath('tsconfig.json'));
|
||||
const browserProject = new Project(build.resolvePath('tsconfig.browser.json'));
|
||||
|
||||
// update the default config to exclude **/public/**/* files
|
||||
await write(defaultProject.tsConfigPath, JSON.stringify({
|
||||
...defaultProject.config,
|
||||
exclude: [
|
||||
...defaultProject.config.exclude,
|
||||
'src/**/public/**/*'
|
||||
]
|
||||
}));
|
||||
const defaultProject = new Project(build.resolvePath('tsconfig.json'));
|
||||
|
||||
// update the browser config file to include **/public/**/* files
|
||||
await write(browserProject.tsConfigPath, JSON.stringify({
|
||||
|
@ -47,21 +38,28 @@ export const TranspileTypescriptTask = {
|
|||
]
|
||||
}));
|
||||
|
||||
// update the default config to exclude **/public/**/* files
|
||||
await write(defaultProject.tsConfigPath, JSON.stringify({
|
||||
...defaultProject.config,
|
||||
exclude: [
|
||||
...defaultProject.config.exclude,
|
||||
'src/**/public/**/*'
|
||||
]
|
||||
}));
|
||||
|
||||
const projects = [
|
||||
// Browser needs to be compiled before server code so that any shared code
|
||||
// is compiled to the lowest common denominator (server's CommonJS format)
|
||||
// which can be supported by both environments.
|
||||
browserProject.tsConfigPath,
|
||||
defaultProject.tsConfigPath,
|
||||
];
|
||||
|
||||
// compile each typescript config file
|
||||
for (const tsConfigPath of projects) {
|
||||
log.info(`Compiling`, tsConfigPath, 'project');
|
||||
log.info(`Typechecking`, tsConfigPath, 'project');
|
||||
await exec(
|
||||
log,
|
||||
require.resolve('typescript/bin/tsc'),
|
||||
[
|
||||
'--noEmit',
|
||||
'--pretty', 'true',
|
||||
'--project', tsConfigPath,
|
||||
],
|
27
src/dev/i18n/integrate_locale_files.test.mocks.ts
Normal file
27
src/dev/i18n/integrate_locale_files.test.mocks.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const mockWriteFileAsync = jest.fn();
|
||||
export const mockMakeDirAsync = jest.fn();
|
||||
jest.mock('./utils', () => ({
|
||||
// Jest typings don't define `requireActual` for some reason.
|
||||
...(jest as any).requireActual('./utils'),
|
||||
writeFileAsync: mockWriteFileAsync,
|
||||
makeDirAsync: mockMakeDirAsync,
|
||||
}));
|
|
@ -17,14 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const mockWriteFileAsync = jest.fn();
|
||||
const mockMakeDirAsync = jest.fn();
|
||||
jest.mock('./utils', () => ({
|
||||
// Jest typings don't define `requireActual` for some reason.
|
||||
...(jest as any).requireActual('./utils'),
|
||||
writeFileAsync: mockWriteFileAsync,
|
||||
makeDirAsync: mockMakeDirAsync,
|
||||
}));
|
||||
import { mockMakeDirAsync, mockWriteFileAsync } from './integrate_locale_files.test.mocks';
|
||||
|
||||
import path from 'path';
|
||||
import { integrateLocaleFiles, verifyMessages } from './integrate_locale_files';
|
||||
|
|
|
@ -22,5 +22,5 @@ const babelJest = require('babel-jest');
|
|||
module.exports = babelJest.createTransformer({
|
||||
presets: [
|
||||
require.resolve('@kbn/babel-preset/node_preset')
|
||||
]
|
||||
],
|
||||
});
|
||||
|
|
|
@ -59,11 +59,6 @@ export default {
|
|||
coverageReporters: [
|
||||
'html',
|
||||
],
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
skipBabel: true,
|
||||
},
|
||||
},
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'json',
|
||||
|
@ -83,8 +78,7 @@ export default {
|
|||
'integration_tests/'
|
||||
],
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/src/dev/jest/babel_transform.js',
|
||||
'^.+\\.tsx?$': '<rootDir>/src/dev/jest/ts_transform.js',
|
||||
'^.+\\.(js|tsx?)$': '<rootDir>/src/dev/jest/babel_transform.js',
|
||||
'^.+\\.txt?$': 'jest-raw-loader',
|
||||
'^.+\\.html?$': 'jest-raw-loader',
|
||||
},
|
||||
|
|
|
@ -18,6 +18,6 @@
|
|||
*/
|
||||
|
||||
// Note: In theory importing the polyfill should not be needed, as Babel should
|
||||
// include the necessary polyfills when using `babel-preset-env`, but for some
|
||||
// include the necessary polyfills when using `@babel/preset-env`, but for some
|
||||
// reason it did not work. See https://github.com/elastic/kibana/issues/14506
|
||||
import '../../../setup_node_env/babel_register/polyfill';
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import TsJest from 'ts-jest';
|
||||
|
||||
import { getTsProjectForAbsolutePath } from '../typescript';
|
||||
|
||||
const DEFAULT_TS_CONFIG_PATH = require.resolve('../../../tsconfig.json');
|
||||
const DEFAULT_BROWSER_TS_CONFIG_PATH = require.resolve('../../../tsconfig.browser.json');
|
||||
|
||||
function extendJestConfigJSON(jestConfigJSON: string, filePath: string) {
|
||||
const jestConfig = JSON.parse(jestConfigJSON) as jest.ProjectConfig;
|
||||
return JSON.stringify(extendJestConfig(jestConfig, filePath));
|
||||
}
|
||||
|
||||
function extendJestConfig(jestConfig: jest.ProjectConfig, filePath: string) {
|
||||
let tsConfigFile = getTsProjectForAbsolutePath(filePath).tsConfigPath;
|
||||
|
||||
// swap ts config file for jest tests
|
||||
if (tsConfigFile === DEFAULT_BROWSER_TS_CONFIG_PATH) {
|
||||
tsConfigFile = DEFAULT_TS_CONFIG_PATH;
|
||||
}
|
||||
|
||||
return {
|
||||
...jestConfig,
|
||||
globals: {
|
||||
...(jestConfig.globals || {}),
|
||||
'ts-jest': {
|
||||
skipBabel: true,
|
||||
tsConfigFile,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
canInstrument: true,
|
||||
|
||||
process(
|
||||
src: string,
|
||||
filePath: jest.Path,
|
||||
jestConfig: jest.ProjectConfig,
|
||||
transformOptions: jest.TransformOptions
|
||||
) {
|
||||
const extendedConfig = extendJestConfig(jestConfig, filePath);
|
||||
return TsJest.process(src, filePath, extendedConfig, transformOptions);
|
||||
},
|
||||
|
||||
getCacheKey(
|
||||
src: string,
|
||||
filePath: string,
|
||||
jestConfigJSON: string,
|
||||
transformOptions: jest.TransformOptions
|
||||
) {
|
||||
const extendedConfigJSON = extendJestConfigJSON(jestConfigJSON, filePath);
|
||||
return TsJest.getCacheKey!(src, filePath, extendedConfigJSON, transformOptions);
|
||||
},
|
||||
};
|
|
@ -105,5 +105,5 @@ export const LICENSE_OVERRIDES = {
|
|||
'walk@2.3.9': ['MIT'],
|
||||
|
||||
// TODO remove this once we upgrade past or equal to v1.0.2
|
||||
'babel-plugin-mock-imports@0.0.5': ['MIT']
|
||||
'babel-plugin-mock-imports@1.0.1': ['MIT']
|
||||
};
|
||||
|
|
|
@ -43,7 +43,7 @@ export function runMochaCli() {
|
|||
// check that we aren't leaking any globals
|
||||
process.argv.push('--check-leaks');
|
||||
// prevent globals injected from canvas plugins from triggering leak check
|
||||
process.argv.push('--globals', 'core,regeneratorRuntime,_');
|
||||
process.argv.push('--globals', '__core-js_shared__,core,_, ');
|
||||
|
||||
// ensure that mocha requires the setup_node_env script
|
||||
process.argv.push('--require', require.resolve('../../setup_node_env'));
|
||||
|
|
|
@ -222,6 +222,8 @@ exports[`Inspector Data View component should render loading state 1`] = `
|
|||
},
|
||||
"_eventsCount": 1,
|
||||
"_maxListeners": undefined,
|
||||
"tabular": undefined,
|
||||
"tabularOptions": undefined,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import 'babel-polyfill';
|
||||
import '@babel/polyfill';
|
||||
import { typeSpecs } from './index';
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
|
|
|
@ -1125,10 +1125,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
|
|||
className="euiScreenReaderOnly"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="{resultCount} {resultCount, plural,
|
||||
one {type}
|
||||
other {types}
|
||||
} found"
|
||||
defaultMessage="{resultCount} {resultCount, plural, one {type} other {types} } found"
|
||||
id="kbn.visualize.newVisWizard.resultsFound"
|
||||
values={
|
||||
Object {
|
||||
|
@ -1188,7 +1185,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
|
|||
<div
|
||||
className="euiKeyPadMenuItem__icon"
|
||||
>
|
||||
<Component
|
||||
<VisTypeIcon
|
||||
visType={
|
||||
Object {
|
||||
"hidden": false,
|
||||
|
@ -1231,7 +1228,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
|
|||
/>
|
||||
</empty>
|
||||
</EuiIcon>
|
||||
</Component>
|
||||
</VisTypeIcon>
|
||||
</div>
|
||||
<p
|
||||
className="euiKeyPadMenuItem__label"
|
||||
|
@ -1284,7 +1281,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
|
|||
<div
|
||||
className="euiKeyPadMenuItem__icon"
|
||||
>
|
||||
<Component
|
||||
<VisTypeIcon
|
||||
visType={
|
||||
Object {
|
||||
"hidden": false,
|
||||
|
@ -1327,7 +1324,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
|
|||
/>
|
||||
</empty>
|
||||
</EuiIcon>
|
||||
</Component>
|
||||
</VisTypeIcon>
|
||||
</div>
|
||||
<p
|
||||
className="euiKeyPadMenuItem__label"
|
||||
|
@ -1379,7 +1376,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
|
|||
className="euiSpacer euiSpacer--m"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<Component>
|
||||
<NewVisHelp>
|
||||
<EuiText
|
||||
grow={true}
|
||||
size="m"
|
||||
|
@ -1398,7 +1395,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`
|
|||
</p>
|
||||
</div>
|
||||
</EuiText>
|
||||
</Component>
|
||||
</NewVisHelp>
|
||||
</div>
|
||||
</EuiFlexItem>
|
||||
</div>
|
||||
|
@ -2595,7 +2592,7 @@ exports[`NewVisModal should render as expected 1`] = `
|
|||
<div
|
||||
className="euiKeyPadMenuItem__icon"
|
||||
>
|
||||
<Component
|
||||
<VisTypeIcon
|
||||
visType={
|
||||
Object {
|
||||
"hidden": false,
|
||||
|
@ -2638,7 +2635,7 @@ exports[`NewVisModal should render as expected 1`] = `
|
|||
/>
|
||||
</empty>
|
||||
</EuiIcon>
|
||||
</Component>
|
||||
</VisTypeIcon>
|
||||
</div>
|
||||
<p
|
||||
className="euiKeyPadMenuItem__label"
|
||||
|
@ -2691,7 +2688,7 @@ exports[`NewVisModal should render as expected 1`] = `
|
|||
<div
|
||||
className="euiKeyPadMenuItem__icon"
|
||||
>
|
||||
<Component
|
||||
<VisTypeIcon
|
||||
visType={
|
||||
Object {
|
||||
"hidden": false,
|
||||
|
@ -2734,7 +2731,7 @@ exports[`NewVisModal should render as expected 1`] = `
|
|||
/>
|
||||
</empty>
|
||||
</EuiIcon>
|
||||
</Component>
|
||||
</VisTypeIcon>
|
||||
</div>
|
||||
<p
|
||||
className="euiKeyPadMenuItem__label"
|
||||
|
@ -2786,7 +2783,7 @@ exports[`NewVisModal should render as expected 1`] = `
|
|||
className="euiSpacer euiSpacer--m"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<Component>
|
||||
<NewVisHelp>
|
||||
<EuiText
|
||||
grow={true}
|
||||
size="m"
|
||||
|
@ -2805,7 +2802,7 @@ exports[`NewVisModal should render as expected 1`] = `
|
|||
</p>
|
||||
</div>
|
||||
</EuiText>
|
||||
</Component>
|
||||
</NewVisHelp>
|
||||
</div>
|
||||
</EuiFlexItem>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const settingsGet = jest.fn();
|
||||
|
||||
jest.doMock('ui/chrome', () => ({
|
||||
getUiSettingsClient: () => ({
|
||||
get: settingsGet,
|
||||
}),
|
||||
}));
|
|
@ -20,13 +20,7 @@
|
|||
import React from 'react';
|
||||
import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
||||
|
||||
const settingsGet = jest.fn();
|
||||
|
||||
jest.mock('ui/chrome', () => ({
|
||||
getUiSettingsClient: () => ({
|
||||
get: settingsGet,
|
||||
}),
|
||||
}));
|
||||
import { settingsGet } from './new_vis_modal.test.mocks';
|
||||
|
||||
import { NewVisModal } from './new_vis_modal';
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ export const createTestEntryTemplate = (defaultUiSettings) => (bundle) => `
|
|||
*/
|
||||
|
||||
// import global polyfills before everything else
|
||||
import 'babel-polyfill';
|
||||
import '@babel/polyfill';
|
||||
import 'custom-event-polyfill';
|
||||
import 'whatwg-fetch';
|
||||
import 'abortcontroller-polyfill';
|
||||
|
|
|
@ -14,7 +14,7 @@ exports[`ScriptingHelpFlyout should render normally 1`] = `
|
|||
<EuiTabbedContent
|
||||
initialSelectedTab={
|
||||
Object {
|
||||
"content": <Unknown />,
|
||||
"content": <ScriptingSyntax />,
|
||||
"data-test-subj": "syntaxTab",
|
||||
"id": "syntax",
|
||||
"name": "Syntax",
|
||||
|
@ -23,7 +23,7 @@ exports[`ScriptingHelpFlyout should render normally 1`] = `
|
|||
tabs={
|
||||
Array [
|
||||
Object {
|
||||
"content": <Unknown />,
|
||||
"content": <ScriptingSyntax />,
|
||||
"data-test-subj": "syntaxTab",
|
||||
"id": "syntax",
|
||||
"name": "Syntax",
|
||||
|
|
|
@ -47,9 +47,7 @@ exports[`LanguageSwitcher should toggle off if language is lucene 1`] = `
|
|||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="The {docsLink} (KQL) offers a simplified query
|
||||
syntax and support for scripted fields. KQL also provides autocomplete if you have
|
||||
a Basic license or above. If you turn off KQL, Kibana uses Lucene."
|
||||
defaultMessage="The {docsLink} (KQL) offers a simplified query syntax and support for scripted fields. KQL also provides autocomplete if you have a Basic license or above. If you turn off KQL, Kibana uses Lucene."
|
||||
id="common.ui.queryBar.syntaxOptionsDescription"
|
||||
values={
|
||||
Object {
|
||||
|
@ -154,9 +152,7 @@ exports[`LanguageSwitcher should toggle on if language is kuery 1`] = `
|
|||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="The {docsLink} (KQL) offers a simplified query
|
||||
syntax and support for scripted fields. KQL also provides autocomplete if you have
|
||||
a Basic license or above. If you turn off KQL, Kibana uses Lucene."
|
||||
defaultMessage="The {docsLink} (KQL) offers a simplified query syntax and support for scripted fields. KQL also provides autocomplete if you have a Basic license or above. If you turn off KQL, Kibana uses Lucene."
|
||||
id="common.ui.queryBar.syntaxOptionsDescription"
|
||||
values={
|
||||
Object {
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const mockChromeFactory = jest.fn(() => {
|
||||
return {
|
||||
getBasePath: () => `foo`,
|
||||
getUiSettingsClient: () => {
|
||||
return {
|
||||
get: (key: string) => {
|
||||
switch (key) {
|
||||
case 'history:limit':
|
||||
return 10;
|
||||
default:
|
||||
throw new Error(`Unexpected config key: ${key}`);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const mockPersistedLog = {
|
||||
add: jest.fn(),
|
||||
get: jest.fn(() => ['response:200']),
|
||||
};
|
||||
|
||||
export const mockPersistedLogFactory = jest.fn<jest.Mocked<typeof mockPersistedLog>, any>(() => {
|
||||
return mockPersistedLog;
|
||||
});
|
||||
|
||||
export const mockGetAutocompleteSuggestions = jest.fn(() => Promise.resolve([]));
|
||||
const mockAutocompleteProvider = jest.fn(() => mockGetAutocompleteSuggestions);
|
||||
export const mockGetAutocompleteProvider = jest.fn(() => mockAutocompleteProvider);
|
||||
|
||||
jest.mock('ui/chrome', () => mockChromeFactory());
|
||||
jest.mock('../../chrome', () => mockChromeFactory());
|
||||
jest.mock('ui/persisted_log', () => ({
|
||||
PersistedLog: mockPersistedLogFactory,
|
||||
}));
|
||||
jest.mock('../../metadata', () => ({
|
||||
metadata: {
|
||||
branch: 'foo',
|
||||
},
|
||||
}));
|
||||
jest.mock('../../autocomplete_providers', () => ({
|
||||
getAutocompleteProvider: mockGetAutocompleteProvider,
|
||||
}));
|
||||
|
||||
import _ from 'lodash';
|
||||
// Using doMock to avoid hoisting so that I can override only the debounce method in lodash
|
||||
jest.doMock('lodash', () => ({
|
||||
..._,
|
||||
debounce: (func: () => any) => func,
|
||||
}));
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue