diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap b/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap index dd79687ea02c3..04122fbf55f95 100644 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap +++ b/packages/kbn-test/src/functional_tests/cli/run_tests/__snapshots__/args.test.js.snap @@ -110,7 +110,7 @@ Object { ], "createLogger": [Function], "extraKbnOpts": undefined, - "kibana-install-dir": "foo", + "installDir": "foo", } `; diff --git a/packages/kbn-test/src/functional_tests/cli/run_tests/args.js b/packages/kbn-test/src/functional_tests/cli/run_tests/args.js index 55d4cfb27c680..5fdc738c4517a 100644 --- a/packages/kbn-test/src/functional_tests/cli/run_tests/args.js +++ b/packages/kbn-test/src/functional_tests/cli/run_tests/args.js @@ -93,6 +93,11 @@ export function processOptions(userOptions, defaultConfigPaths) { } } + if (userOptions['kibana-install-dir']) { + userOptions.installDir = userOptions['kibana-install-dir']; + delete userOptions['kibana-install-dir']; + } + function createLogger() { const log = createToolingLog(pickLevelFromFlags(userOptions)); log.pipe(process.stdout); diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap index 5c9f5a9a8d7fc..4c022abdf1f01 100644 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap +++ b/packages/kbn-test/src/functional_tests/cli/start_servers/__snapshots__/args.test.js.snap @@ -95,7 +95,7 @@ Object { ], "createLogger": [Function], "extraKbnOpts": undefined, - "kibana-install-dir": "foo", + "installDir": "foo", } `; diff --git a/packages/kbn-test/src/functional_tests/cli/start_servers/args.js b/packages/kbn-test/src/functional_tests/cli/start_servers/args.js index 55a69d0bd15bd..bc3d97ab0641f 100644 --- a/packages/kbn-test/src/functional_tests/cli/start_servers/args.js +++ b/packages/kbn-test/src/functional_tests/cli/start_servers/args.js @@ -80,6 +80,11 @@ export function processOptions(userOptions, defaultConfigPath) { throw new Error(`functional_tests_server: config is required`); } + if (userOptions['kibana-install-dir']) { + userOptions.installDir = userOptions['kibana-install-dir']; + delete userOptions['kibana-install-dir']; + } + function createLogger() { const log = createToolingLog(pickLevelFromFlags(userOptions)); log.pipe(process.stdout); diff --git a/packages/kbn-test/src/functional_tests/tasks.js b/packages/kbn-test/src/functional_tests/tasks.js index 802d84d4b6a20..0c85c041b02f2 100644 --- a/packages/kbn-test/src/functional_tests/tasks.js +++ b/packages/kbn-test/src/functional_tests/tasks.js @@ -76,7 +76,7 @@ export async function startServers(options) { config, options: { ...opts, - extraKbnOpts: [...options.extraKbnOpts, '--dev'], + extraKbnOpts: [...options.extraKbnOpts, ...(options.installDir ? [] : ['--dev'])], }, }); diff --git a/scripts/functional_tests.js b/scripts/functional_tests.js index 75e4eab07ac06..1302355c49d21 100644 --- a/scripts/functional_tests.js +++ b/scripts/functional_tests.js @@ -18,7 +18,7 @@ */ require('../src/setup_node_env'); -require('../packages/kbn-test').runTestsCli([ +require('@kbn/test').runTestsCli([ require.resolve('../test/functional/config.js'), require.resolve('../test/api_integration/config.js'), ]); diff --git a/src/core/public/legacy_platform/legacy_platform_service.ts b/src/core/public/legacy_platform/legacy_platform_service.ts index ed7976bfa2a35..5b678b45ad736 100644 --- a/src/core/public/legacy_platform/legacy_platform_service.ts +++ b/src/core/public/legacy_platform/legacy_platform_service.ts @@ -60,7 +60,7 @@ export class LegacyPlatformService { if (this.params.useLegacyTestHarness) { // wrapped in NODE_ENV check so the `ui/test_harness` module // is not included in the distributable - if (process.env.NODE_ENV !== 'production') { + if (process.env.IS_KIBANA_DISTRIBUTABLE !== 'true') { return require('ui/test_harness'); } diff --git a/src/optimize/base_optimizer.js b/src/optimize/base_optimizer.js index 8d63525f90fb2..8318f6ebb4cd7 100644 --- a/src/optimize/base_optimizer.js +++ b/src/optimize/base_optimizer.js @@ -286,8 +286,20 @@ export default class BaseOptimizer { }, }; - // we transpile typescript in the optimizer unless we are running the distributable - const transpileTsConfig = { + // when running from the distributable define an environment variable we can use + // to exclude chunks of code, modules, etc. + const isDistributableConfig = { + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + 'IS_KIBANA_DISTRIBUTABLE': `"true"` + } + }), + ] + }; + + // when running from source transpile TypeScript automatically + const isSourceConfig = { module: { rules: [ { @@ -371,8 +383,8 @@ export default class BaseOptimizer { return webpackMerge( commonConfig, IS_KIBANA_DISTRIBUTABLE - ? {} - : transpileTsConfig, + ? isDistributableConfig + : isSourceConfig, this.uiBundles.isDevMode() ? webpackMerge(watchingConfig, supportEnzymeConfig) : productionConfig diff --git a/test/common/services/kibana_server/version.js b/test/common/services/kibana_server/version.js index 1b13ba6c411ab..b7efb01c63449 100644 --- a/test/common/services/kibana_server/version.js +++ b/test/common/services/kibana_server/version.js @@ -30,7 +30,7 @@ export class KibanaServerVersion { const status = await this.kibanaStatus.get(); if (status && status.version && status.version.number) { - this._cachedVersionNumber = status.version.number; + this._cachedVersionNumber = status.version.number + (status.version.build_snapshot ? '-SNAPSHOT' : ''); return this._cachedVersionNumber; }