Commit graph

298 commits

Author SHA1 Message Date
Maryia Lapata
110c987c89 Update versions of @babel/parser and @babel/types (#23268)
Update versions of @babel/parser, @babel/types, eslint, babel-eslint
2018-09-25 14:35:31 +03:00
liza-mae
e477ca3fdf
Cleanup from PR 22608, remove esInstallDir (#23450) 2018-09-24 13:57:23 -06:00
liza-mae
5d9d7242e5
Add option to functional test server to run elasticsearch from instal… (#22608)
* Add option to functional test server to run elasticsearch from install dir

* Fix variable

* Fix server CLI test

* Updates to include install path in esFrom command line option

* Fix snapshot

* Update args/cli tests

* Keep default snapshot in args/help
2018-09-24 11:39:09 -06:00
Tyler Smalley
0e5fd324b1
Moves styleSheetPath to uiExports (#23007)
This was previously defined in uiExports.app, which limited plugins which are not an app of providing a stylesheet. This allows any plugin to define a stylesheet which will be available on page load.
2018-09-20 19:01:06 -07:00
Spencer
dba7a5f8bf
[build] default to --debug output (#23011) 2018-09-14 13:23:49 -07:00
Spencer
b55705e9b4
[ts] enable support for iterators in browsers (#22986)
I was surprised when I tried to spread a `Set` in TypeScript and the browser complained about `Set.slice()` not being defined. This is because TypeScript does not automatically enable support for iterators when targeting earlier ES versions, like we do in the browser, unless you use the `"downlevelIteration": true` compiler option. This injects some helpers into the necessary files for reading/spreading iterators, which can be stuffed behind an import statement with using the `"importHelpers": true` compiler option and include `tslib` in our dependencies. This is already a dependency of several of our packages, so it shouldn't cause any additional modules.
2018-09-13 14:18:13 -07:00
Spencer
01ee574443
[kbn-plugin-helpers] move jest tests to integration suite (#23005)
The plugin helper tests have failed due to timeouts every once and a while, which makes sense because they run a bunch of CLI tasks, so this just moved them to the jest integration tests where tests can take a little longer to run.
2018-09-13 13:30:13 -07:00
Spencer
6ded193260 Upgrade to TypeScript 3 (#22792)
LGTM 🎉 🎉 🎉
2018-09-11 08:38:41 +03:00
Spencer
7e94eccc2e
Upgrade to Jest 23.5.0 (#22791)
I'd really like to upgrade to Typescript 3 for its `unknown` type, but we need to upgrade to `jest@23` to support a recent version of `ts-jest@23`. 

The [jest changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md) breaks down the breaking changes in 23.x, but I found it to be slightly incomplete so I've broken down the changes that actually caused breaks for us here, and addressed each in individual commits to make review a little easier:

- the `testURL` config default was changed from `about:blank` to `http://localhost`
    - this cause some XHR requests powered by JSdom to start failing. It seems these requests just do nothing in master but start to fail when JSdom is initialized with an actual URL... I think we would ideally stop sending meaningless XHR requests in the tests, but it was a lot easier to just set the config to `about:blank` for now, and we can worry about cleanup later if necessary
- `expect(...).toThrow()` only passes if an actual error was thrown.
     - In two places in the index pattern code we were throwing strings, which broke the assertions. Fortunately/Unfortunately the errors are not being consumed by anything, so I was able to wrap them in `new Error()` without causing any issues.
- snapshots of mock functions now include a `results` array, detailing the return values of the function
- React fragments are now serialized as `<React.Fragment>` instead of `<UNDEFINED>`
- undefined props in React components are now stripped from snapshots
- minor changes to the ordering of mocks, imports resolution, and before hooks caused the uiSettings API tests to start breaking, but I'm replacing them with totally new tests in #22694 so I just deleted them here
- mocks created with `jest.spyOn()` that are restored now have their `mock.calls` reset, so some of the kbn-pm tests stated failing. This was fixed by restoring them with `jest.restoreAllMocks()` rather than trying to do it before the assertions
2018-09-07 18:36:13 -07:00
Jen Huang
0ed2623ce3
Introduce date histogram time base configuration to EditorConfig (#22344)
* Add `default` and `baseInterval` configuration ability to date histogram EditorConfig
* Change EditorConfig `warning` to `help`, show `help` below date histogram and histogram interval inputs
2018-09-07 12:38:31 -07:00
Lee Drengenberg
eeee0d800a
x-pack tests should use servers from other config files already loaded (#22739)
* x-pack tests should use servers from other config files already loaded

* Fix es_test_config that was using TEST_KIBANA_USERNAME/PASSWORD
2018-09-05 19:54:38 -05:00
Maryia Lapata
58dbd0beb1
Update Guideline (#22450)
* Update Guideline

* Update Unit tests section

* Updated Guideline
2018-09-04 13:11:39 +03:00
spalger
e5d33cc665 [kbn-pm] fix arg syntax 2018-09-02 18:21:35 -07:00
Tim Sullivan
f2e4282aad
[ESLint] Turn off no-multi-str rule in eslint config (#22525)
* remove inline rule disabling comments

* turn off no-multi-str
2018-08-31 09:55:23 -07:00
Leanid Shutau
1e5d82c2ab
Integrate main i18n tool into build pipeline (#22254)
* Integrate main i18n tool to build process

* Resolve comments

* Remove old task

* Replace default Error with FailError
2018-08-29 11:55:34 +03:00
Spencer
2700654940
[dev-utils/withProcRunner] fix test that swallows promise rejection (#22342)
* [dev-utils/withProcRunner] fix tests that can silently fail

* test async/sync withProcRunner functions
2018-08-27 17:32:53 -07:00
Spencer
c7d451c9a2
[ftr] capture test output and only log on failure (#21903)
This is an attempt to write a log capture integration for the functional test runner that will collect all log output written during a test, prevent it from being written to stdout to lower the amount of work Jenkins master has to do and include the entire log output for each test in the junit report. I'm slightly concerned about the amount of memory we'll be using to store a copy of the logs for each test, but streaming the XML report isn’t easy and there doesn’t seem to be a library out there to help. If we decide it’s torally necessary we might be able to figure it out.
2018-08-27 17:26:30 -07:00
Spencer
4d9bc2f121
[devUtils/toolingLog] give tooling log configurable writers (#22110)
* [devUtils/toolingLog] give tooling log configurable writers

* property shorthand

* remove redundant parameter

* call Error.captureStackTrace when subclassing Error

* describe why we skip stack trace logging for CliError

* always return true/false from log writers

* improve type definitions, writeTo is just an object with write method

* get rid of weird dedent for failures
2018-08-21 17:09:27 -07:00
Caroline Horn
3175253056
Home less to sass (2) (#22160) 2018-08-21 18:28:15 -04:00
Tim Roes
743edc6c0e
Make panel action tests more generic (#22174)
* Make panel action tests more generic

* Remove test file

* Add simple app tests

* Shorten/fix import

* Remove unneeded task

* Add debug output

* Allow duplicate --plugin-path params

* Remove debugging options

* Add README
2018-08-20 21:48:38 +02:00
archana
cb8c1de733 [Tests] Add http integration test setup (#19261)
* [Tests] Add http integration test setup

* Base path tests

* SSL tests

* Eslint fixes

* Remove env from config schema

* Rename folders so no_rewrite and rewrite match configs/tests

* wip

* Use self-signed cert for SSL test

* Improve basepath tests

* Run base path proxy server in dev mode for now

* Remove env from x-pack reporting config

* Remove redundant base-path tests

* Test SSL with redirectHttpFromPort set

* Test SSL with redirectHttpFromPort set

* Flesh out comments

* Remove some cruft

* Add SSL tests to CI run
2018-08-17 08:36:14 +02:00
Spencer
b4e1193015
Revert "Run some functional tests against kibana in production mode (#21899)" (#22111)
This reverts commit 63df7cb2e4.

It seems this caused unintended failures on master, will resubmit after CI is green
2018-08-16 23:28:37 -07:00
Spencer
63df7cb2e4
Run some functional tests against kibana in production mode (#21899)
Right now the functional tests are run against a distributable of Kibana in CI, but that distributable is running with `--env.name=development`. That causes the optimizer to run again before the tests can start and prevents the functional tests from running against the actual version of the application users will end up getting. This seems necessary for some tests, but not all of them, but I would like to get all of the tests running against the production version of Kibana soon.

This PR implements a second ftr config, `test/functional_production` that uses basically a copy of the `test/functional` config but with a few minor adjustments, removing the `--env.name=development` kbnServerArg and using a unique junit report name. To accomplish this I needed to modify the `@kbn/test` module to only pass the `--dev` flag to the Kibana server if it is being run in development mode, which it currently does by testing the args for `--env.name=development` or two args next to each other: `'--env.name'` and `'development'`. It does this by converting the `extraKbnOpts` option into an `addExtraKbnArgs` function, which is called with the final args just before passing them to the proc runner and given a chance to modify then after all other args are resolved (pulling from different places in config based on the build type, etc.)

Over the next couple weeks I'll push up PRs for individual test suites, migrating them over to the new production config, hopefully in a short period of time we will have all the function test suites back under that `test/function` config and can run them all against the Kibana server in production mode.
2018-08-16 12:15:58 -07:00
Spencer
595476bcf2
[kbn-test] use slightly more debug-friendly error output (#21985)
A couple times while debugging failures in `functional_tests(_servers)` with people I've asked for stack traces and received responses like "that's all there is", and it turns out that's right, because the cli's are passing the error object directly to `chalk.red()`, which converts it into a string that only includes the message. This pr moves the common operations from `run_tests/cli.js` and `run_servers/cli.js` into `lib/run_cli` and includes test for the common functionality there, as well as a common error printing logic that still includes the red message, but also includes a stack trace that will help out a lot in debugging.
2018-08-15 09:50:42 -07:00
spalger
cc6e5db602 [kbn-pm] update build 2018-08-09 14:47:01 -07:00
Court Ewing
d32a65230b
[kbn-pm] remove lodash from test fixtures (#21848) 2018-08-09 16:41:55 -04:00
Lee Drengenberg
da1268d322
Fix es unzip (#21817)
* Rebuild modulePath correctly if on Windows

* fix it so we create empty dirs like /logs/
2018-08-09 09:08:33 -05:00
Maryia Lapata
474714a6e4 Guideline for i18n engine (#20620)
* Add Guideline for i18n engine

* Update Guideline according to changes in i18n engine.

* Update examples in Guideline

* typo

* improve i18n guideline: add table for better view, use single quotes for js strings, fix description for testing, use uniq "message id" name

* fix readme description for guideline

Co-authored-by: maryia-lapata "mary.lopato@gmail.com"
2018-08-09 11:38:38 +03:00
Jonathan Budzenski
857e69f93c
[kbn-pm] Add optimize dir to kbn clean (#20945)
* [kbn-pm] Add optimize dir to kbn clean

* update snapshot
2018-08-08 07:39:15 -05:00
Spencer
4f0d2ade1e
[kbn-test] convert kibana-install-dir flag to installDir option (#21317)
* [kbn-test] convert kibana-install-dir flag to installDir option

* [kbn-test] replicate kibana-install-dir handling to startServers

* [ftr] try running functional tests in production in CI

* Revert "[ftr] try running functional tests in production in CI"

This reverts commit e5b94aa024.

* [core/public/legacyPlatform] exclude ui/test_harness from the distributable

* [optimizer] fix `process.env.IS_KIBANA_DISTRIBUTABLE` definition

* [optimizer] only define `process.env.IS_KIBANA_DISTRIBUTABLE` when needed

Adding a `webpack.DefinePlugin` slows down the optimizer a small amount,
so only apply it when it is necessary, and skip it if it is going to
be defined as "false".

* [kbn-test/startServer] don't run in --dev mode if running from dist

* [ftr/kibanaServer/version] attach `-SNAPSHOT` suffix to version if running build_snapshot
2018-08-02 17:23:34 -07:00
Aliaksandr Yankouski
9f3e36b170
Set kibana locale in kibana.yml config (#21201)
* set kibana locale in kibana.yml config

* remove accept-language-parser

* remove unnecessary tests

* fix readme description, fix description for locale in kibana.yml

* add point, that i18n.locale option should have exact match

* update kbn/i18n README

* Update README.md

* use getUiTranslations in render_mixin, remove i18n_mixin

* move registering translation files to mixin function
2018-08-02 14:43:22 +03:00
Felix Stürmer
1211efdf40
Upgrade prettier to version 1.14.0 (#21466)
This upgrades prettier to version 1.14.0. The main motivation is to gain support for the new TypeScript language features introduced in 2.9 and 3.0.

Prettier versions 1.13 and 1.14 also introduced some other JavaScript and TypeScript style improvements resulting in a few small line break and parenthesis changes.

The relevant release notes are:

* [Prettier 1.13.0 Release Notes](https://prettier.io/blog/2018/05/27/1.13.0.html)
* [Prettier 1.40.0 Release Notes](https://prettier.io/blog/2018/07/29/1.14.0.html)
2018-07-31 15:30:36 +02:00
Spencer
1532c5e9aa
Migrate ui/notify/fatal_error to new platform (#20752)
Fixes #20695

Extracts the "fatal error" handling logic from the `ui/notify` module and reimplements it in the new platform, using EUI for the fatal error page and continuing to support the `fatalError()` and `addFatalErrorCallback()` methods exported by the `ui/notify` module.

![image](https://user-images.githubusercontent.com/1329312/43032175-d37fbafc-8c65-11e8-8f1f-da71f0dac014.png)
2018-07-30 15:06:31 -07:00
Joe Fleming
1eaed69548
fix: name in import resolver readme (#21316)
use @kbn instead of @elastic to match the name in the package.json
2018-07-27 11:04:55 -07:00
Tyler Smalley
489e5bbbe6
[kbn-es] Only enable security for trial (#20803)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-07-26 14:41:06 -07:00
Maxim Tolochko
1e7ce26303 I18n tests (#20306)
* Add unit-tests for i18n engine

* tests for angular wrappers under i18n engine

* split to packages in accordance to specific library

* split to packages depending on tech and environment

* make env modules names consistent

* remove intl polyfilling

* move laoder to root, i18n folder to core

* Add unit-tests for i18n engine

* tests for angular wrappers under i18n engine

* rebase on split package, injectIntl component

* eslint fixes

* use method names for checking, test i18n-values in directive

* use real html content while testing directive

* add test for angular directive without values
2018-07-24 12:06:26 +03:00
Spencer
5afd06b5e5
[devUtils/procRunner] wait for proc to exit so we fallback to SIGKILL (#20918) 2018-07-18 14:30:16 -07:00
Aliaksandr Yankouski
4445c58988
Use only core in browser environment, loader in node env (#20905)
* use only core in browser environment and loader only in node env

* do not reexport node stuff from browser
2018-07-18 18:02:37 +03:00
Spencer
8662475834
[core/ui] bootstrap the legacy platform within the new platform (#20699)
Fixes #20694

Implements super basic new platform `core` system, which includes two services: `core.injectedMetadata` and `core.legacyPlatform`. The `core` currently has two responsibilities:

 1. read the metadata from the DOM and initialize the `ui/metadata` module with legacy metadata, proving out how we plan to expose data from the new platform through the existing APIs/modules to the legacy platform.
 2. bootstrap the legacy platform by loading either `ui/chrome` or `ui/test_harness`

Because `core` mutates the `ui/metadata` module before bootstrapping the legacy platform all existing consumers of `ui/metadata` won't be impacted by the fact that metadata loading was moved into the new platform. We plan to do this for many other services that will need to exist in both the legacy and new platforms, like `ui/chrome` (see #20696).
2018-07-17 22:07:13 -07:00
Stacey Gammon
e90f652875
Bump eui (#20774)
* bump eui

* Fixed breaking `EuiPage` changes

Mainly adding `EuiPageBody`’s where there were none

* bump to 3.0, remove duplicate declaration of EuiFlyoutBody, update jest snapshots

* bump eui

* bump to 3.0, remove duplicate declaration of EuiFlyoutBody, update jest snapshots

* Update jest snapshots in xpack
2018-07-17 19:28:07 -04:00
Hanqing Zhao
17eebb9ba3 [kbn-plugin-generator] Fix plugin naming inconsistency (#20808)
<!--
Thank you for your interest in and contributing to Kibana! There
are a few simple things to check before submitting your pull request
that can help with the review process. You should delete these items
from your submission, but they are here to help bring them to your
attention.

- Have you signed the [contributor license agreement](https://www.elastic.co/contributor-agreement)?
- Have you followed the [contributor guidelines](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md)?
- If submitting code, have you included unit tests that cover the changes?
- If submitting code, have you tested and built your code locally prior to submission with `yarn test && yarn build`?
- If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
-->
Make relevant generated files use snakeCase instead of kebabCase
Closes #20524
2018-07-17 12:01:52 -07:00
Tyler Smalley
ac1a922124
[test][kbn-plugin-helpers] Skip install dependencies (#20649)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-07-16 21:38:39 -07:00
Felix Stürmer
4b255e9fe9
Upgrade typescript to 2.9.2 (#20757)
This upgrades TypeScript to version 2.9.2. My main motivation is the support for generic type arguments in JSX elements and tagged templates (e.g. for `styled-components`).

Problems arising from breaking changes in the new TypeScript version have been mitigated by:

* setting the `keyofStringsOnly` option until impacted code has been
  future-proofed
* Restricting some joi-related generics

See the [release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html) for details.

Some follow-up tasks should be:

* Update EUI to support the new `keyof` behaviour
* Update new platform TypeScript code to support new `keyof` behaviour
* Remove `keyofStringsOnly` setting
2018-07-17 00:31:05 +02:00
Tyler Smalley
46bacc6c64
Workaround for yarn interdependency conflicts (#20805)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-07-16 07:42:49 -07:00
Aliaksandr Yankouski
adc4185898
Split i18n engine to specific parts by tech and by env (#20513)
* split to packages in accordance to specific library

* split to packages depending on tech and environment

* make env modules names consistent

* remove intl polyfilling

* move laoder to root, i18n folder to core
2018-07-16 17:02:06 +03:00
Aliaksandr Yankouski
92774b7b09
Use injectI18n Higher-Order Component instead of I18nContext (#20542)
* add implementation of I18nContext, docs for injectI18n hoc

* remove i18nContext wrapper, add docs for react components as classes
2018-07-13 12:21:50 +03:00
Tiago Costa
b142f80d7d
Match chalk dependency version on kibana with the one used on x-pack (#20621)
* chore(NA): match chalk dependency version on kibana with x-pack to ^2.3.2.

* chore(NA): bump chalk version dependencies and update lock files.
2018-07-13 00:26:57 +01:00
Marco Vettorello
6ef8f6355e
[kbn-plugin-generator] Fix eslint dependencies and template code linting (#20517)
* Add missing peer dependency and upgraded to new import resolver kibana

* Fixed template code to follow eslint rules

* Fix lint script to lint all files in the generated dir

* More precise slurp :p
2018-07-10 12:33:50 +02:00
Tim Roes
cb5ee01c6a
Increase prettier line width to 100 (#20535)
* Increase prettier line width to 100

* Fix packages JS prettier

* Change style guide to 100 width

* Fix line-width in latest master changes
2018-07-09 22:50:37 +02:00
Tyler Smalley
ee0610bd6b
[kbn-es] Windows uses zip snapshot, Linux uses tar. (#20503)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-07-09 09:35:51 -07:00