mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Introduce TS incremental builds & move src/test_utils to TS project (#76082)
* move test_helpers to the core * create base tsconfig * all tsconfigs use the base one * use test_helpers exposed from the src/core * move getFieldFormatsRegistry to data plugin * add test_utils project * compile types after checkout * add a stub for platform tsconfig.json * fix broken import * fix broken path to the base config * set tsBuildInfoFile for project without outDir * do not commit tsbuildinfo file * do not check output d.ts files * fix type error * use separate config to build types * rollback changes to include paths * mute import zone error * rename files to avoid references to tsd * do not use tsd for type tests * include all ts files in project * run buildRefs before type check to ensure the latest version * store tsbuildinfo locally * update paths to base config * comment out core/tsconfig.json * remove ui path * fix wrong tsbuildinfo path
This commit is contained in:
parent
4c5e75e437
commit
e9e0ca3782
117 changed files with 381 additions and 240 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -60,3 +60,6 @@ apm.tsconfig.json
|
||||||
# release notes script output
|
# release notes script output
|
||||||
report.csv
|
report.csv
|
||||||
report.asciidoc
|
report.asciidoc
|
||||||
|
|
||||||
|
# TS incremental build cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target"
|
"outDir": "./target"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
"kbn:watch": "node scripts/kibana --dev --logging.json=false",
|
"kbn:watch": "node scripts/kibana --dev --logging.json=false",
|
||||||
"build:types": "tsc --p tsconfig.types.json",
|
"build:types": "tsc --p tsconfig.types.json",
|
||||||
"docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept",
|
"docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept",
|
||||||
"kbn:bootstrap": "node scripts/register_git_hook",
|
"kbn:bootstrap": "node scripts/build_ts_refs && node scripts/register_git_hook",
|
||||||
"spec_to_console": "node scripts/spec_to_console",
|
"spec_to_console": "node scripts/spec_to_console",
|
||||||
"backport-skip-ci": "backport --prDescription \"[skip-ci]\"",
|
"backport-skip-ci": "backport --prDescription \"[skip-ci]\"",
|
||||||
"storybook": "node scripts/storybook",
|
"storybook": "node scripts/storybook",
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/elastic-datemath"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"index.d.ts"
|
"index.d.ts"
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "dependency-check --no-dev package.json set.js setWith.js fp/*.js",
|
"lint": "dependency-check --no-dev package.json set.js setWith.js fp/*.js",
|
||||||
"test": "npm run lint && tape test/*.js && npm run test:types",
|
"test": "npm run lint && tape test/*.js && npm run test:types",
|
||||||
"test:types": "./scripts/tsd.sh",
|
"test:types": "tsc --noEmit",
|
||||||
"update": "./scripts/update.sh",
|
"update": "./scripts/update.sh",
|
||||||
"save_state": "./scripts/save_state.sh"
|
"save_state": "./scripts/save_state.sh"
|
||||||
},
|
},
|
||||||
|
@ -42,8 +42,5 @@
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"/lodash/"
|
"/lodash/"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"tsd": {
|
|
||||||
"directory": "test"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Elasticsearch B.V licenses this file to you under the MIT License.
|
|
||||||
# See `packages/elastic-safer-lodash-set/LICENSE` for more information.
|
|
||||||
|
|
||||||
# tsd will get confused if it finds a tsconfig.json file in the project
|
|
||||||
# directory and start to scan the entirety of Kibana. We don't want that.
|
|
||||||
mv tsconfig.json tsconfig.tmp
|
|
||||||
|
|
||||||
clean_up () {
|
|
||||||
exit_code=$?
|
|
||||||
mv tsconfig.tmp tsconfig.json
|
|
||||||
exit $exit_code
|
|
||||||
}
|
|
||||||
trap clean_up EXIT
|
|
||||||
|
|
||||||
./node_modules/.bin/tsd
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { expectType } from 'tsd';
|
import { expectType } from 'tsd';
|
||||||
import { set, setWith } from '../';
|
import { set, setWith } from '..';
|
||||||
|
|
||||||
const someObj: object = {};
|
const someObj: object = {};
|
||||||
const anyValue: any = 'any value';
|
const anyValue: any = 'any value';
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/elastic-safer-lodash-set"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*"
|
"**/*",
|
||||||
],
|
],
|
||||||
"exclude": [
|
|
||||||
"**/*.test-d.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,6 @@ run(
|
||||||
proc.run(padRight(10, 'tsc'), {
|
proc.run(padRight(10, 'tsc'), {
|
||||||
cmd: 'tsc',
|
cmd: 'tsc',
|
||||||
args: [
|
args: [
|
||||||
'--emitDeclarationOnly',
|
|
||||||
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
|
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
|
||||||
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
|
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "./target/types",
|
"emitDeclarationOnly": true,
|
||||||
|
"outDir": "./target/types",
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/**/*.ts"
|
"src/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"target"
|
"target"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "./target/types",
|
"declarationDir": "./target/types",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "target",
|
"outDir": "target",
|
||||||
"target": "ES2019",
|
"target": "ES2019",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-es"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts"
|
"src/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-expect"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"expect.js.d.ts"
|
"expect.js.d.ts"
|
||||||
]
|
]
|
||||||
|
|
|
@ -71,7 +71,6 @@ run(
|
||||||
proc.run(padRight(10, 'tsc'), {
|
proc.run(padRight(10, 'tsc'), {
|
||||||
cmd: 'tsc',
|
cmd: 'tsc',
|
||||||
args: [
|
args: [
|
||||||
'--emitDeclarationOnly',
|
|
||||||
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
|
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
|
||||||
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
|
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
|
@ -11,7 +11,8 @@
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "./target/types",
|
"emitDeclarationOnly": true,
|
||||||
|
"outDir": "./target/types",
|
||||||
"types": [
|
"types": [
|
||||||
"jest",
|
"jest",
|
||||||
"node"
|
"node"
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-interpreter"
|
||||||
|
},
|
||||||
"include": ["index.d.ts", "src/**/*.d.ts"]
|
"include": ["index.d.ts", "src/**/*.d.ts"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-optimizer"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"index.d.ts",
|
"index.d.ts",
|
||||||
"src/**/*"
|
"src/**/*"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "target",
|
"outDir": "target",
|
||||||
"target": "ES2019",
|
"target": "ES2019",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "target",
|
"outDir": "target",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"include": [
|
"include": [
|
||||||
"./index.d.ts",
|
"./index.d.ts",
|
||||||
"./src/**/*.ts",
|
"./src/**/*.ts",
|
||||||
"./dist/*.d.ts",
|
"./dist/*.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-pm",
|
||||||
"types": [
|
"types": [
|
||||||
"jest",
|
"jest",
|
||||||
"node"
|
"node"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-telemetry-tools"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*",
|
"src/**/*",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-test-subj-selector"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"index.d.ts"
|
"index.d.ts"
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-test"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"types/**/*",
|
"types/**/*",
|
||||||
"src/**/*",
|
"src/**/*",
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-ui-shared-deps"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"index.d.ts",
|
"index.d.ts",
|
||||||
"theme.ts"
|
"theme.ts"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "./target",
|
"declarationDir": "./target",
|
||||||
|
|
20
scripts/build_ts_refs.js
Normal file
20
scripts/build_ts_refs.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
require('../src/setup_node_env');
|
||||||
|
require('../src/dev/typescript/build_refs').runBuildRefs();
|
|
@ -330,7 +330,7 @@ Cons:
|
||||||
To have access to Kibana TestUtils, you should create `integration_tests` folder and import `test_utils` within a test file:
|
To have access to Kibana TestUtils, you should create `integration_tests` folder and import `test_utils` within a test file:
|
||||||
```typescript
|
```typescript
|
||||||
// src/plugins/my_plugin/server/integration_tests/formatter.test.ts
|
// src/plugins/my_plugin/server/integration_tests/formatter.test.ts
|
||||||
import * as kbnTestServer from 'src/test_utils/kbn_server';
|
import * as kbnTestServer from 'src/core/test_helpers/kbn_server';
|
||||||
|
|
||||||
describe('myPlugin', () => {
|
describe('myPlugin', () => {
|
||||||
describe('GET /myPlugin/formatter', () => {
|
describe('GET /myPlugin/formatter', () => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import fetchMock from 'fetch-mock/es5/client';
|
||||||
import * as Rx from 'rxjs';
|
import * as Rx from 'rxjs';
|
||||||
import { takeUntil, toArray } from 'rxjs/operators';
|
import { takeUntil, toArray } from 'rxjs/operators';
|
||||||
|
|
||||||
import { setup as httpSetup } from '../../../test_utils/public/http_test_setup';
|
import { setup as httpSetup } from '../../test_helpers/http_test_setup';
|
||||||
import { UiSettingsApi } from './ui_settings_api';
|
import { UiSettingsApi } from './ui_settings_api';
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import { mockLoggingSystem } from './config_deprecation.test.mocks';
|
import { mockLoggingSystem } from './config_deprecation.test.mocks';
|
||||||
import { loggingSystemMock } from '../../logging/logging_system.mock';
|
import { loggingSystemMock } from '../../logging/logging_system.mock';
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
|
|
||||||
describe('configuration deprecations', () => {
|
describe('configuration deprecations', () => {
|
||||||
let root: ReturnType<typeof kbnTestServer.createRoot>;
|
let root: ReturnType<typeof kbnTestServer.createRoot>;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
import { Root } from '../../root';
|
import { Root } from '../../root';
|
||||||
|
|
||||||
const { startES } = kbnTestServer.createTestServers({
|
const { startES } = kbnTestServer.createTestServers({
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
import { Root } from '../../root';
|
import { Root } from '../../root';
|
||||||
|
|
||||||
describe('Platform assets', function () {
|
describe('Platform assets', function () {
|
||||||
|
|
|
@ -30,7 +30,7 @@ import { LegacyElasticsearchErrorHelpers } from '../../elasticsearch/legacy';
|
||||||
|
|
||||||
import { elasticsearchClientMock } from '../../elasticsearch/client/mocks';
|
import { elasticsearchClientMock } from '../../elasticsearch/client/mocks';
|
||||||
import { ResponseError } from '@elastic/elasticsearch/lib/errors';
|
import { ResponseError } from '@elastic/elasticsearch/lib/errors';
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
import { InternalElasticsearchServiceStart } from '../../elasticsearch';
|
import { InternalElasticsearchServiceStart } from '../../elasticsearch';
|
||||||
|
|
||||||
interface User {
|
interface User {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import { schema } from '@kbn/config-schema';
|
import { schema } from '@kbn/config-schema';
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
|
|
||||||
describe('http resources service', () => {
|
describe('http resources service', () => {
|
||||||
describe('register', () => {
|
describe('register', () => {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
|
|
||||||
describe('legacy service', () => {
|
describe('legacy service', () => {
|
||||||
describe('http server', () => {
|
describe('http server', () => {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getPlatformLogsFromMock,
|
getPlatformLogsFromMock,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
import { InternalCoreSetup } from '../../internal_types';
|
import { InternalCoreSetup } from '../../internal_types';
|
||||||
import { LoggerContextConfigInput } from '../logging_config';
|
import { LoggerContextConfigInput } from '../logging_config';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { migratorInstanceMock } from './migrate.test.mocks';
|
import { migratorInstanceMock } from './migrate.test.mocks';
|
||||||
import * as kbnTestServer from '../../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
|
||||||
|
|
||||||
describe('SavedObjects /_migrate endpoint', () => {
|
describe('SavedObjects /_migrate endpoint', () => {
|
||||||
let root: ReturnType<typeof kbnTestServer.createRoot>;
|
let root: ReturnType<typeof kbnTestServer.createRoot>;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {
|
||||||
TestElasticsearchUtils,
|
TestElasticsearchUtils,
|
||||||
TestKibanaUtils,
|
TestKibanaUtils,
|
||||||
TestUtils,
|
TestUtils,
|
||||||
} from '../../../../../test_utils/kbn_server';
|
} from '../../../../test_helpers/kbn_server';
|
||||||
import { createOrUpgradeSavedConfig } from '../create_or_upgrade_saved_config';
|
import { createOrUpgradeSavedConfig } from '../create_or_upgrade_saved_config';
|
||||||
import { loggingSystemMock } from '../../../logging/logging_system.mock';
|
import { loggingSystemMock } from '../../../logging/logging_system.mock';
|
||||||
import { httpServerMock } from '../../../http/http_server.mocks';
|
import { httpServerMock } from '../../../http/http_server.mocks';
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {
|
||||||
TestElasticsearchUtils,
|
TestElasticsearchUtils,
|
||||||
TestKibanaUtils,
|
TestKibanaUtils,
|
||||||
TestUtils,
|
TestUtils,
|
||||||
} from '../../../../../test_utils/kbn_server';
|
} from '../../../../test_helpers/kbn_server';
|
||||||
import { LegacyAPICaller } from '../../../elasticsearch/';
|
import { LegacyAPICaller } from '../../../elasticsearch/';
|
||||||
import { httpServerMock } from '../../../http/http_server.mocks';
|
import { httpServerMock } from '../../../http/http_server.mocks';
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { schema } from '@kbn/config-schema';
|
import { schema } from '@kbn/config-schema';
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../test_helpers/kbn_server';
|
||||||
|
|
||||||
describe('ui settings service', () => {
|
describe('ui settings service', () => {
|
||||||
describe('routes', () => {
|
describe('routes', () => {
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { HttpService } from '../../core/public/http';
|
import { HttpService } from '../public/http';
|
||||||
import { fatalErrorsServiceMock } from '../../core/public/fatal_errors/fatal_errors_service.mock';
|
import { fatalErrorsServiceMock } from '../public/fatal_errors/fatal_errors_service.mock';
|
||||||
import { injectedMetadataServiceMock } from '../../core/public/injected_metadata/injected_metadata_service.mock';
|
import { injectedMetadataServiceMock } from '../public/injected_metadata/injected_metadata_service.mock';
|
||||||
|
|
||||||
export type SetupTap = (
|
export type SetupTap = (
|
||||||
injectedMetadata: ReturnType<typeof injectedMetadataServiceMock.createSetupContract>,
|
injectedMetadata: ReturnType<typeof injectedMetadataServiceMock.createSetupContract>,
|
|
@ -26,16 +26,16 @@ import {
|
||||||
kibanaServerTestUser,
|
kibanaServerTestUser,
|
||||||
kibanaTestUser,
|
kibanaTestUser,
|
||||||
setupUsers,
|
setupUsers,
|
||||||
// @ts-ignore: implicit any for JS file
|
|
||||||
} from '@kbn/test';
|
} from '@kbn/test';
|
||||||
import { defaultsDeep, get } from 'lodash';
|
import { defaultsDeep, get } from 'lodash';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import supertest from 'supertest';
|
import supertest from 'supertest';
|
||||||
import { LegacyAPICaller } from '../core/server';
|
|
||||||
import { CliArgs, Env } from '../core/server/config';
|
import { LegacyAPICaller } from '../server/elasticsearch';
|
||||||
import { Root } from '../core/server/root';
|
import { CliArgs, Env } from '../server/config';
|
||||||
import KbnServer from '../legacy/server/kbn_server';
|
import { Root } from '../server/root';
|
||||||
|
import KbnServer from '../../legacy/server/kbn_server';
|
||||||
|
|
||||||
export type HttpMethod = 'delete' | 'get' | 'head' | 'post' | 'put';
|
export type HttpMethod = 'delete' | 'get' | 'head' | 'post' | 'put';
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ const DEFAULTS_SETTINGS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_SETTINGS_WITH_CORE_PLUGINS = {
|
const DEFAULT_SETTINGS_WITH_CORE_PLUGINS = {
|
||||||
plugins: { scanDirs: [resolve(__dirname, '../legacy/core_plugins')] },
|
plugins: { scanDirs: [resolve(__dirname, '../../legacy/core_plugins')] },
|
||||||
elasticsearch: {
|
elasticsearch: {
|
||||||
hosts: [esTestConfig.getUrl()],
|
hosts: [esTestConfig.getUrl()],
|
||||||
username: kibanaServerTestUser.username,
|
username: kibanaServerTestUser.username,
|
23
src/core/tsconfig.json
Normal file
23
src/core/tsconfig.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// {
|
||||||
|
// "extends": "../../tsconfig.base.json",
|
||||||
|
// "compilerOptions": {
|
||||||
|
// // "composite": true,
|
||||||
|
// "outDir": "./target",
|
||||||
|
// "emitDeclarationOnly": true,
|
||||||
|
// "declaration": true,
|
||||||
|
// "declarationMap": true
|
||||||
|
// },
|
||||||
|
// "include": [
|
||||||
|
// "public",
|
||||||
|
// "server",
|
||||||
|
// "types",
|
||||||
|
// "test_helpers",
|
||||||
|
// "utils",
|
||||||
|
// "index.ts",
|
||||||
|
// "../../kibana.d.ts",
|
||||||
|
// "../../typings/**/*"
|
||||||
|
// ],
|
||||||
|
// "references": [
|
||||||
|
// { "path": "../test_utils" }
|
||||||
|
// ]
|
||||||
|
// }
|
37
src/dev/typescript/build_refs.ts
Normal file
37
src/dev/typescript/build_refs.ts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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 execa from 'execa';
|
||||||
|
import { run, ToolingLog } from '@kbn/dev-utils';
|
||||||
|
|
||||||
|
export async function buildRefs(log: ToolingLog) {
|
||||||
|
try {
|
||||||
|
log.info('Building TypeScript projects refs...');
|
||||||
|
await execa(require.resolve('typescript/bin/tsc'), ['-b', 'tsconfig.refs.json']);
|
||||||
|
} catch (e) {
|
||||||
|
log.error(e);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function runBuildRefs() {
|
||||||
|
run(async ({ log }) => {
|
||||||
|
await buildRefs(log);
|
||||||
|
});
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ import { Project } from './project';
|
||||||
|
|
||||||
export const PROJECTS = [
|
export const PROJECTS = [
|
||||||
new Project(resolve(REPO_ROOT, 'tsconfig.json')),
|
new Project(resolve(REPO_ROOT, 'tsconfig.json')),
|
||||||
|
new Project(resolve(REPO_ROOT, 'src/test_utils/tsconfig.json')),
|
||||||
new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), { name: 'kibana/test' }),
|
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/tsconfig.json')),
|
||||||
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),
|
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),
|
||||||
|
|
|
@ -24,8 +24,9 @@ import getopts from 'getopts';
|
||||||
|
|
||||||
import { execInProjects } from './exec_in_projects';
|
import { execInProjects } from './exec_in_projects';
|
||||||
import { filterProjectsByFlag } from './projects';
|
import { filterProjectsByFlag } from './projects';
|
||||||
|
import { buildRefs } from './build_refs';
|
||||||
|
|
||||||
export function runTypeCheckCli() {
|
export async function runTypeCheckCli() {
|
||||||
const extraFlags: string[] = [];
|
const extraFlags: string[] = [];
|
||||||
const opts = getopts(process.argv.slice(2), {
|
const opts = getopts(process.argv.slice(2), {
|
||||||
boolean: ['skip-lib-check', 'help'],
|
boolean: ['skip-lib-check', 'help'],
|
||||||
|
@ -79,7 +80,16 @@ export function runTypeCheckCli() {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
const tscArgs = ['--noEmit', '--pretty', ...(opts['skip-lib-check'] ? ['--skipLibCheck'] : [])];
|
await buildRefs(log);
|
||||||
|
|
||||||
|
const tscArgs = [
|
||||||
|
// composite project cannot be used with --noEmit
|
||||||
|
...['--composite', 'false'],
|
||||||
|
...['--emitDeclarationOnly', 'false'],
|
||||||
|
'--noEmit',
|
||||||
|
'--pretty',
|
||||||
|
...(opts['skip-lib-check'] ? ['--skipLibCheck'] : []),
|
||||||
|
];
|
||||||
const projects = filterProjectsByFlag(opts.project).filter((p) => !p.disableTypeCheck);
|
const projects = filterProjectsByFlag(opts.project).filter((p) => !p.disableTypeCheck);
|
||||||
|
|
||||||
if (!projects.length) {
|
if (!projects.length) {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as kbnTestServer from '../../../../test_utils/kbn_server';
|
import * as kbnTestServer from '../../../../core/test_helpers/kbn_server';
|
||||||
|
|
||||||
let root;
|
let root;
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
import { SpecDefinitionsService } from '../../../services';
|
import { SpecDefinitionsService } from '../../../services';
|
||||||
|
|
||||||
import { BOOLEAN } from './shared';
|
import { BOOLEAN } from './shared';
|
||||||
|
@ -159,28 +157,25 @@ export const mappings = (specService: SpecDefinitionsService) => {
|
||||||
|
|
||||||
// dates
|
// dates
|
||||||
format: {
|
format: {
|
||||||
__one_of: _.flatten([
|
__one_of: [
|
||||||
_.map(
|
...[
|
||||||
[
|
'date',
|
||||||
'date',
|
'date_time',
|
||||||
'date_time',
|
'date_time_no_millis',
|
||||||
'date_time_no_millis',
|
'ordinal_date',
|
||||||
'ordinal_date',
|
'ordinal_date_time',
|
||||||
'ordinal_date_time',
|
'ordinal_date_time_no_millis',
|
||||||
'ordinal_date_time_no_millis',
|
'time',
|
||||||
'time',
|
'time_no_millis',
|
||||||
'time_no_millis',
|
't_time',
|
||||||
't_time',
|
't_time_no_millis',
|
||||||
't_time_no_millis',
|
'week_date',
|
||||||
'week_date',
|
'week_date_time',
|
||||||
'week_date_time',
|
'week_date_time_no_millis',
|
||||||
'week_date_time_no_millis',
|
].map(function (s) {
|
||||||
],
|
return ['basic_' + s, 'strict_' + s];
|
||||||
function (s) {
|
}),
|
||||||
return ['basic_' + s, 'strict_' + s];
|
...[
|
||||||
}
|
|
||||||
),
|
|
||||||
[
|
|
||||||
'date',
|
'date',
|
||||||
'date_hour',
|
'date_hour',
|
||||||
'date_hour_minute',
|
'date_hour_minute',
|
||||||
|
@ -214,7 +209,7 @@ export const mappings = (specService: SpecDefinitionsService) => {
|
||||||
'epoch_millis',
|
'epoch_millis',
|
||||||
'epoch_second',
|
'epoch_second',
|
||||||
],
|
],
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
fielddata: {
|
fielddata: {
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import { CoreSetup } from 'kibana/public';
|
|
||||||
import { DataPublicPluginStart, fieldFormats } from '../../plugins/data/public';
|
import { CoreSetup } from 'src/core/public';
|
||||||
import { deserializeFieldFormat } from '../../plugins/data/public/field_formats/utils/deserialize';
|
import { deserializeFieldFormat } from './utils/deserialize';
|
||||||
import { baseFormattersPublic } from '../../plugins/data/public';
|
import { baseFormattersPublic } from './constants';
|
||||||
|
import { DataPublicPluginStart, fieldFormats } from '..';
|
||||||
|
|
||||||
export const getFieldFormatsRegistry = (core: CoreSetup) => {
|
export const getFieldFormatsRegistry = (core: CoreSetup) => {
|
||||||
const fieldFormatsRegistry = new fieldFormats.FieldFormatsRegistry();
|
const fieldFormatsRegistry = new fieldFormats.FieldFormatsRegistry();
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { setup } from 'test_utils/http_test_setup';
|
import { setup } from '../../../../../core/test_helpers/http_test_setup';
|
||||||
|
|
||||||
export const { http } = setup((injectedMetadata) => {
|
export const { http } = setup((injectedMetadata) => {
|
||||||
injectedMetadata.getBasePath.mockReturnValue('/hola/daro/');
|
injectedMetadata.getBasePath.mockReturnValue('/hola/daro/');
|
||||||
|
|
20
src/plugins/data/public/test_utils.ts
Normal file
20
src/plugins/data/public/test_utils.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* 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 { getFieldFormatsRegistry } from './field_formats/field_formats_registry.stub';
|
|
@ -24,7 +24,7 @@ import 'angular-mocks';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { round } from 'lodash';
|
import { round } from 'lodash';
|
||||||
|
|
||||||
import { getFieldFormatsRegistry } from '../../../../test_utils/public/stub_field_formats';
|
import { getFieldFormatsRegistry } from '../../../data/public/test_utils';
|
||||||
import { coreMock } from '../../../../core/public/mocks';
|
import { coreMock } from '../../../../core/public/mocks';
|
||||||
import { initAngularBootstrap } from '../../../kibana_legacy/public';
|
import { initAngularBootstrap } from '../../../kibana_legacy/public';
|
||||||
import { setUiSettings } from '../../../data/public/services';
|
import { setUiSettings } from '../../../data/public/services';
|
||||||
|
|
|
@ -22,7 +22,7 @@ import angular from 'angular';
|
||||||
import 'angular-mocks';
|
import 'angular-mocks';
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
|
|
||||||
import { getFieldFormatsRegistry } from '../../../../test_utils/public/stub_field_formats';
|
import { getFieldFormatsRegistry } from '../../../data/public/test_utils';
|
||||||
import { coreMock } from '../../../../core/public/mocks';
|
import { coreMock } from '../../../../core/public/mocks';
|
||||||
import { initAngularBootstrap } from '../../../kibana_legacy/public';
|
import { initAngularBootstrap } from '../../../kibana_legacy/public';
|
||||||
import { setUiSettings } from '../../../data/public/services';
|
import { setUiSettings } from '../../../data/public/services';
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createTickFormatter } from './tick_formatter';
|
import { createTickFormatter } from './tick_formatter';
|
||||||
import { getFieldFormatsRegistry } from '../../../../../../test_utils/public/stub_field_formats';
|
import { getFieldFormatsRegistry } from '../../../../../data/public/test_utils';
|
||||||
import { setFieldFormats } from '../../../services';
|
import { setFieldFormats } from '../../../services';
|
||||||
import { UI_SETTINGS } from '../../../../../data/public';
|
import { UI_SETTINGS } from '../../../../../data/public';
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import sinon from 'sinon';
|
||||||
// because it is one of the few places that we need to access the IndexPattern class itself, rather
|
// because it is one of the few places that we need to access the IndexPattern class itself, rather
|
||||||
// than just the type. Doing this as a temporary measure; it will be left behind when migrating to NP.
|
// than just the type. Doing this as a temporary measure; it will be left behind when migrating to NP.
|
||||||
|
|
||||||
|
import { getFieldFormatsRegistry } from '../../plugins/data/public/test_utils';
|
||||||
import { IndexPattern, indexPatterns, KBN_FIELD_TYPES, fieldList } from '../../plugins/data/public';
|
import { IndexPattern, indexPatterns, KBN_FIELD_TYPES, fieldList } from '../../plugins/data/public';
|
||||||
|
|
||||||
import { setFieldFormats } from '../../plugins/data/public/services';
|
import { setFieldFormats } from '../../plugins/data/public/services';
|
||||||
|
@ -33,8 +34,6 @@ setFieldFormats({
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
import { getFieldFormatsRegistry } from './stub_field_formats';
|
|
||||||
|
|
||||||
export default function StubIndexPattern(pattern, getConfig, timeField, fields, core) {
|
export default function StubIndexPattern(pattern, getConfig, timeField, fields, core) {
|
||||||
const registeredFieldFormats = getFieldFormatsRegistry(core);
|
const registeredFieldFormats = getFieldFormatsRegistry(core);
|
||||||
|
|
||||||
|
|
16
src/test_utils/tsconfig.json
Normal file
16
src/test_utils/tsconfig.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./target",
|
||||||
|
"composite": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"public/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"target"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
"index.ts",
|
"index.ts",
|
||||||
"public/**/*.ts",
|
"public/**/*.ts",
|
||||||
"public/**/*.tsx",
|
"public/**/*.tsx",
|
||||||
"../../../../typings/**/*",
|
"../../../../typings/**/*"
|
||||||
],
|
],
|
||||||
"exclude": []
|
"exclude": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../../tsconfig.json",
|
"extends": "../../../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./target",
|
"outDir": "./target",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "../build/tsbuildinfo/test",
|
||||||
"types": [
|
"types": [
|
||||||
"node",
|
"node",
|
||||||
"mocha",
|
"mocha",
|
||||||
"flot"
|
"flot"
|
||||||
],
|
|
||||||
"lib": [
|
|
||||||
"esnext",
|
|
||||||
"dom"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.ts",
|
"**/*",
|
||||||
"**/*.tsx",
|
|
||||||
"../typings/elastic__node_crypto.d.ts",
|
"../typings/elastic__node_crypto.d.ts",
|
||||||
"typings/**/*"
|
"typings/**/*"
|
||||||
],
|
],
|
||||||
|
|
60
tsconfig.base.json
Normal file
60
tsconfig.base.json
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
// Allows for importing from `kibana` package for the exported types.
|
||||||
|
"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
|
||||||
|
"jsx": "react",
|
||||||
|
// Enables all strict type checking options.
|
||||||
|
"strict": true,
|
||||||
|
// save information about the project graph on disk
|
||||||
|
"incremental": true,
|
||||||
|
// enables "core language features"
|
||||||
|
"lib": [
|
||||||
|
"esnext",
|
||||||
|
// includes support for browser APIs
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
|
// Node 8 should support everything output by esnext, we override this
|
||||||
|
// in webpack with loader-level compiler options
|
||||||
|
"target": "esnext",
|
||||||
|
// Use commonjs for node, overridden in webpack to keep import statements
|
||||||
|
// to maintain support for things like `await import()`
|
||||||
|
"module": "commonjs",
|
||||||
|
// Allows default imports from modules with no default export. This does not affect code emit, just type checking.
|
||||||
|
// We have to enable this option explicitly since `esModuleInterop` doesn't enable it automatically when ES2015 or
|
||||||
|
// ESNext module format is used.
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
// Emits __importStar and __importDefault helpers for runtime babel ecosystem compatibility.
|
||||||
|
"esModuleInterop": true,
|
||||||
|
// Resolve modules in the same way as Node.js. Aka make `require` works the
|
||||||
|
// same in TypeScript as it does in Node.js.
|
||||||
|
"moduleResolution": "node",
|
||||||
|
// Disallow inconsistently-cased references to the same file.
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
// Forbid unused local variables as the rule was deprecated by ts-lint
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
// Provide full support for iterables in for..of, spread and destructuring when targeting ES5 or ES3.
|
||||||
|
"downlevelIteration": true,
|
||||||
|
// import tslib helpers rather than inlining helpers for iteration or spreading, for instance
|
||||||
|
"importHelpers": true,
|
||||||
|
// adding global typings
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"jest",
|
||||||
|
"react",
|
||||||
|
"flot",
|
||||||
|
"jest-styled-components",
|
||||||
|
"@testing-library/jest-dom"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
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