mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Cleanup tsconfig files (#84396)
* remove unused "paths" from tsconfig * remove unused test utils, import get-url from kbn/test * dont pollute globals with jest when importing getUrl Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
614c85828d
commit
1ec2f1d078
19 changed files with 10 additions and 291 deletions
|
@ -48,7 +48,6 @@ module.exports = {
|
|||
'^(!!)?file-loader!': '<rootDir>/packages/kbn-test/target/jest/mocks/file_mock.js',
|
||||
'^fixtures/(.*)': '<rootDir>/src/fixtures/$1',
|
||||
'^src/core/(.*)': '<rootDir>/src/core/$1',
|
||||
'^src/legacy/(.*)': '<rootDir>/src/legacy/$1',
|
||||
'^src/plugins/(.*)': '<rootDir>/src/plugins/$1',
|
||||
},
|
||||
|
||||
|
|
|
@ -58,3 +58,5 @@ export { runFailedTestsReporterCli } from './failed_tests_reporter';
|
|||
export { CI_PARALLEL_PROCESS_PREFIX } from './ci_parallel_process_prefix';
|
||||
|
||||
export * from './functional_test_runner';
|
||||
|
||||
export { getUrl } from './jest/utils/get_url';
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
export * from './enzyme_helpers';
|
||||
|
||||
export * from './get_url';
|
||||
|
||||
export * from './find_test_subject';
|
||||
|
||||
export * from './jsdom_svg_mocks';
|
||||
|
|
|
@ -14,8 +14,5 @@
|
|||
"test_helpers/**/*",
|
||||
"utils/**/*",
|
||||
"index.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../test_utils/" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ export default {
|
|||
'<rootDir>/src/legacy/utils',
|
||||
'<rootDir>/src/setup_node_env',
|
||||
'<rootDir>/packages',
|
||||
'<rootDir>/src/test_utils',
|
||||
'<rootDir>/test/functional/services/remote',
|
||||
'<rootDir>/src/dev/code_coverage/ingest_coverage',
|
||||
],
|
||||
|
|
|
@ -27,7 +27,6 @@ export const PROJECTS = [
|
|||
new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), { name: 'kibana/test' }),
|
||||
new Project(resolve(REPO_ROOT, 'x-pack/tsconfig.json')),
|
||||
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),
|
||||
new Project(resolve(REPO_ROOT, 'src/test_utils/tsconfig.json')),
|
||||
new Project(resolve(REPO_ROOT, 'src/core/tsconfig.json')),
|
||||
new Project(resolve(REPO_ROOT, 'x-pack/plugins/security_solution/cypress/tsconfig.json'), {
|
||||
name: 'security_solution/cypress',
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
"../../../typings/**/*"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../../test_utils/tsconfig.json" },
|
||||
{ "path": "../../core/tsconfig.json" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,67 +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 expect from '@kbn/expect';
|
||||
import getUrl from '../get_url';
|
||||
|
||||
describe('getUrl', function () {
|
||||
it('should convert to a url', function () {
|
||||
const url = getUrl(
|
||||
{
|
||||
protocol: 'http',
|
||||
hostname: 'localhost',
|
||||
},
|
||||
{
|
||||
pathname: 'foo',
|
||||
}
|
||||
);
|
||||
|
||||
expect(url).to.be('http://localhost/foo');
|
||||
});
|
||||
|
||||
it('should convert to a url with port', function () {
|
||||
const url = getUrl(
|
||||
{
|
||||
protocol: 'http',
|
||||
hostname: 'localhost',
|
||||
port: 9220,
|
||||
},
|
||||
{
|
||||
pathname: 'foo',
|
||||
}
|
||||
);
|
||||
|
||||
expect(url).to.be('http://localhost:9220/foo');
|
||||
});
|
||||
|
||||
it('should convert to a secure hashed url', function () {
|
||||
expect(
|
||||
getUrl(
|
||||
{
|
||||
protocol: 'https',
|
||||
hostname: 'localhost',
|
||||
},
|
||||
{
|
||||
pathname: 'foo',
|
||||
hash: 'bar',
|
||||
}
|
||||
)
|
||||
).to.be('https://localhost/foo#bar');
|
||||
});
|
||||
});
|
|
@ -1,55 +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 _ from 'lodash';
|
||||
import url from 'url';
|
||||
|
||||
/**
|
||||
* Converts a config and a pathname to a url
|
||||
* @param {object} config A url config
|
||||
* example:
|
||||
* {
|
||||
* protocol: 'http',
|
||||
* hostname: 'localhost',
|
||||
* port: 9220,
|
||||
* auth: kibanaTestUser.username + ':' + kibanaTestUser.password
|
||||
* }
|
||||
* @param {object} app The params to append
|
||||
* example:
|
||||
* {
|
||||
* pathname: 'app/kibana',
|
||||
* hash: '/discover'
|
||||
* }
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
export default function getUrl(config, app) {
|
||||
return url.format(_.assign({}, config, app));
|
||||
}
|
||||
|
||||
getUrl.noAuth = function getUrlNoAuth(config, app) {
|
||||
config = _.pickBy(config, function (val, param) {
|
||||
return param !== 'auth';
|
||||
});
|
||||
return getUrl(config, app);
|
||||
};
|
||||
|
||||
getUrl.baseUrl = function getBaseUrl(config) {
|
||||
return url.format(_.pick(config, 'protocol', 'hostname', 'port'));
|
||||
};
|
|
@ -1,121 +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.
|
||||
*/
|
||||
|
||||
export const keyMap: { [key: number]: string } = {
|
||||
8: 'backspace',
|
||||
9: 'tab',
|
||||
13: 'enter',
|
||||
16: 'shift',
|
||||
17: 'ctrl',
|
||||
18: 'alt',
|
||||
19: 'pause',
|
||||
20: 'capsLock',
|
||||
27: 'escape',
|
||||
32: 'space',
|
||||
33: 'pageUp',
|
||||
34: 'pageDown',
|
||||
35: 'end',
|
||||
36: 'home',
|
||||
37: 'left',
|
||||
38: 'up',
|
||||
39: 'right',
|
||||
40: 'down',
|
||||
45: 'insert',
|
||||
46: 'delete',
|
||||
48: '0',
|
||||
49: '1',
|
||||
50: '2',
|
||||
51: '3',
|
||||
52: '4',
|
||||
53: '5',
|
||||
54: '6',
|
||||
55: '7',
|
||||
56: '8',
|
||||
57: '9',
|
||||
65: 'a',
|
||||
66: 'b',
|
||||
67: 'c',
|
||||
68: 'd',
|
||||
69: 'e',
|
||||
70: 'f',
|
||||
71: 'g',
|
||||
72: 'h',
|
||||
73: 'i',
|
||||
74: 'j',
|
||||
75: 'k',
|
||||
76: 'l',
|
||||
77: 'm',
|
||||
78: 'n',
|
||||
79: 'o',
|
||||
80: 'p',
|
||||
81: 'q',
|
||||
82: 'r',
|
||||
83: 's',
|
||||
84: 't',
|
||||
85: 'u',
|
||||
86: 'v',
|
||||
87: 'w',
|
||||
88: 'x',
|
||||
89: 'y',
|
||||
90: 'z',
|
||||
91: 'leftWindowKey',
|
||||
92: 'rightWindowKey',
|
||||
93: 'selectKey',
|
||||
96: '0',
|
||||
97: '1',
|
||||
98: '2',
|
||||
99: '3',
|
||||
100: '4',
|
||||
101: '5',
|
||||
102: '6',
|
||||
103: '7',
|
||||
104: '8',
|
||||
105: '9',
|
||||
106: 'multiply',
|
||||
107: 'add',
|
||||
109: 'subtract',
|
||||
110: 'period',
|
||||
111: 'divide',
|
||||
112: 'f1',
|
||||
113: 'f2',
|
||||
114: 'f3',
|
||||
115: 'f4',
|
||||
116: 'f5',
|
||||
117: 'f6',
|
||||
118: 'f7',
|
||||
119: 'f8',
|
||||
120: 'f9',
|
||||
121: 'f10',
|
||||
122: 'f11',
|
||||
123: 'f12',
|
||||
144: 'numLock',
|
||||
145: 'scrollLock',
|
||||
186: 'semiColon',
|
||||
187: 'equalSign',
|
||||
188: 'comma',
|
||||
189: 'dash',
|
||||
190: 'period',
|
||||
191: 'forwardSlash',
|
||||
192: 'graveAccent',
|
||||
219: 'openBracket',
|
||||
220: 'backSlash',
|
||||
221: 'closeBracket',
|
||||
222: 'singleQuote',
|
||||
224: 'meta',
|
||||
};
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./target",
|
||||
"composite": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true
|
||||
},
|
||||
"include": [
|
||||
"public/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"target"
|
||||
]
|
||||
}
|
|
@ -19,8 +19,7 @@
|
|||
|
||||
import { get } from 'lodash';
|
||||
import fetch from 'node-fetch';
|
||||
// @ts-ignore not TS yet
|
||||
import getUrl from '../../../src/test_utils/get_url';
|
||||
import { getUrl } from '@kbn/test';
|
||||
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
|
|
|
@ -21,9 +21,8 @@ import { delay } from 'bluebird';
|
|||
import expect from '@kbn/expect';
|
||||
// @ts-ignore
|
||||
import fetch from 'node-fetch';
|
||||
import { getUrl } from '@kbn/test';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
// @ts-ignore not TS yet
|
||||
import getUrl from '../../../src/test_utils/get_url';
|
||||
|
||||
export function CommonPageProvider({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const log = getService('log');
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
*/
|
||||
|
||||
import rison from 'rison-node';
|
||||
import { getUrl } from '@kbn/test';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
// @ts-ignore not TS yet
|
||||
import getUrl from '../../../src/test_utils/get_url';
|
||||
|
||||
const DEFAULT_INITIAL_STATE = {
|
||||
columns: ['@message'],
|
||||
|
|
|
@ -18,11 +18,9 @@
|
|||
*/
|
||||
import Http from 'http';
|
||||
import Url from 'url';
|
||||
import { getUrl } from '@kbn/test';
|
||||
import { FtrProviderContext } from '../../services/types';
|
||||
|
||||
// @ts-ignore
|
||||
import getUrl from '../../../../src/test_utils/get_url';
|
||||
|
||||
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
const oneSec = 1_000;
|
||||
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
"kibana": ["./kibana"],
|
||||
"kibana/public": ["src/core/public"],
|
||||
"kibana/server": ["src/core/server"],
|
||||
"plugins/*": ["src/legacy/core_plugins/*/public/"],
|
||||
"test_utils/*": [
|
||||
"src/test_utils/public/*"
|
||||
],
|
||||
"fixtures/*": ["src/fixtures/*"]
|
||||
},
|
||||
// Support .tsx files and transform JSX into calls to React.createElement
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"compilerOptions": {
|
||||
"incremental": false
|
||||
},
|
||||
"include": ["kibana.d.ts", "src/**/*", "typings/**/*", "test_utils/**/*"],
|
||||
"include": ["kibana.d.ts", "src/**/*", "typings/**/*"],
|
||||
"exclude": [
|
||||
"src/**/__fixtures__/**/*",
|
||||
"src/core/**/*",
|
||||
|
@ -20,7 +20,6 @@
|
|||
"src/plugins/telemetry_collection_manager/**/*",
|
||||
"src/plugins/url_forwarding/**/*",
|
||||
"src/plugins/usage_collection/**/*",
|
||||
"src/test_utils/**/*"
|
||||
// In the build we actually exclude **/public/**/* from this config so that
|
||||
// we can run the TSC on both this and the .browser version of this config
|
||||
// file, but if we did it during development IDEs would not be able to find
|
||||
|
@ -42,6 +41,5 @@
|
|||
{ "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" },
|
||||
{ "path": "./src/plugins/url_forwarding/tsconfig.json" },
|
||||
{ "path": "./src/plugins/usage_collection/tsconfig.json" },
|
||||
{ "path": "./src/test_utils/tsconfig.json" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -15,6 +15,5 @@
|
|||
{ "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" },
|
||||
{ "path": "./src/plugins/url_forwarding/tsconfig.json" },
|
||||
{ "path": "./src/plugins/usage_collection/tsconfig.json" },
|
||||
{ "path": "./src/test_utils/tsconfig.json" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"include": ["mocks.ts", "typings/**/*", "plugins/**/*", "test_utils/**/*", "tasks/**/*"],
|
||||
"include": ["mocks.ts", "typings/**/*", "plugins/**/*", "tasks/**/*"],
|
||||
"exclude": [
|
||||
"plugins/apm/e2e/cypress/**/*",
|
||||
"plugins/apm/scripts/**/*",
|
||||
|
@ -11,12 +11,6 @@
|
|||
"test/**/*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"kibana/public": ["src/core/public"],
|
||||
"kibana/server": ["src/core/server"],
|
||||
"test_utils/*": ["x-pack/test_utils/*"],
|
||||
"fixtures/*": ["src/fixtures/*"]
|
||||
},
|
||||
// overhead is too significant
|
||||
"incremental": false
|
||||
},
|
||||
|
@ -35,7 +29,6 @@
|
|||
{ "path": "../src/plugins/telemetry_collection_manager/tsconfig.json" },
|
||||
{ "path": "../src/plugins/url_forwarding/tsconfig.json" },
|
||||
{ "path": "../src/plugins/usage_collection/tsconfig.json" },
|
||||
{ "path": "../src/test_utils/tsconfig.json" },
|
||||
|
||||
{ "path": "./plugins/global_search/tsconfig.json" },
|
||||
{ "path": "./plugins/licensing/tsconfig.json" },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue