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:
Mikhail Shustov 2020-09-03 15:20:04 +03:00 committed by GitHub
parent 4c5e75e437
commit e9e0ca3782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
117 changed files with 381 additions and 240 deletions

3
.gitignore vendored
View file

@ -60,3 +60,6 @@ apm.tsconfig.json
# release notes script output
report.csv
report.asciidoc
# TS incremental build cache
*.tsbuildinfo

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target"
},

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -65,7 +65,7 @@
"kbn:watch": "node scripts/kibana --dev --logging.json=false",
"build:types": "tsc --p tsconfig.types.json",
"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",
"backport-skip-ci": "backport --prDescription \"[skip-ci]\"",
"storybook": "node scripts/storybook",

View file

@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/elastic-datemath"
},
"include": [
"index.d.ts"
],
]
}

View file

@ -16,7 +16,7 @@
"scripts": {
"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:types": "./scripts/tsd.sh",
"test:types": "tsc --noEmit",
"update": "./scripts/update.sh",
"save_state": "./scripts/save_state.sh"
},
@ -42,8 +42,5 @@
"ignore": [
"/lodash/"
]
},
"tsd": {
"directory": "test"
}
}

View file

@ -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

View file

@ -4,7 +4,7 @@
*/
import { expectType } from 'tsd';
import { set, setWith } from '../';
import { set, setWith } from '..';
const someObj: object = {};
const anyValue: any = 'any value';

View file

@ -1,9 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/elastic-safer-lodash-set"
},
"include": [
"**/*"
"**/*",
],
"exclude": [
"**/*.test-d.ts"
]
}

View file

@ -71,7 +71,6 @@ run(
proc.run(padRight(10, 'tsc'), {
cmd: 'tsc',
args: [
'--emitDeclarationOnly',
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
],

View file

@ -1,8 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",
"emitDeclarationOnly": true,
"outDir": "./target/types",
"stripInternal": true,
"declarationMap": true,
"types": [
@ -11,7 +12,7 @@
]
},
"include": [
"./src/**/*.ts"
"src/**/*"
],
"exclude": [
"target"

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"target": "ES2019",

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,

View file

@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-es"
},
"include": [
"src/**/*.ts"
"src/**/*"
]
}

View file

@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-expect"
},
"include": [
"expect.js.d.ts"
]

View file

@ -71,7 +71,6 @@ run(
proc.run(padRight(10, 'tsc'), {
cmd: 'tsc',
args: [
'--emitDeclarationOnly',
...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []),
...(flags['source-maps'] ? ['--declarationMap', 'true'] : []),
],

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"src/**/*.ts",
"src/**/*.tsx",
@ -11,7 +11,8 @@
],
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",
"emitDeclarationOnly": true,
"outDir": "./target/types",
"types": [
"jest",
"node"

View file

@ -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"]
}

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,

View file

@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-optimizer"
},
"include": [
"index.d.ts",
"src/**/*"

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"target": "ES2019",

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"declaration": true,

View file

@ -1,12 +1,13 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"./index.d.ts",
"./src/**/*.ts",
"./dist/*.d.ts",
"./dist/*.d.ts"
],
"exclude": [],
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-pm",
"types": [
"jest",
"node"

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,

View file

@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-telemetry-tools"
},
"include": [
"src/**/*",
]

View file

@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-test-subj-selector"
},
"include": [
"index.d.ts"
],
]
}

View file

@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-test"
},
"include": [
"types/**/*",
"src/**/*",

View file

@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-ui-shared-deps"
},
"include": [
"index.d.ts",
"theme.ts"

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target",

20
scripts/build_ts_refs.js Normal file
View 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();

View file

@ -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:
```typescript
// 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('GET /myPlugin/formatter', () => {

View file

@ -22,7 +22,7 @@ import fetchMock from 'fetch-mock/es5/client';
import * as Rx from 'rxjs';
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';
function setup() {

View file

@ -19,7 +19,7 @@
import { mockLoggingSystem } from './config_deprecation.test.mocks';
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', () => {
let root: ReturnType<typeof kbnTestServer.createRoot>;

View file

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import * as kbnTestServer from '../../../../test_utils/kbn_server';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
import { Root } from '../../root';
const { startES } = kbnTestServer.createTestServers({

View file

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import * as kbnTestServer from '../../../../test_utils/kbn_server';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
import { Root } from '../../root';
describe('Platform assets', function () {

View file

@ -30,7 +30,7 @@ import { LegacyElasticsearchErrorHelpers } from '../../elasticsearch/legacy';
import { elasticsearchClientMock } from '../../elasticsearch/client/mocks';
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';
interface User {

View file

@ -17,7 +17,7 @@
* under the License.
*/
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('register', () => {

View file

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import * as kbnTestServer from '../../../../test_utils/kbn_server';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
describe('legacy service', () => {
describe('http server', () => {

View file

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import * as kbnTestServer from '../../../../test_utils/kbn_server';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
import {
getPlatformLogsFromMock,

View file

@ -17,7 +17,7 @@
* 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 { LoggerContextConfigInput } from '../logging_config';
import { Subject } from 'rxjs';

View file

@ -18,7 +18,7 @@
*/
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', () => {
let root: ReturnType<typeof kbnTestServer.createRoot>;

View file

@ -24,7 +24,7 @@ import {
TestElasticsearchUtils,
TestKibanaUtils,
TestUtils,
} from '../../../../../test_utils/kbn_server';
} from '../../../../test_helpers/kbn_server';
import { createOrUpgradeSavedConfig } from '../create_or_upgrade_saved_config';
import { loggingSystemMock } from '../../../logging/logging_system.mock';
import { httpServerMock } from '../../../http/http_server.mocks';

View file

@ -24,7 +24,7 @@ import {
TestElasticsearchUtils,
TestKibanaUtils,
TestUtils,
} from '../../../../../test_utils/kbn_server';
} from '../../../../test_helpers/kbn_server';
import { LegacyAPICaller } from '../../../elasticsearch/';
import { httpServerMock } from '../../../http/http_server.mocks';

View file

@ -18,7 +18,7 @@
*/
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('routes', () => {

View file

@ -17,9 +17,9 @@
* under the License.
*/
import { HttpService } from '../../core/public/http';
import { fatalErrorsServiceMock } from '../../core/public/fatal_errors/fatal_errors_service.mock';
import { injectedMetadataServiceMock } from '../../core/public/injected_metadata/injected_metadata_service.mock';
import { HttpService } from '../public/http';
import { fatalErrorsServiceMock } from '../public/fatal_errors/fatal_errors_service.mock';
import { injectedMetadataServiceMock } from '../public/injected_metadata/injected_metadata_service.mock';
export type SetupTap = (
injectedMetadata: ReturnType<typeof injectedMetadataServiceMock.createSetupContract>,

View file

@ -26,16 +26,16 @@ import {
kibanaServerTestUser,
kibanaTestUser,
setupUsers,
// @ts-ignore: implicit any for JS file
} from '@kbn/test';
import { defaultsDeep, get } from 'lodash';
import { resolve } from 'path';
import { BehaviorSubject } from 'rxjs';
import supertest from 'supertest';
import { LegacyAPICaller } from '../core/server';
import { CliArgs, Env } from '../core/server/config';
import { Root } from '../core/server/root';
import KbnServer from '../legacy/server/kbn_server';
import { LegacyAPICaller } from '../server/elasticsearch';
import { CliArgs, Env } from '../server/config';
import { Root } from '../server/root';
import KbnServer from '../../legacy/server/kbn_server';
export type HttpMethod = 'delete' | 'get' | 'head' | 'post' | 'put';
@ -53,7 +53,7 @@ const DEFAULTS_SETTINGS = {
};
const DEFAULT_SETTINGS_WITH_CORE_PLUGINS = {
plugins: { scanDirs: [resolve(__dirname, '../legacy/core_plugins')] },
plugins: { scanDirs: [resolve(__dirname, '../../legacy/core_plugins')] },
elasticsearch: {
hosts: [esTestConfig.getUrl()],
username: kibanaServerTestUser.username,

23
src/core/tsconfig.json Normal file
View 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" }
// ]
// }

View 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);
});
}

View file

@ -24,6 +24,7 @@ import { Project } from './project';
export const PROJECTS = [
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, 'x-pack/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),

View file

@ -24,8 +24,9 @@ import getopts from 'getopts';
import { execInProjects } from './exec_in_projects';
import { filterProjectsByFlag } from './projects';
import { buildRefs } from './build_refs';
export function runTypeCheckCli() {
export async function runTypeCheckCli() {
const extraFlags: string[] = [];
const opts = getopts(process.argv.slice(2), {
boolean: ['skip-lib-check', 'help'],
@ -79,7 +80,16 @@ export function runTypeCheckCli() {
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);
if (!projects.length) {

View file

@ -17,7 +17,7 @@
* under the License.
*/
import * as kbnTestServer from '../../../../test_utils/kbn_server';
import * as kbnTestServer from '../../../../core/test_helpers/kbn_server';
let root;
beforeAll(async () => {

View file

@ -17,8 +17,6 @@
* under the License.
*/
import _ from 'lodash';
import { SpecDefinitionsService } from '../../../services';
import { BOOLEAN } from './shared';
@ -159,28 +157,25 @@ export const mappings = (specService: SpecDefinitionsService) => {
// dates
format: {
__one_of: _.flatten([
_.map(
[
'date',
'date_time',
'date_time_no_millis',
'ordinal_date',
'ordinal_date_time',
'ordinal_date_time_no_millis',
'time',
'time_no_millis',
't_time',
't_time_no_millis',
'week_date',
'week_date_time',
'week_date_time_no_millis',
],
function (s) {
return ['basic_' + s, 'strict_' + s];
}
),
[
__one_of: [
...[
'date',
'date_time',
'date_time_no_millis',
'ordinal_date',
'ordinal_date_time',
'ordinal_date_time_no_millis',
'time',
'time_no_millis',
't_time',
't_time_no_millis',
'week_date',
'week_date_time',
'week_date_time_no_millis',
].map(function (s) {
return ['basic_' + s, 'strict_' + s];
}),
...[
'date',
'date_hour',
'date_hour_minute',
@ -214,7 +209,7 @@ export const mappings = (specService: SpecDefinitionsService) => {
'epoch_millis',
'epoch_second',
],
]),
],
},
fielddata: {

View file

@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
import { CoreSetup } from 'kibana/public';
import { DataPublicPluginStart, fieldFormats } from '../../plugins/data/public';
import { deserializeFieldFormat } from '../../plugins/data/public/field_formats/utils/deserialize';
import { baseFormattersPublic } from '../../plugins/data/public';
import { CoreSetup } from 'src/core/public';
import { deserializeFieldFormat } from './utils/deserialize';
import { baseFormattersPublic } from './constants';
import { DataPublicPluginStart, fieldFormats } from '..';
export const getFieldFormatsRegistry = (core: CoreSetup) => {
const fieldFormatsRegistry = new fieldFormats.FieldFormatsRegistry();

View file

@ -17,7 +17,7 @@
* 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) => {
injectedMetadata.getBasePath.mockReturnValue('/hola/daro/');

View 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';

View file

@ -24,7 +24,7 @@ import 'angular-mocks';
import sinon from 'sinon';
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 { initAngularBootstrap } from '../../../kibana_legacy/public';
import { setUiSettings } from '../../../data/public/services';

View file

@ -22,7 +22,7 @@ import angular from 'angular';
import 'angular-mocks';
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 { initAngularBootstrap } from '../../../kibana_legacy/public';
import { setUiSettings } from '../../../data/public/services';

View file

@ -18,7 +18,7 @@
*/
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 { UI_SETTINGS } from '../../../../../data/public';

View file

@ -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
// 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 { 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) {
const registeredFieldFormats = getFieldFormatsRegistry(core);

View file

@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"composite": true,
"emitDeclarationOnly": true,
"declaration": true,
"declarationMap": true
},
"include": [
"public/**/*"
],
"exclude": [
"target"
]
}

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true,
@ -13,7 +13,7 @@
"index.ts",
"public/**/*.ts",
"public/**/*.tsx",
"../../../../typings/**/*",
"../../../../typings/**/*"
],
"exclude": []
}
}

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true

View file

@ -1,19 +1,15 @@
{
"extends": "../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "../build/tsbuildinfo/test",
"types": [
"node",
"mocha",
"flot"
],
"lib": [
"esnext",
"dom"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
"**/*",
"../typings/elastic__node_crypto.d.ts",
"typings/**/*"
],

60
tsconfig.base.json Normal file
View 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