Skip to content

Commit

Permalink
Cleanup tsconfig files (#84396) (#84568)
Browse files Browse the repository at this point in the history
* 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>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
mshustov and kibanamachine authored Nov 30, 2020
1 parent 43c2433 commit 4efd1d9
Show file tree
Hide file tree
Showing 19 changed files with 10 additions and 291 deletions.
1 change: 0 additions & 1 deletion packages/kbn-test/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},

Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 2 additions & 0 deletions packages/kbn-test/src/jest/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

export * from './enzyme_helpers';

export * from './get_url';

export * from './find_test_subject';

export * from './jsdom_svg_mocks';
Expand Down
3 changes: 0 additions & 3 deletions src/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@
"test_helpers/**/*",
"utils/**/*",
"index.ts"
],
"references": [
{ "path": "../test_utils/" }
]
}
1 change: 0 additions & 1 deletion src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
testRunner: 'jasmine2',
Expand Down
1 change: 0 additions & 1 deletion src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion src/plugins/kibana_utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"../../../typings/**/*"
],
"references": [
{ "path": "../../test_utils/tsconfig.json" },
{ "path": "../../core/tsconfig.json" }
]
}
67 changes: 0 additions & 67 deletions src/test_utils/__tests__/get_url.js

This file was deleted.

55 changes: 0 additions & 55 deletions src/test_utils/get_url.js

This file was deleted.

121 changes: 0 additions & 121 deletions src/test_utils/public/key_map.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/test_utils/tsconfig.json

This file was deleted.

3 changes: 1 addition & 2 deletions test/common/services/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
3 changes: 1 addition & 2 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 1 addition & 2 deletions test/functional/page_objects/context_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 1 addition & 3 deletions test/server_integration/http/platform/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 0 additions & 4 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*",
Expand All @@ -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
Expand All @@ -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" }
]
}
Loading

0 comments on commit 4efd1d9

Please sign in to comment.