From c347097af314a20ff02ac8c99f66d5d448e537d3 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 13 Aug 2019 14:13:17 -0600 Subject: [PATCH 01/41] Add first test + confs for babel and jest, and add yarn script. --- .../__tests__/build.ispec.js | 48 ++++ packages/kbn-plugin-generator/babel.config.js | 31 +++ .../jest.config.integration.js | 27 ++ packages/kbn-plugin-generator/package.json | 9 + yarn.lock | 262 ++++++++++++++++++ 5 files changed, 377 insertions(+) create mode 100644 packages/kbn-plugin-generator/__tests__/build.ispec.js create mode 100644 packages/kbn-plugin-generator/babel.config.js create mode 100644 packages/kbn-plugin-generator/jest.config.integration.js diff --git a/packages/kbn-plugin-generator/__tests__/build.ispec.js b/packages/kbn-plugin-generator/__tests__/build.ispec.js new file mode 100644 index 0000000000000..36709b994c8f8 --- /dev/null +++ b/packages/kbn-plugin-generator/__tests__/build.ispec.js @@ -0,0 +1,48 @@ +/* + * 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. + */ + +/* eslint-disable no-restricted-syntax */ +import { spawn } from 'child_process'; +import { resolve } from 'path'; +import { promises } from 'fs'; +import { snakeCase } from 'lodash'; + +const ROOT_DIR = resolve(__dirname, '../../../'); + +describe('build a plugin', () => { + const pluginName = 'ispec-plugin'; + const snakeCased = snakeCase(pluginName); + // eslint-disable-next-line no-undef + beforeAll(done => { + const create = spawn(process.execPath, ['scripts/generate_plugin.js', pluginName], { + cwd: ROOT_DIR, + }); + create.stdout.on('data', () => { + create.stdin.write('\n'); + }); + create.on('close', done); + }, 150000); + + it(`should have created a plugin in a directory named ${snakeCased}`, async () => { + const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); + const stats = await promises.stat(generatedPath); + // eslint-disable-next-line no-undef + expect(stats.isDirectory()).toBe(true); + }); +}); diff --git a/packages/kbn-plugin-generator/babel.config.js b/packages/kbn-plugin-generator/babel.config.js new file mode 100644 index 0000000000000..efae53c033e6d --- /dev/null +++ b/packages/kbn-plugin-generator/babel.config.js @@ -0,0 +1,31 @@ +/* + * 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. + */ + +module.exports = { + presets: [ + [ + '@babel/preset-env', + { + targets: { + node: 'current', + }, + }, + ], + ], +}; diff --git a/packages/kbn-plugin-generator/jest.config.integration.js b/packages/kbn-plugin-generator/jest.config.integration.js new file mode 100644 index 0000000000000..4137aeeadc96c --- /dev/null +++ b/packages/kbn-plugin-generator/jest.config.integration.js @@ -0,0 +1,27 @@ +/* + * 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. + */ + +const config = { + testRegex: `ispec\\.js$`, + transform: { + '^.+\\.[t|j]sx?$': 'babel-jest', + }, +}; + +module.exports = config; diff --git a/packages/kbn-plugin-generator/package.json b/packages/kbn-plugin-generator/package.json index a26371be863db..27f70a8ace1b6 100644 --- a/packages/kbn-plugin-generator/package.json +++ b/packages/kbn-plugin-generator/package.json @@ -13,5 +13,14 @@ "lodash.snakecase": "^4.1.1", "lodash.startcase": "^4.4.0", "sao": "^0.22.12" + }, + "scripts": { + "test": "jest -c jest.config.integration.js" + }, + "devDependencies": { + "@babel/core": "^7.5.5", + "@babel/preset-env": "^7.5.5", + "babel-jest": "^24.8.0", + "jest": "^24.8.0" } } diff --git a/yarn.lock b/yarn.lock index 4cb975f6b4669..11854fb058926 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35,6 +35,13 @@ esutils "^2.0.2" js-tokens "^3.0.0" +"@babel/code-frame@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" + integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== + dependencies: + "@babel/highlight" "^7.0.0" + "@babel/core@7.2.2": version "7.2.2" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.2.tgz#07adba6dde27bb5ad8d8672f15fde3e08184a687" @@ -115,6 +122,26 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/core@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" + integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.5.5" + "@babel/helpers" "^7.5.5" + "@babel/parser" "^7.5.5" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/generator@^7.0.0", "@babel/generator@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.3.4.tgz#9aa48c1989257877a9d971296e5b73bfe72e446e" @@ -148,6 +175,17 @@ source-map "^0.5.0" trim-right "^1.0.1" +"@babel/generator@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" + integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== + dependencies: + "@babel/types" "^7.5.5" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + trim-right "^1.0.1" + "@babel/helper-annotate-as-pure@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" @@ -249,6 +287,15 @@ "@babel/types" "^7.4.4" lodash "^4.17.11" +"@babel/helper-define-map@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz#3dec32c2046f37e09b28c93eb0b103fd2a25d369" + integrity sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/types" "^7.5.5" + lodash "^4.17.13" + "@babel/helper-explode-assignable-expression@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" @@ -301,6 +348,13 @@ dependencies: "@babel/types" "^7.0.0" +"@babel/helper-member-expression-to-functions@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" + integrity sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA== + dependencies: + "@babel/types" "^7.5.5" + "@babel/helper-module-imports@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" @@ -399,6 +453,16 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" +"@babel/helper-replace-supers@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz#f84ce43df031222d2bad068d2626cb5799c34bc2" + integrity sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.5.5" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + "@babel/helper-simple-access@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" @@ -456,6 +520,15 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" +"@babel/helpers@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.5.tgz#63908d2a73942229d1e6685bc2a0e730dde3b75e" + integrity sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g== + dependencies: + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + "@babel/highlight@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" @@ -485,6 +558,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.4.tgz#5977129431b8fe33471730d255ce8654ae1250b6" integrity sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w== +"@babel/parser@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" + integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== + "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" @@ -527,6 +605,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-decorators" "^7.2.0" +"@babel/plugin-proposal-dynamic-import@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz#e532202db4838723691b10a67b8ce509e397c506" + integrity sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-proposal-json-strings@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" @@ -559,6 +645,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" +"@babel/plugin-proposal-object-rest-spread@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" + integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-proposal-optional-catch-binding@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" @@ -689,6 +783,15 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-remap-async-to-generator" "^7.1.0" +"@babel/plugin-transform-async-to-generator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" + integrity sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/plugin-transform-block-scoped-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" @@ -712,6 +815,14 @@ "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.11" +"@babel/plugin-transform-block-scoping@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.5.5.tgz#a35f395e5402822f10d2119f6f8e045e3639a2ce" + integrity sha512-82A3CLRRdYubkG85lKwhZB0WZoHxLGsJdux/cOVaJCJpvYFl1LVzAIFyRsa7CvXqW8rBM4Zf3Bfn8PHt5DP0Sg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.13" + "@babel/plugin-transform-classes@7.2.2": version "7.2.2" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.2.tgz#6c90542f210ee975aa2aa8c8b5af7fa73a126953" @@ -754,6 +865,20 @@ "@babel/helper-split-export-declaration" "^7.4.4" globals "^11.1.0" +"@babel/plugin-transform-classes@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.5.5.tgz#d094299d9bd680a14a2a0edae38305ad60fb4de9" + integrity sha512-U2htCNK/6e9K7jGyJ++1p5XRU+LJjrwtoiVn9SzRlDT2KubcZ11OOwy3s24TjHxPgxNwonCYP7U2K51uVYCMDg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-define-map" "^7.5.5" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-split-export-declaration" "^7.4.4" + globals "^11.1.0" + "@babel/plugin-transform-computed-properties@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" @@ -789,6 +914,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-destructuring@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" + integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-dotall-regex@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.2.0.tgz#f0aabb93d120a8ac61e925ea0ba440812dbe0e49" @@ -814,6 +946,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-duplicate-keys@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" + integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-exponentiation-operator@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" @@ -897,6 +1036,15 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-modules-amd@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" + integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-commonjs@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz#c4f1933f5991d5145e9cfad1dfd848ea1727f404" @@ -924,6 +1072,16 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-simple-access" "^7.1.0" +"@babel/plugin-transform-modules-commonjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz#425127e6045231360858eeaa47a71d75eded7a74" + integrity sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ== + dependencies: + "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-systemjs@^7.2.0", "@babel/plugin-transform-modules-systemjs@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.0.tgz#c2495e55528135797bc816f5d50f851698c586a1" @@ -940,6 +1098,15 @@ "@babel/helper-hoist-variables" "^7.4.4" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-modules-systemjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz#e75266a13ef94202db2a0620977756f51d52d249" + integrity sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-umd@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" @@ -998,6 +1165,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.1.0" +"@babel/plugin-transform-object-super@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz#c70021df834073c65eb613b8679cc4a381d1a9f9" + integrity sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/plugin-transform-parameters@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz#0d5ad15dc805e2ea866df4dd6682bfe76d1408c2" @@ -1376,6 +1551,62 @@ js-levenshtein "^1.1.3" semver "^5.3.0" +"@babel/preset-env@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.5.tgz#bc470b53acaa48df4b8db24a570d6da1fef53c9a" + integrity sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.5.5" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.5.5" + "@babel/plugin-transform-classes" "^7.5.5" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.5.0" + "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-duplicate-keys" "^7.5.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.4.4" + "@babel/plugin-transform-function-name" "^7.4.4" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-member-expression-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.5.0" + "@babel/plugin-transform-modules-commonjs" "^7.5.0" + "@babel/plugin-transform-modules-systemjs" "^7.5.0" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" + "@babel/plugin-transform-new-target" "^7.4.4" + "@babel/plugin-transform-object-super" "^7.5.5" + "@babel/plugin-transform-parameters" "^7.4.4" + "@babel/plugin-transform-property-literals" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-reserved-words" "^7.2.0" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.4.4" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.4.4" + "@babel/types" "^7.5.5" + browserslist "^4.6.0" + core-js-compat "^3.1.1" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.5.0" + "@babel/preset-flow@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" @@ -1537,6 +1768,21 @@ globals "^11.1.0" lodash "^4.17.11" +"@babel/traverse@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" + integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.5.5" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.5.5" + "@babel/types" "^7.5.5" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + "@babel/types@7.4.4", "@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0", "@babel/types@^7.3.4", "@babel/types@^7.4.0", "@babel/types@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" @@ -1546,6 +1792,15 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" +"@babel/types@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" + integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + "@cnakazawa/watch@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" @@ -6304,6 +6559,13 @@ babel-plugin-dynamic-import-node@2.2.0, babel-plugin-dynamic-import-node@^2.2.0: dependencies: object.assign "^4.1.0" +babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== + dependencies: + object.assign "^4.1.0" + babel-plugin-emotion@^10.0.7, babel-plugin-emotion@^10.0.9: version "10.0.9" resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.9.tgz#04a0404d5a4084d5296357a393d344c0f8303ae4" From 36f22199b16a5475881c178e7b2eb07af0e919d9 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 13 Aug 2019 15:04:16 -0600 Subject: [PATCH 02/41] Add cleanup using del. --- packages/kbn-plugin-generator/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kbn-plugin-generator/package.json b/packages/kbn-plugin-generator/package.json index 27f70a8ace1b6..177b39be5ffa7 100644 --- a/packages/kbn-plugin-generator/package.json +++ b/packages/kbn-plugin-generator/package.json @@ -21,6 +21,7 @@ "@babel/core": "^7.5.5", "@babel/preset-env": "^7.5.5", "babel-jest": "^24.8.0", + "del": "^5.0.0", "jest": "^24.8.0" } } From 664fed0e50e711d0802f11194f088b9912a1aa02 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 13 Aug 2019 15:07:29 -0600 Subject: [PATCH 03/41] Add missing commit --- .../kbn-plugin-generator/__tests__/build.ispec.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/kbn-plugin-generator/__tests__/build.ispec.js b/packages/kbn-plugin-generator/__tests__/build.ispec.js index 36709b994c8f8..69392b6141034 100644 --- a/packages/kbn-plugin-generator/__tests__/build.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/build.ispec.js @@ -22,12 +22,15 @@ import { spawn } from 'child_process'; import { resolve } from 'path'; import { promises } from 'fs'; import { snakeCase } from 'lodash'; +import * as del from 'del'; const ROOT_DIR = resolve(__dirname, '../../../'); +const oneMinute = 60000; describe('build a plugin', () => { const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); + const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); // eslint-disable-next-line no-undef beforeAll(done => { const create = spawn(process.execPath, ['scripts/generate_plugin.js', pluginName], { @@ -37,10 +40,14 @@ describe('build a plugin', () => { create.stdin.write('\n'); }); create.on('close', done); - }, 150000); + }, oneMinute); + + // eslint-disable-next-line no-undef + afterAll(() => { + del.sync(generatedPath, { force: true }); + }, oneMinute); it(`should have created a plugin in a directory named ${snakeCased}`, async () => { - const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); const stats = await promises.stat(generatedPath); // eslint-disable-next-line no-undef expect(stats.isDirectory()).toBe(true); From 8acb3ff50ce95f2a822f394d74ee7e0785c694b2 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 13 Aug 2019 16:32:24 -0600 Subject: [PATCH 04/41] Add first fail case. After the fixups are merged, these should fail. --- ...uild.ispec.js => generate_plugin.ispec.js} | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) rename packages/kbn-plugin-generator/__tests__/{build.ispec.js => generate_plugin.ispec.js} (70%) diff --git a/packages/kbn-plugin-generator/__tests__/build.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js similarity index 70% rename from packages/kbn-plugin-generator/__tests__/build.ispec.js rename to packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 69392b6141034..15dfec43d669f 100644 --- a/packages/kbn-plugin-generator/__tests__/build.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -20,14 +20,14 @@ /* eslint-disable no-restricted-syntax */ import { spawn } from 'child_process'; import { resolve } from 'path'; -import { promises } from 'fs'; +import { promises as fsP } from 'fs'; import { snakeCase } from 'lodash'; import * as del from 'del'; const ROOT_DIR = resolve(__dirname, '../../../'); const oneMinute = 60000; -describe('build a plugin', () => { +describe('running the plugin-generator', () => { const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); @@ -47,9 +47,28 @@ describe('build a plugin', () => { del.sync(generatedPath, { force: true }); }, oneMinute); - it(`should have created a plugin in a directory named ${snakeCased}`, async () => { - const stats = await promises.stat(generatedPath); + it(`should succeed on creating a plugin in a directory named ${snakeCased}`, async () => { + const stats = await fsP.stat(generatedPath); // eslint-disable-next-line no-undef expect(stats.isDirectory()).toBe(true); }); + + it( + `should fail on 'yarn lint' within the plugin's root dir`, + done => { + const yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); + + yarnLint.stderr.on('data', data => { + // eslint-disable-next-line no-undef + expect(data.includes('Error:')); + }); + + yarnLint.on('close', data => { + // eslint-disable-next-line no-undef + expect(data).not.toBe(0); // Not exit code 0 + done(); + }); + }, + oneMinute + ); }); From c5fc55baddb1dc48e9e2e9f572e6c6bfc590e703 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 13 Aug 2019 16:49:41 -0600 Subject: [PATCH 05/41] Add a list of currently failing yarn commands. When these fail, that means the broken commands have been fixed. --- .../__tests__/generate_plugin.ispec.js | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 15dfec43d669f..6ea1f0024fecc 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -31,6 +31,7 @@ describe('running the plugin-generator', () => { const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); + const currentlyFailing = ['lint', 'test:browser', 'test:mocha']; // eslint-disable-next-line no-undef beforeAll(done => { const create = spawn(process.execPath, ['scripts/generate_plugin.js', pluginName], { @@ -53,22 +54,23 @@ describe('running the plugin-generator', () => { expect(stats.isDirectory()).toBe(true); }); - it( - `should fail on 'yarn lint' within the plugin's root dir`, - done => { - const yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); - - yarnLint.stderr.on('data', data => { - // eslint-disable-next-line no-undef - expect(data.includes('Error:')); - }); - - yarnLint.on('close', data => { - // eslint-disable-next-line no-undef - expect(data).not.toBe(0); // Not exit code 0 - done(); - }); - }, - oneMinute - ); + currentlyFailing.forEach(x => { + it( + `should fail on 'yarn ${x}' within the plugin's root dir`, + done => { + console.log(`\n### Testing 'yarn ${x}'`); + const yarnCmd = spawn('yarn', [x], { cwd: generatedPath }); + yarnCmd.stderr.on('data', data => { + // eslint-disable-next-line no-undef + expect(data.includes('Error:')); + }); + yarnCmd.on('close', data => { + // eslint-disable-next-line no-undef + expect(data).not.toBe(0); // Not exit code 0 + done(); + }); + }, + oneMinute * 3 + ); + }); }); From 87706a94ea6aac4784ae419fdc19ed03fabef859 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 13 Aug 2019 18:21:03 -0600 Subject: [PATCH 06/41] Drop locally added deps to fixup the 'git changes' check --- packages/kbn-plugin-generator/package.json | 7 - yarn.lock | 262 --------------------- 2 files changed, 269 deletions(-) diff --git a/packages/kbn-plugin-generator/package.json b/packages/kbn-plugin-generator/package.json index 177b39be5ffa7..7de7e501aae61 100644 --- a/packages/kbn-plugin-generator/package.json +++ b/packages/kbn-plugin-generator/package.json @@ -16,12 +16,5 @@ }, "scripts": { "test": "jest -c jest.config.integration.js" - }, - "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/preset-env": "^7.5.5", - "babel-jest": "^24.8.0", - "del": "^5.0.0", - "jest": "^24.8.0" } } diff --git a/yarn.lock b/yarn.lock index 11854fb058926..4cb975f6b4669 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35,13 +35,6 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" - integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== - dependencies: - "@babel/highlight" "^7.0.0" - "@babel/core@7.2.2": version "7.2.2" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.2.tgz#07adba6dde27bb5ad8d8672f15fde3e08184a687" @@ -122,26 +115,6 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" - integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" - "@babel/helpers" "^7.5.5" - "@babel/parser" "^7.5.5" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - convert-source-map "^1.1.0" - debug "^4.1.0" - json5 "^2.1.0" - lodash "^4.17.13" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - "@babel/generator@^7.0.0", "@babel/generator@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.3.4.tgz#9aa48c1989257877a9d971296e5b73bfe72e446e" @@ -175,17 +148,6 @@ source-map "^0.5.0" trim-right "^1.0.1" -"@babel/generator@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" - integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== - dependencies: - "@babel/types" "^7.5.5" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - trim-right "^1.0.1" - "@babel/helper-annotate-as-pure@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" @@ -287,15 +249,6 @@ "@babel/types" "^7.4.4" lodash "^4.17.11" -"@babel/helper-define-map@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz#3dec32c2046f37e09b28c93eb0b103fd2a25d369" - integrity sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg== - dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/types" "^7.5.5" - lodash "^4.17.13" - "@babel/helper-explode-assignable-expression@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" @@ -348,13 +301,6 @@ dependencies: "@babel/types" "^7.0.0" -"@babel/helper-member-expression-to-functions@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" - integrity sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA== - dependencies: - "@babel/types" "^7.5.5" - "@babel/helper-module-imports@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" @@ -453,16 +399,6 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" -"@babel/helper-replace-supers@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz#f84ce43df031222d2bad068d2626cb5799c34bc2" - integrity sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.5.5" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - "@babel/helper-simple-access@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" @@ -520,15 +456,6 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" -"@babel/helpers@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.5.tgz#63908d2a73942229d1e6685bc2a0e730dde3b75e" - integrity sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g== - dependencies: - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - "@babel/highlight@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" @@ -558,11 +485,6 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.4.tgz#5977129431b8fe33471730d255ce8654ae1250b6" integrity sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w== -"@babel/parser@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" - integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== - "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" @@ -605,14 +527,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-decorators" "^7.2.0" -"@babel/plugin-proposal-dynamic-import@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz#e532202db4838723691b10a67b8ce509e397c506" - integrity sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-proposal-json-strings@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" @@ -645,14 +559,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" - integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-proposal-optional-catch-binding@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" @@ -783,15 +689,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-remap-async-to-generator" "^7.1.0" -"@babel/plugin-transform-async-to-generator@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" - integrity sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.1.0" - "@babel/plugin-transform-block-scoped-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" @@ -815,14 +712,6 @@ "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.11" -"@babel/plugin-transform-block-scoping@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.5.5.tgz#a35f395e5402822f10d2119f6f8e045e3639a2ce" - integrity sha512-82A3CLRRdYubkG85lKwhZB0WZoHxLGsJdux/cOVaJCJpvYFl1LVzAIFyRsa7CvXqW8rBM4Zf3Bfn8PHt5DP0Sg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.13" - "@babel/plugin-transform-classes@7.2.2": version "7.2.2" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.2.tgz#6c90542f210ee975aa2aa8c8b5af7fa73a126953" @@ -865,20 +754,6 @@ "@babel/helper-split-export-declaration" "^7.4.4" globals "^11.1.0" -"@babel/plugin-transform-classes@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.5.5.tgz#d094299d9bd680a14a2a0edae38305ad60fb4de9" - integrity sha512-U2htCNK/6e9K7jGyJ++1p5XRU+LJjrwtoiVn9SzRlDT2KubcZ11OOwy3s24TjHxPgxNwonCYP7U2K51uVYCMDg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-define-map" "^7.5.5" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.5.5" - "@babel/helper-split-export-declaration" "^7.4.4" - globals "^11.1.0" - "@babel/plugin-transform-computed-properties@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" @@ -914,13 +789,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" - integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-dotall-regex@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.2.0.tgz#f0aabb93d120a8ac61e925ea0ba440812dbe0e49" @@ -946,13 +814,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-duplicate-keys@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" - integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-exponentiation-operator@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" @@ -1036,15 +897,6 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-amd@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" - integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== - dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" - "@babel/plugin-transform-modules-commonjs@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz#c4f1933f5991d5145e9cfad1dfd848ea1727f404" @@ -1072,16 +924,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-simple-access" "^7.1.0" -"@babel/plugin-transform-modules-commonjs@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz#425127e6045231360858eeaa47a71d75eded7a74" - integrity sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ== - dependencies: - "@babel/helper-module-transforms" "^7.4.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - babel-plugin-dynamic-import-node "^2.3.0" - "@babel/plugin-transform-modules-systemjs@^7.2.0", "@babel/plugin-transform-modules-systemjs@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.0.tgz#c2495e55528135797bc816f5d50f851698c586a1" @@ -1098,15 +940,6 @@ "@babel/helper-hoist-variables" "^7.4.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-systemjs@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz#e75266a13ef94202db2a0620977756f51d52d249" - integrity sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg== - dependencies: - "@babel/helper-hoist-variables" "^7.4.4" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" - "@babel/plugin-transform-modules-umd@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" @@ -1165,14 +998,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.1.0" -"@babel/plugin-transform-object-super@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz#c70021df834073c65eb613b8679cc4a381d1a9f9" - integrity sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.5.5" - "@babel/plugin-transform-parameters@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz#0d5ad15dc805e2ea866df4dd6682bfe76d1408c2" @@ -1551,62 +1376,6 @@ js-levenshtein "^1.1.3" semver "^5.3.0" -"@babel/preset-env@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.5.tgz#bc470b53acaa48df4b8db24a570d6da1fef53c9a" - integrity sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-dynamic-import" "^7.5.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.5.5" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.5.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.5.5" - "@babel/plugin-transform-classes" "^7.5.5" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.5.0" - "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/plugin-transform-duplicate-keys" "^7.5.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.4.4" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.5.0" - "@babel/plugin-transform-modules-commonjs" "^7.5.0" - "@babel/plugin-transform-modules-systemjs" "^7.5.0" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.5.5" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.4.5" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.4.4" - "@babel/types" "^7.5.5" - browserslist "^4.6.0" - core-js-compat "^3.1.1" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.5.0" - "@babel/preset-flow@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" @@ -1768,21 +1537,6 @@ globals "^11.1.0" lodash "^4.17.11" -"@babel/traverse@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" - integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.5.5" - "@babel/types" "^7.5.5" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - "@babel/types@7.4.4", "@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0", "@babel/types@^7.3.4", "@babel/types@^7.4.0", "@babel/types@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" @@ -1792,15 +1546,6 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" -"@babel/types@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" - integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw== - dependencies: - esutils "^2.0.2" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - "@cnakazawa/watch@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" @@ -6559,13 +6304,6 @@ babel-plugin-dynamic-import-node@2.2.0, babel-plugin-dynamic-import-node@^2.2.0: dependencies: object.assign "^4.1.0" -babel-plugin-dynamic-import-node@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" - integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== - dependencies: - object.assign "^4.1.0" - babel-plugin-emotion@^10.0.7, babel-plugin-emotion@^10.0.9: version "10.0.9" resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.9.tgz#04a0404d5a4084d5296357a393d344c0f8303ae4" From 782a5afd79b6e7caff347d8a771b4b31f2facca2 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 13 Aug 2019 19:05:18 -0600 Subject: [PATCH 07/41] Increase timeout for running in ci --- .../kbn-plugin-generator/__tests__/generate_plugin.ispec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 6ea1f0024fecc..8fd0aa0dc2a46 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -70,7 +70,7 @@ describe('running the plugin-generator', () => { done(); }); }, - oneMinute * 3 + oneMinute * 9 ); }); }); From fafcdeb154869d84570cf7a9a97886ebd4fb0ea0 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 14 Aug 2019 09:38:14 -0600 Subject: [PATCH 08/41] Drop fail cases per review, and bump global timeout for this test. --- .../__tests__/generate_plugin.ispec.js | 32 ++++++------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 8fd0aa0dc2a46..b947b338bf4b6 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -31,7 +31,13 @@ describe('running the plugin-generator', () => { const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); - const currentlyFailing = ['lint', 'test:browser', 'test:mocha']; + + // eslint-disable-next-line no-undef + beforeAll(() => { + // eslint-disable-next-line no-undef + jest.setTimeout(oneMinute); + }); + // eslint-disable-next-line no-undef beforeAll(done => { const create = spawn(process.execPath, ['scripts/generate_plugin.js', pluginName], { @@ -41,36 +47,16 @@ describe('running the plugin-generator', () => { create.stdin.write('\n'); }); create.on('close', done); - }, oneMinute); + }); // eslint-disable-next-line no-undef afterAll(() => { del.sync(generatedPath, { force: true }); - }, oneMinute); + }); it(`should succeed on creating a plugin in a directory named ${snakeCased}`, async () => { const stats = await fsP.stat(generatedPath); // eslint-disable-next-line no-undef expect(stats.isDirectory()).toBe(true); }); - - currentlyFailing.forEach(x => { - it( - `should fail on 'yarn ${x}' within the plugin's root dir`, - done => { - console.log(`\n### Testing 'yarn ${x}'`); - const yarnCmd = spawn('yarn', [x], { cwd: generatedPath }); - yarnCmd.stderr.on('data', data => { - // eslint-disable-next-line no-undef - expect(data.includes('Error:')); - }); - yarnCmd.on('close', data => { - // eslint-disable-next-line no-undef - expect(data).not.toBe(0); // Not exit code 0 - done(); - }); - }, - oneMinute * 9 - ); - }); }); From 4aa9dfdd553f749c8430eb9fe52d43229e754d1f Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 14 Aug 2019 16:44:08 -0600 Subject: [PATCH 09/41] Update name and bump timeout --- .../kbn-plugin-generator/__tests__/generate_plugin.ispec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index b947b338bf4b6..354cfd1f0d846 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -27,7 +27,7 @@ import * as del from 'del'; const ROOT_DIR = resolve(__dirname, '../../../'); const oneMinute = 60000; -describe('running the plugin-generator', () => { +describe(`running the plugin-generator via 'node scripts/generate_plugin.js plugin-name'`, () => { const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); @@ -35,7 +35,7 @@ describe('running the plugin-generator', () => { // eslint-disable-next-line no-undef beforeAll(() => { // eslint-disable-next-line no-undef - jest.setTimeout(oneMinute); + jest.setTimeout(oneMinute * 3); }); // eslint-disable-next-line no-undef From d59a17880cec6b618662ee4fd093171d4646081d Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 15 Aug 2019 10:30:41 -0600 Subject: [PATCH 10/41] Change the src code to make "yarn lint" not error. Add an integration test to verify the change. --- .../rules/no_restricted_paths.js | 2 +- .../__tests__/generate_plugin.ispec.js | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js b/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js index 9074c35d27c7e..7f77a6dda1cf4 100644 --- a/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js +++ b/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js @@ -78,7 +78,7 @@ module.exports = { }, allowSameFolder: { type: 'boolean' }, }, - additionalProperties: false, + additionalProperties: true, }, }, basePath: { type: 'string' }, diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 354cfd1f0d846..ba944346c5790 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -54,9 +54,28 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug del.sync(generatedPath, { force: true }); }); - it(`should succeed on creating a plugin in a directory named ${snakeCased}`, async () => { + it(`should succeed on creating a plugin in a directory named 'plugins/${snakeCased}`, async () => { const stats = await fsP.stat(generatedPath); // eslint-disable-next-line no-undef expect(stats.isDirectory()).toBe(true); }); + + describe(`and then running 'yarn lint' in the plugin's root dir`, () => { + it( + `should not show the '"@kbn/eslint/no-restricted-paths" is invalid' msg on stderr`, + done => { + const stdErrs = []; + const yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); + yarnLint.stderr.on('data', data => { + stdErrs.push(data + ''); + }); + yarnLint.on('close', () => { + // eslint-disable-next-line no-undef + expect(stdErrs.join('\n')).not.toContain('"@kbn/eslint/no-restricted-paths" is invalid'); + done(); + }); + }, + oneMinute * 3 + ); + }); }); From 7f7ad3246568c23bbbadb36e1f70b08f77ff973e Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 16 Aug 2019 09:41:02 -0600 Subject: [PATCH 11/41] Add verification for (yarn run kbn --help). --- .../__tests__/generate_plugin.ispec.js | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index ba944346c5790..3df28a6e1e4c9 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -31,6 +31,9 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); + const collect = xs => data => { + xs.push(data + ''); // Coerce from Buffer to String + }; // eslint-disable-next-line no-undef beforeAll(() => { @@ -66,9 +69,7 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug done => { const stdErrs = []; const yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); - yarnLint.stderr.on('data', data => { - stdErrs.push(data + ''); - }); + yarnLint.stderr.on('data', collect(stdErrs)); yarnLint.on('close', () => { // eslint-disable-next-line no-undef expect(stdErrs.join('\n')).not.toContain('"@kbn/eslint/no-restricted-paths" is invalid'); @@ -78,4 +79,37 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug oneMinute * 3 ); }); + + describe(`and then running 'yarn kbn --help'`, () => { + const helpMsg = ` +usage: kbn [] + +By default commands are run for Kibana itself, all packages in the 'packages/' +folder and for all plugins in './plugins' and '../kibana-extra'. + +Available commands: + + bootstrap - Install dependencies and crosslink projects + clean - Remove the node_modules and target directories from all projects. + run - Run script defined in package.json in each package that contains that script. + watch - Runs \`kbn:watch\` script for every project. + +Global options: + + -e, --exclude Exclude specified project. Can be specified multiple times to exclude multiple projects, e.g. '-e kibana -e @kbn/pm'. + -i, --include Include only specified projects. If left unspecified, it defaults to including all projects. + --oss Do not include the x-pack when running command. + --skip-kibana-plugins Filter all plugins in ./plugins and ../kibana-extra when running command. +`; + it(`should print out the help msg`, done => { + const outData = []; + const kbnHelp = spawn('yarn', ['kbn', '--help'], { cwd: generatedPath }); + kbnHelp.stdout.on('data', collect(outData)); + kbnHelp.on('close', () => { + // eslint-disable-next-line no-undef + expect(outData.join('\n')).toContain(helpMsg); + done(); + }); + }); + }); }); From ef89d20195b723aaafc6d008e8642dfcd26eb1d8 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 16 Aug 2019 16:29:44 -0600 Subject: [PATCH 12/41] Fixup the code for packages/kbn-eslint-import-resolver-kibana, and add refactor the integration tests to include verification for the code fixup. --- .../import_resolver_kibana.js | 2 + .../__tests__/generate_plugin.ispec.js | 43 +++++++++++-------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js b/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js index 5c409ade260b1..b77640adafc2c 100755 --- a/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js +++ b/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js @@ -69,6 +69,8 @@ function tryNodeResolver(importRequest, file, config) { exports.resolve = function resolveKibanaPath(importRequest, file, config) { config = config || {}; + if (/ui\/.+/.test(importRequest)) config.forceNode = false; // Refer to https://github.com/elastic/kibana/issues/17061#issuecomment-522157366 + if (config.forceNode) { return tryNodeResolver(importRequest, file, config); } diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 3df28a6e1e4c9..3f337c88be9cf 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -31,9 +31,7 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); - const collect = xs => data => { - xs.push(data + ''); // Coerce from Buffer to String - }; + const collect = xs => data => xs.push(data + ''); // Coerce from Buffer to String // eslint-disable-next-line no-undef beforeAll(() => { @@ -64,20 +62,29 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); describe(`and then running 'yarn lint' in the plugin's root dir`, () => { - it( - `should not show the '"@kbn/eslint/no-restricted-paths" is invalid' msg on stderr`, - done => { - const stdErrs = []; - const yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); - yarnLint.stderr.on('data', collect(stdErrs)); - yarnLint.on('close', () => { - // eslint-disable-next-line no-undef - expect(stdErrs.join('\n')).not.toContain('"@kbn/eslint/no-restricted-paths" is invalid'); - done(); - }); - }, - oneMinute * 3 - ); + const stdErrs = []; + const stdOuts = []; + let yarnLint; + + // eslint-disable-next-line no-undef + beforeAll(done => { + yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); + yarnLint.stderr.on('data', collect(stdErrs)); + yarnLint.stdout.on('data', collect(stdOuts)); + yarnLint.on('close', () => { + done(); // TODO: Why isnt the handler running point-free? + }); + }, oneMinute * 3); + + it(`should not show the '"@kbn/eslint/no-restricted-paths" is invalid' msg on stderr`, () => { + // eslint-disable-next-line no-undef + expect(stdErrs.join('\n')).not.toContain('"@kbn/eslint/no-restricted-paths" is invalid'); + }); + + it(`should not show the 'import/no-unresolved' msg on stdout`, () => { + // eslint-disable-next-line no-undef + expect(stdOuts.join('\n')).not.toContain('import/no-unresolved'); + }); }); describe(`and then running 'yarn kbn --help'`, () => { @@ -101,7 +108,7 @@ Global options: --oss Do not include the x-pack when running command. --skip-kibana-plugins Filter all plugins in ./plugins and ../kibana-extra when running command. `; - it(`should print out the help msg`, done => { + it(`should print out the kbn help msg`, done => { const outData = []; const kbnHelp = spawn('yarn', ['kbn', '--help'], { cwd: generatedPath }); kbnHelp.stdout.on('data', collect(outData)); From 52de4a92a7830564e3de767f5f1bb7ac43057c9f Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 19 Aug 2019 09:10:08 -0600 Subject: [PATCH 13/41] A little less code. --- .../kbn-plugin-generator/__tests__/generate_plugin.ispec.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 3f337c88be9cf..5ebe775e4605b 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -71,9 +71,7 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); yarnLint.stderr.on('data', collect(stdErrs)); yarnLint.stdout.on('data', collect(stdOuts)); - yarnLint.on('close', () => { - done(); // TODO: Why isnt the handler running point-free? - }); + yarnLint.on('close', () => done()); }, oneMinute * 3); it(`should not show the '"@kbn/eslint/no-restricted-paths" is invalid' msg on stderr`, () => { From 1af2bef77cf1b26c819f8455d1d7ab3ec2039b64 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 19 Aug 2019 09:40:25 -0600 Subject: [PATCH 14/41] Add es help msg verifcation. --- .../__tests__/generate_plugin.ispec.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 5ebe775e4605b..7e199df982e82 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -117,4 +117,32 @@ Global options: }); }); }); + describe(`and then running 'yarn es --help'`, () => { + const helpMsg = ` +usage: es [] + +Assists with running Elasticsearch for Kibana development + +Available commands: + + snapshot - Downloads and run from a nightly snapshot + source - Build and run from source + archive - Install and run from an Elasticsearch tar + build_snapshots - Build and collect ES snapshots + +Global options: + + --help +`; + it(`should print out the es help msg`, done => { + const outData = []; + const kbnHelp = spawn('yarn', ['es', '--help'], { cwd: generatedPath }); + kbnHelp.stdout.on('data', collect(outData)); + kbnHelp.on('close', () => { + // eslint-disable-next-line no-undef + expect(outData.join('\n')).toContain(helpMsg); + done(); + }); + }); + }); }); From 3dc9363453237b21dab46be20cd06b068aeca76c Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 19 Aug 2019 10:52:56 -0600 Subject: [PATCH 15/41] Verify stderr on running yarn preinstall --- .../__tests__/generate_plugin.ispec.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index 7e199df982e82..c076572663214 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -27,7 +27,7 @@ import * as del from 'del'; const ROOT_DIR = resolve(__dirname, '../../../'); const oneMinute = 60000; -describe(`running the plugin-generator via 'node scripts/generate_plugin.js plugin-name'`, () => { +describe(`running the plugin-generator via 'node scripts/generate_plugin.js plugin-name' with default config`, () => { const pluginName = 'ispec-plugin'; const snakeCased = snakeCase(pluginName); const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); @@ -61,6 +61,25 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug expect(stats.isDirectory()).toBe(true); }); + describe(`and then running 'yarn preinstall' in the plugin's root dir`, () => { + let preinstall; + const stdOuts = []; + const stdErrs = []; + + // eslint-disable-next-line no-undef + beforeAll(done => { + preinstall = spawn('yarn', ['preinstall'], { cwd: generatedPath }); + preinstall.stderr.on('data', collect(stdErrs)); + preinstall.stdout.on('data', collect(stdOuts)); + preinstall.on('close', () => done()); + }); + + it(`should result in only having 'warning package.json: No license field' on stderr`, () => { + // eslint-disable-next-line no-undef + expect(stdErrs.join('\n')).toEqual('warning package.json: No license field\n'); + }); + }); + describe(`and then running 'yarn lint' in the plugin's root dir`, () => { const stdErrs = []; const stdOuts = []; @@ -117,6 +136,7 @@ Global options: }); }); }); + describe(`and then running 'yarn es --help'`, () => { const helpMsg = ` usage: es [] From ae0eda3acae7dadc991dca3e5a9d587a301d92f2 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 19 Aug 2019 11:54:49 -0600 Subject: [PATCH 16/41] Add verification for yarn build --- .../__tests__/generate_plugin.ispec.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js index c076572663214..8e5b6c5cf3d66 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js @@ -61,6 +61,23 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug expect(stats.isDirectory()).toBe(true); }); + describe(`and then running 'yarn build' in the plugin's root dir`, () => { + let build; + const stdErrs = []; + + // eslint-disable-next-line no-undef + beforeAll(done => { + build = spawn('yarn', ['build'], { cwd: generatedPath }); + build.stderr.on('data', collect(stdErrs)); + build.on('close', () => done()); + }); + + it(`should result in only having 'warning package.json: No license field' on stderr`, () => { + // eslint-disable-next-line no-undef + expect(stdErrs.join('\n')).toEqual('warning package.json: No license field\n'); + }); + }); + describe(`and then running 'yarn preinstall' in the plugin's root dir`, () => { let preinstall; const stdOuts = []; From 091c9a8335c1da0b1f7178dc7b2a171000331c40 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 21 Aug 2019 10:25:46 -0600 Subject: [PATCH 17/41] Drop resolver conditional in favor of config override --- .../import_resolver_kibana.js | 2 -- .../sao_template/template/eslintrc | 10 ++++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js b/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js index b77640adafc2c..5c409ade260b1 100755 --- a/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js +++ b/packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js @@ -69,8 +69,6 @@ function tryNodeResolver(importRequest, file, config) { exports.resolve = function resolveKibanaPath(importRequest, file, config) { config = config || {}; - if (/ui\/.+/.test(importRequest)) config.forceNode = false; // Refer to https://github.com/elastic/kibana/issues/17061#issuecomment-522157366 - if (config.forceNode) { return tryNodeResolver(importRequest, file, config); } diff --git a/packages/kbn-plugin-generator/sao_template/template/eslintrc b/packages/kbn-plugin-generator/sao_template/template/eslintrc index e54900aa30249..6107821ab6959 100755 --- a/packages/kbn-plugin-generator/sao_template/template/eslintrc +++ b/packages/kbn-plugin-generator/sao_template/template/eslintrc @@ -1,7 +1,5 @@ --- -extends: "@elastic/kibana" - -settings: - import/resolver: - '@elastic/eslint-import-resolver-kibana': - rootPackageName: '<%= snakeCase(name) %>' +overrides: + - files: ['**/ui/**/*.js'] + rules: + 'import/no-unresolved': '0' From 53138e2c72208d3be5a6c17eaf6d6b4631c2df69 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 21 Aug 2019 13:16:42 -0600 Subject: [PATCH 18/41] Switching to setup per Contributing guide. --- .../generate_plugin.test.js} | 41 ++++++++++++++----- .../jest.config.integration.js | 27 ------------ packages/kbn-plugin-generator/package.json | 3 -- 3 files changed, 30 insertions(+), 41 deletions(-) rename packages/kbn-plugin-generator/{__tests__/generate_plugin.ispec.js => integration_tests/generate_plugin.test.js} (84%) delete mode 100644 packages/kbn-plugin-generator/jest.config.integration.js diff --git a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js similarity index 84% rename from packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js rename to packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index 8e5b6c5cf3d66..050d6f1f53769 100644 --- a/packages/kbn-plugin-generator/__tests__/generate_plugin.ispec.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -22,7 +22,9 @@ import { spawn } from 'child_process'; import { resolve } from 'path'; import { promises as fsP } from 'fs'; import { snakeCase } from 'lodash'; -import * as del from 'del'; +import del from 'del'; +import es from '@kbn/es'; +import { withProcRunner } from '@kbn/dev-utils'; const ROOT_DIR = resolve(__dirname, '../../../'); const oneMinute = 60000; @@ -36,7 +38,7 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug // eslint-disable-next-line no-undef beforeAll(() => { // eslint-disable-next-line no-undef - jest.setTimeout(oneMinute * 3); + jest.setTimeout(oneMinute * 6); }); // eslint-disable-next-line no-undef @@ -61,13 +63,28 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug expect(stats.isDirectory()).toBe(true); }); + describe(`and then running 'yarn start' in the plugin's root dir`, () => { + it(`should result in the spec plugin being initialized on kibana's stdout`, async () => { + // run kibana + const ran = await es.run({ + license: 'basic', + version: 7.0, + }); + + console.log(`\n### ran: \n\t${ran}`); + // kill both (somehow) + expect(true).toBe(true); + // expect(/ispec_plugin.+Status changed from uninitialized to green - Ready/.test(startStdOuts.join('\n'))) + // .toBeTruthy(); + }); + }); + describe(`and then running 'yarn build' in the plugin's root dir`, () => { - let build; const stdErrs = []; // eslint-disable-next-line no-undef beforeAll(done => { - build = spawn('yarn', ['build'], { cwd: generatedPath }); + const build = spawn('yarn', ['build'], { cwd: generatedPath }); build.stderr.on('data', collect(stdErrs)); build.on('close', () => done()); }); @@ -79,13 +96,12 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); describe(`and then running 'yarn preinstall' in the plugin's root dir`, () => { - let preinstall; const stdOuts = []; const stdErrs = []; // eslint-disable-next-line no-undef beforeAll(done => { - preinstall = spawn('yarn', ['preinstall'], { cwd: generatedPath }); + const preinstall = spawn('yarn', ['preinstall'], { cwd: generatedPath }); preinstall.stderr.on('data', collect(stdErrs)); preinstall.stdout.on('data', collect(stdOuts)); preinstall.on('close', () => done()); @@ -100,24 +116,27 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug describe(`and then running 'yarn lint' in the plugin's root dir`, () => { const stdErrs = []; const stdOuts = []; - let yarnLint; + let joined; // eslint-disable-next-line no-undef beforeAll(done => { - yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); + const yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); yarnLint.stderr.on('data', collect(stdErrs)); yarnLint.stdout.on('data', collect(stdOuts)); - yarnLint.on('close', () => done()); + yarnLint.on('close', () => { + joined = stdErrs.join('\n'); + done(); + }); }, oneMinute * 3); it(`should not show the '"@kbn/eslint/no-restricted-paths" is invalid' msg on stderr`, () => { // eslint-disable-next-line no-undef - expect(stdErrs.join('\n')).not.toContain('"@kbn/eslint/no-restricted-paths" is invalid'); + expect(joined).not.toContain('"@kbn/eslint/no-restricted-paths" is invalid'); }); it(`should not show the 'import/no-unresolved' msg on stdout`, () => { // eslint-disable-next-line no-undef - expect(stdOuts.join('\n')).not.toContain('import/no-unresolved'); + expect(joined).not.toContain('import/no-unresolved'); }); }); diff --git a/packages/kbn-plugin-generator/jest.config.integration.js b/packages/kbn-plugin-generator/jest.config.integration.js deleted file mode 100644 index 4137aeeadc96c..0000000000000 --- a/packages/kbn-plugin-generator/jest.config.integration.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - */ - -const config = { - testRegex: `ispec\\.js$`, - transform: { - '^.+\\.[t|j]sx?$': 'babel-jest', - }, -}; - -module.exports = config; diff --git a/packages/kbn-plugin-generator/package.json b/packages/kbn-plugin-generator/package.json index 7de7e501aae61..a26371be863db 100644 --- a/packages/kbn-plugin-generator/package.json +++ b/packages/kbn-plugin-generator/package.json @@ -13,8 +13,5 @@ "lodash.snakecase": "^4.1.1", "lodash.startcase": "^4.4.0", "sao": "^0.22.12" - }, - "scripts": { - "test": "jest -c jest.config.integration.js" } } From a2a7f4ee507f0d79262a1dfb4fb447fdaa7ea061 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 21 Aug 2019 13:45:47 -0600 Subject: [PATCH 19/41] Drop local babel config --- packages/kbn-plugin-generator/babel.config.js | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 packages/kbn-plugin-generator/babel.config.js diff --git a/packages/kbn-plugin-generator/babel.config.js b/packages/kbn-plugin-generator/babel.config.js deleted file mode 100644 index efae53c033e6d..0000000000000 --- a/packages/kbn-plugin-generator/babel.config.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -module.exports = { - presets: [ - [ - '@babel/preset-env', - { - targets: { - node: 'current', - }, - }, - ], - ], -}; From 2dd54df02205f62a5ce9063d49357d87871c090b Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 21 Aug 2019 13:48:34 -0600 Subject: [PATCH 20/41] Use global jest integration config --- src/dev/jest/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index e694e9142126e..b2f56baa430cf 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -37,6 +37,7 @@ export default { '/packages', '/src/test_utils', '/test/functional/services/remote', + '/packages/kbn-plugin-generator', ], collectCoverageFrom: [ 'packages/kbn-ui-framework/src/components/**/*.js', From 43f2706494c44a49ca067738b17c2ba6de411842 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Wed, 21 Aug 2019 17:27:26 -0600 Subject: [PATCH 21/41] Fixup default plugin path, and fixup yarn lint integration test, and switch to promisify, and change template to use js instead of yaml, and fix sao template lint. --- .../lib/get_kibana_path.js | 2 +- .../integration_tests/generate_plugin.test.js | 71 ++++++------------- .../kbn-plugin-generator/sao_template/sao.js | 2 +- .../sao_template/template/eslintrc | 5 -- .../sao_template/template/eslintrc.js | 24 +++++++ .../sao_template/template/index.js | 58 +++++++-------- .../template/public/components/main/index.js | 2 +- 7 files changed, 78 insertions(+), 86 deletions(-) delete mode 100755 packages/kbn-plugin-generator/sao_template/template/eslintrc create mode 100755 packages/kbn-plugin-generator/sao_template/template/eslintrc.js diff --git a/packages/kbn-eslint-import-resolver-kibana/lib/get_kibana_path.js b/packages/kbn-eslint-import-resolver-kibana/lib/get_kibana_path.js index d779b3a542e6e..93c0f907d628d 100755 --- a/packages/kbn-eslint-import-resolver-kibana/lib/get_kibana_path.js +++ b/packages/kbn-eslint-import-resolver-kibana/lib/get_kibana_path.js @@ -21,7 +21,7 @@ const { resolve } = require('path'); const { debug } = require('./debug'); -const DEFAULT_PLUGIN_PATH = '../../kibana'; +const DEFAULT_PLUGIN_PATH = '../..'; /* * Resolves the path to Kibana, either from default setting or config diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index 050d6f1f53769..2c59946107f5a 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -20,12 +20,15 @@ /* eslint-disable no-restricted-syntax */ import { spawn } from 'child_process'; import { resolve } from 'path'; -import { promises as fsP } from 'fs'; +import util from 'util'; +import { stat } from 'fs'; import { snakeCase } from 'lodash'; import del from 'del'; -import es from '@kbn/es'; -import { withProcRunner } from '@kbn/dev-utils'; +import { withProcRunner, ToolingLog } from '@kbn/dev-utils'; +import { createEsTestCluster } from '@kbn/test'; +import execa from 'execa'; +const statP = util.promisify(stat); const ROOT_DIR = resolve(__dirname, '../../../'); const oneMinute = 60000; @@ -35,13 +38,10 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug const generatedPath = resolve(ROOT_DIR, `plugins/${snakeCased}`); const collect = xs => data => xs.push(data + ''); // Coerce from Buffer to String - // eslint-disable-next-line no-undef beforeAll(() => { - // eslint-disable-next-line no-undef - jest.setTimeout(oneMinute * 6); + jest.setTimeout(oneMinute * 10); }); - // eslint-disable-next-line no-undef beforeAll(done => { const create = spawn(process.execPath, ['scripts/generate_plugin.js', pluginName], { cwd: ROOT_DIR, @@ -52,37 +52,36 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug create.on('close', done); }); - // eslint-disable-next-line no-undef afterAll(() => { del.sync(generatedPath, { force: true }); }); it(`should succeed on creating a plugin in a directory named 'plugins/${snakeCased}`, async () => { - const stats = await fsP.stat(generatedPath); - // eslint-disable-next-line no-undef + const stats = await statP(generatedPath); expect(stats.isDirectory()).toBe(true); }); describe(`and then running 'yarn start' in the plugin's root dir`, () => { + const log = new ToolingLog({ level: 'info', writeTo: process.stdout }); it(`should result in the spec plugin being initialized on kibana's stdout`, async () => { - // run kibana - const ran = await es.run({ - license: 'basic', - version: 7.0, + const es = createEsTestCluster({ license: 'basic', log }); + await es.start(); + await withProcRunner(log, async proc => { + await proc.run('kibana', { + cwd: generatedPath, + args: ['start', '--optimize.enabled=false', '--logging.json=false'], + cmd: 'yarn', + wait: /ispec_plugin.+Status changed from uninitialized to green - Ready/, + }); + await proc.stop('kibana'); }); - - console.log(`\n### ran: \n\t${ran}`); - // kill both (somehow) - expect(true).toBe(true); - // expect(/ispec_plugin.+Status changed from uninitialized to green - Ready/.test(startStdOuts.join('\n'))) - // .toBeTruthy(); + await es.stop(); }); }); describe(`and then running 'yarn build' in the plugin's root dir`, () => { const stdErrs = []; - // eslint-disable-next-line no-undef beforeAll(done => { const build = spawn('yarn', ['build'], { cwd: generatedPath }); build.stderr.on('data', collect(stdErrs)); @@ -90,7 +89,6 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); it(`should result in only having 'warning package.json: No license field' on stderr`, () => { - // eslint-disable-next-line no-undef expect(stdErrs.join('\n')).toEqual('warning package.json: No license field\n'); }); }); @@ -99,7 +97,6 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug const stdOuts = []; const stdErrs = []; - // eslint-disable-next-line no-undef beforeAll(done => { const preinstall = spawn('yarn', ['preinstall'], { cwd: generatedPath }); preinstall.stderr.on('data', collect(stdErrs)); @@ -108,35 +105,13 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); it(`should result in only having 'warning package.json: No license field' on stderr`, () => { - // eslint-disable-next-line no-undef expect(stdErrs.join('\n')).toEqual('warning package.json: No license field\n'); }); }); describe(`and then running 'yarn lint' in the plugin's root dir`, () => { - const stdErrs = []; - const stdOuts = []; - let joined; - - // eslint-disable-next-line no-undef - beforeAll(done => { - const yarnLint = spawn('yarn', ['lint'], { cwd: generatedPath }); - yarnLint.stderr.on('data', collect(stdErrs)); - yarnLint.stdout.on('data', collect(stdOuts)); - yarnLint.on('close', () => { - joined = stdErrs.join('\n'); - done(); - }); - }, oneMinute * 3); - - it(`should not show the '"@kbn/eslint/no-restricted-paths" is invalid' msg on stderr`, () => { - // eslint-disable-next-line no-undef - expect(joined).not.toContain('"@kbn/eslint/no-restricted-paths" is invalid'); - }); - - it(`should not show the 'import/no-unresolved' msg on stdout`, () => { - // eslint-disable-next-line no-undef - expect(joined).not.toContain('import/no-unresolved'); + it(`should lint w/o errors`, async () => { + await execa('yarn', ['lint'], { cwd: generatedPath }); }); }); @@ -166,7 +141,6 @@ Global options: const kbnHelp = spawn('yarn', ['kbn', '--help'], { cwd: generatedPath }); kbnHelp.stdout.on('data', collect(outData)); kbnHelp.on('close', () => { - // eslint-disable-next-line no-undef expect(outData.join('\n')).toContain(helpMsg); done(); }); @@ -195,7 +169,6 @@ Global options: const kbnHelp = spawn('yarn', ['es', '--help'], { cwd: generatedPath }); kbnHelp.stdout.on('data', collect(outData)); kbnHelp.on('close', () => { - // eslint-disable-next-line no-undef expect(outData.join('\n')).toContain(helpMsg); done(); }); diff --git a/packages/kbn-plugin-generator/sao_template/sao.js b/packages/kbn-plugin-generator/sao_template/sao.js index 874735593d442..3eb88f53190a1 100755 --- a/packages/kbn-plugin-generator/sao_template/sao.js +++ b/packages/kbn-plugin-generator/sao_template/sao.js @@ -80,7 +80,7 @@ module.exports = function({ name }) { }, move: { gitignore: '.gitignore', - eslintrc: '.eslintrc', + 'eslintrc.js': '.eslintrc.js', 'package_template.json': 'package.json', }, data: answers => diff --git a/packages/kbn-plugin-generator/sao_template/template/eslintrc b/packages/kbn-plugin-generator/sao_template/template/eslintrc deleted file mode 100755 index 6107821ab6959..0000000000000 --- a/packages/kbn-plugin-generator/sao_template/template/eslintrc +++ /dev/null @@ -1,5 +0,0 @@ ---- -overrides: - - files: ['**/ui/**/*.js'] - rules: - 'import/no-unresolved': '0' diff --git a/packages/kbn-plugin-generator/sao_template/template/eslintrc.js b/packages/kbn-plugin-generator/sao_template/template/eslintrc.js new file mode 100755 index 0000000000000..e1dfadc212b7e --- /dev/null +++ b/packages/kbn-plugin-generator/sao_template/template/eslintrc.js @@ -0,0 +1,24 @@ +module.exports = { + root: true, + extends: ['@elastic/eslint-config-kibana', 'plugin:@elastic/eui/recommended'], + settings: { + 'import/resolver': { + '@kbn/eslint-import-resolver-kibana': { + rootPackageName: '<%= snakeCase(name) %>', + }, + }, + }, + overrides: [ + { + files: ['**/public/**/*'], + settings: { + 'import/resolver': { + '@kbn/eslint-import-resolver-kibana': { + forceNode: false, + rootPackageName: '<%= snakeCase(name) %>', + }, + }, + }, + }, + ] +}; diff --git a/packages/kbn-plugin-generator/sao_template/template/index.js b/packages/kbn-plugin-generator/sao_template/template/index.js index 40ed14af52c6e..0a3e16cf71e49 100755 --- a/packages/kbn-plugin-generator/sao_template/template/index.js +++ b/packages/kbn-plugin-generator/sao_template/template/index.js @@ -43,39 +43,39 @@ export default function (kibana) { init(server, options) { // eslint-disable-line no-unused-vars <%_ if (generateApp) { -%> - const xpackMainPlugin = server.plugins.xpack_main; - if (xpackMainPlugin) { - const featureId = '<%= snakeCase(name) %>'; + const xpackMainPlugin = server.plugins.xpack_main; + if (xpackMainPlugin) { + const featureId = '<%= snakeCase(name) %>'; - xpackMainPlugin.registerFeature({ - id: featureId, - name: i18n.translate('<%= camelCase(name) %>.featureRegistry.featureName', { - defaultMessage: '<%= name %>', - }), - navLinkId: featureId, - icon: 'questionInCircle', - app: [featureId, 'kibana'], - catalogue: [], - privileges: { - all: { - api: [], - savedObject: { - all: [], - read: [], - }, - ui: ['show'], + xpackMainPlugin.registerFeature({ + id: featureId, + name: i18n.translate('<%= camelCase(name) %>.featureRegistry.featureName', { + defaultMessage: '<%= name %>', + }), + navLinkId: featureId, + icon: 'questionInCircle', + app: [featureId, 'kibana'], + catalogue: [], + privileges: { + all: { + api: [], + savedObject: { + all: [], + read: [], }, - read: { - api: [], - savedObject: { - all: [], - read: [], - }, - ui: ['show'], + ui: ['show'], + }, + read: { + api: [], + savedObject: { + all: [], + read: [], }, + ui: ['show'], }, - }); - } + }, + }); + } <%_ } -%> <%_ if (generateApi) { -%> diff --git a/packages/kbn-plugin-generator/sao_template/template/public/components/main/index.js b/packages/kbn-plugin-generator/sao_template/template/public/components/main/index.js index b8dd6dff2e533..68710baa1bee8 100644 --- a/packages/kbn-plugin-generator/sao_template/template/public/components/main/index.js +++ b/packages/kbn-plugin-generator/sao_template/template/public/components/main/index.js @@ -1 +1 @@ -export { Main } from './main'; \ No newline at end of file +export { Main } from './main'; From 5c410f2bc28e90c9dc62b5bee2ddfe0fd2bd6616 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 22 Aug 2019 08:32:24 -0600 Subject: [PATCH 22/41] Refactor per the tips Spencer shared with me. --- .../integration_tests/generate_plugin.test.js | 60 +++++-------------- 1 file changed, 16 insertions(+), 44 deletions(-) diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index 2c59946107f5a..c0c70905cbd6f 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -61,62 +61,37 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug expect(stats.isDirectory()).toBe(true); }); - describe(`and then running 'yarn start' in the plugin's root dir`, () => { - const log = new ToolingLog({ level: 'info', writeTo: process.stdout }); - it(`should result in the spec plugin being initialized on kibana's stdout`, async () => { + describe(`then running`, () => { + it(`'yarn build' should exit 0`, async () => { + await execa('yarn', ['build'], { cwd: generatedPath }); + }); + + it(`'yarn start' should result in the spec plugin being initialized on kibana's stdout`, async () => { + const log = new ToolingLog({ level: 'info', writeTo: process.stdout }); const es = createEsTestCluster({ license: 'basic', log }); await es.start(); await withProcRunner(log, async proc => { await proc.run('kibana', { - cwd: generatedPath, - args: ['start', '--optimize.enabled=false', '--logging.json=false'], cmd: 'yarn', + args: ['start', '--optimize.enabled=false', '--logging.json=false'], + cwd: generatedPath, wait: /ispec_plugin.+Status changed from uninitialized to green - Ready/, }); await proc.stop('kibana'); }); await es.stop(); }); - }); - - describe(`and then running 'yarn build' in the plugin's root dir`, () => { - const stdErrs = []; - beforeAll(done => { - const build = spawn('yarn', ['build'], { cwd: generatedPath }); - build.stderr.on('data', collect(stdErrs)); - build.on('close', () => done()); + it(`'yarn preinstall' should exit 0`, async () => { + await execa('yarn', ['preinstall'], { cwd: generatedPath }); }); - it(`should result in only having 'warning package.json: No license field' on stderr`, () => { - expect(stdErrs.join('\n')).toEqual('warning package.json: No license field\n'); - }); - }); - - describe(`and then running 'yarn preinstall' in the plugin's root dir`, () => { - const stdOuts = []; - const stdErrs = []; - - beforeAll(done => { - const preinstall = spawn('yarn', ['preinstall'], { cwd: generatedPath }); - preinstall.stderr.on('data', collect(stdErrs)); - preinstall.stdout.on('data', collect(stdOuts)); - preinstall.on('close', () => done()); - }); - - it(`should result in only having 'warning package.json: No license field' on stderr`, () => { - expect(stdErrs.join('\n')).toEqual('warning package.json: No license field\n'); - }); - }); - - describe(`and then running 'yarn lint' in the plugin's root dir`, () => { - it(`should lint w/o errors`, async () => { + it(`'yarn lint' should exit 0`, async () => { await execa('yarn', ['lint'], { cwd: generatedPath }); }); - }); - describe(`and then running 'yarn kbn --help'`, () => { - const helpMsg = ` + it(`'yarn kbn --help' should print out the kbn help msg`, done => { + const helpMsg = ` usage: kbn [] By default commands are run for Kibana itself, all packages in the 'packages/' @@ -136,7 +111,6 @@ Global options: --oss Do not include the x-pack when running command. --skip-kibana-plugins Filter all plugins in ./plugins and ../kibana-extra when running command. `; - it(`should print out the kbn help msg`, done => { const outData = []; const kbnHelp = spawn('yarn', ['kbn', '--help'], { cwd: generatedPath }); kbnHelp.stdout.on('data', collect(outData)); @@ -145,10 +119,9 @@ Global options: done(); }); }); - }); - describe(`and then running 'yarn es --help'`, () => { - const helpMsg = ` + it(`'yarn es --help' should print out the es help msg`, done => { + const helpMsg = ` usage: es [] Assists with running Elasticsearch for Kibana development @@ -164,7 +137,6 @@ Global options: --help `; - it(`should print out the es help msg`, done => { const outData = []; const kbnHelp = spawn('yarn', ['es', '--help'], { cwd: generatedPath }); kbnHelp.stdout.on('data', collect(outData)); From 616ff8196c21ac84b08508338b5d58fa053f53a7 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 22 Aug 2019 09:05:12 -0600 Subject: [PATCH 23/41] Fixup jest test, we changed the yaml to be a js file, which caused this test to fail. --- packages/kbn-plugin-generator/sao_template/sao.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-plugin-generator/sao_template/sao.test.js b/packages/kbn-plugin-generator/sao_template/sao.test.js index 77c9b4533b9ca..80149c008dad8 100755 --- a/packages/kbn-plugin-generator/sao_template/sao.test.js +++ b/packages/kbn-plugin-generator/sao_template/sao.test.js @@ -198,6 +198,6 @@ describe('plugin generator sao integration', () => { it('includes dotfiles', async () => { const res = await sao.mockPrompt(template); expect(res.files['.gitignore']).toBeTruthy(); - expect(res.files['.eslintrc']).toBeTruthy(); + expect(res.files['.eslintrc.js']).toBeTruthy(); }); }); From 493cf6623e91af62c3782a9c77343042e10f4536 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 22 Aug 2019 09:30:37 -0600 Subject: [PATCH 24/41] Verify yarn test:server. --- .../integration_tests/generate_plugin.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index c0c70905cbd6f..fa2e4b3cfc689 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -62,6 +62,10 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); describe(`then running`, () => { + it(`'yarn test:server' should exit 0`, async () => { + await execa('yarn', ['test:server'], { cwd: generatedPath }); + }); + it(`'yarn build' should exit 0`, async () => { await execa('yarn', ['build'], { cwd: generatedPath }); }); From f3c91e35d7de6d2d70b20c477da98fb187c38f71 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 23 Aug 2019 15:14:46 -0600 Subject: [PATCH 25/41] Block all but the tests for the plugin. --- .../integration_tests/generate_plugin.test.js | 4 ++++ src/legacy/core_plugins/tests_bundle/index.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index fa2e4b3cfc689..18fc32dce78a9 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -62,6 +62,10 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); describe(`then running`, () => { + it(`'yarn test:browser' should exit 0`, async () => { + await execa('yarn', ['test:browser'], { cwd: generatedPath }); + }); + it(`'yarn test:server' should exit 0`, async () => { await execa('yarn', ['test:server'], { cwd: generatedPath }); }); diff --git a/src/legacy/core_plugins/tests_bundle/index.js b/src/legacy/core_plugins/tests_bundle/index.js index ae14438119da3..b4b7fb5c638f7 100644 --- a/src/legacy/core_plugins/tests_bundle/index.js +++ b/src/legacy/core_plugins/tests_bundle/index.js @@ -53,7 +53,7 @@ export default (kibana) => { } = kbnServer; const testGlobs = [ - 'src/legacy/ui/public/**/*.js', + // 'src/legacy/ui/public/**/*.js', '!src/legacy/ui/public/flot-charts/**/*', ]; const testingPluginIds = config.get('tests_bundle.pluginId'); From 09afb7ef16e8ea9dd7c828f586cbbe098216815e Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 27 Aug 2019 12:57:19 -0600 Subject: [PATCH 26/41] Change arr init to empty, per review. --- src/legacy/core_plugins/tests_bundle/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/legacy/core_plugins/tests_bundle/index.js b/src/legacy/core_plugins/tests_bundle/index.js index b4b7fb5c638f7..f34b120b71f53 100644 --- a/src/legacy/core_plugins/tests_bundle/index.js +++ b/src/legacy/core_plugins/tests_bundle/index.js @@ -52,10 +52,7 @@ export default (kibana) => { } } = kbnServer; - const testGlobs = [ - // 'src/legacy/ui/public/**/*.js', - '!src/legacy/ui/public/flot-charts/**/*', - ]; + const testGlobs = []; const testingPluginIds = config.get('tests_bundle.pluginId'); if (testingPluginIds) { From d17e1b7c95a29a0fa92561c616b11cb1fa8396c0 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 29 Aug 2019 08:19:50 -0600 Subject: [PATCH 27/41] Escape the space in the path name. --- src/dev/jest/integration_tests/junit_reporter.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dev/jest/integration_tests/junit_reporter.test.js b/src/dev/jest/integration_tests/junit_reporter.test.js index 47618ce0fe70c..0a595b70f0907 100644 --- a/src/dev/jest/integration_tests/junit_reporter.test.js +++ b/src/dev/jest/integration_tests/junit_reporter.test.js @@ -29,7 +29,7 @@ const MINUTE = 1000 * 60; const ROOT_DIR = resolve(__dirname, '../../../../'); const FIXTURE_DIR = resolve(__dirname, '__fixtures__'); const TARGET_DIR = resolve(FIXTURE_DIR, 'target'); -const XML_PATH = resolve(TARGET_DIR, 'junit/TEST-Jest Tests.xml'); +const XML_PATH = resolve(TARGET_DIR, 'junit/TEST-Jest\ Tests.xml'); afterAll(async () => { await del(TARGET_DIR); From 51b32985cad05e70cf2a975e3690cd5192038bc8 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 29 Aug 2019 14:23:24 -0600 Subject: [PATCH 28/41] Temporarily skip my test --- src/dev/jest/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 04eeecedf6e6a..92ef0df75676b 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -89,6 +89,7 @@ export default { '/packages/kbn-ui-framework/(dist|doc_site|generator-kui)/', '/packages/kbn-pm/dist/', `${RESERVED_DIR_JEST_INTEGRATION_TESTS}/`, + '/packages/kbn-plugin-generator', ], transform: { '^.+\\.(js|tsx?)$': '/src/dev/jest/babel_transform.js', From f8b308ee84ac5d42864110ed612574b43ccc8db8 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 29 Aug 2019 16:14:55 -0600 Subject: [PATCH 29/41] Re-add my tests --- src/dev/jest/config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 92ef0df75676b..04eeecedf6e6a 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -89,7 +89,6 @@ export default { '/packages/kbn-ui-framework/(dist|doc_site|generator-kui)/', '/packages/kbn-pm/dist/', `${RESERVED_DIR_JEST_INTEGRATION_TESTS}/`, - '/packages/kbn-plugin-generator', ], transform: { '^.+\\.(js|tsx?)$': '/src/dev/jest/babel_transform.js', From 1cf5226e943f5d56b0e7f21fe59aacde40576302 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 29 Aug 2019 17:30:55 -0600 Subject: [PATCH 30/41] Put my test on top --- src/dev/jest/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 04eeecedf6e6a..5e6e27f0e01f1 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -22,6 +22,7 @@ import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../constants'; export default { rootDir: '../../..', roots: [ + '/packages/kbn-plugin-generator', '/src/plugins', '/src/legacy/ui', '/src/core', @@ -37,7 +38,6 @@ export default { '/packages', '/src/test_utils', '/test/functional/services/remote', - '/packages/kbn-plugin-generator', ], collectCoverageFrom: [ 'packages/kbn-ui-framework/src/components/**/*.js', From 62eb30f39d1aae852c9f9b504655b595b4953f5b Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 30 Aug 2019 08:44:31 -0600 Subject: [PATCH 31/41] Bump default timeout. --- src/dev/jest/setup/after_env.integration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dev/jest/setup/after_env.integration.js b/src/dev/jest/setup/after_env.integration.js index 7a2e7b8ab31c3..21a9545c7cf7e 100644 --- a/src/dev/jest/setup/after_env.integration.js +++ b/src/dev/jest/setup/after_env.integration.js @@ -20,6 +20,6 @@ /* eslint-env jest */ /** - * Set the default timeout for the integration test suite to 30 seconds + * Set the default timeout for the integration test suite to 10 minutes */ -jest.setTimeout(30 * 1000); +jest.setTimeout(10 * 60 * 1000); From 9f7d809fbf784d24549da7fe4e76571c0cb05d56 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 30 Aug 2019 12:29:12 -0600 Subject: [PATCH 32/41] Temporarily add more debug info to the jest integration tests. --- tasks/test_jest.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/test_jest.js b/tasks/test_jest.js index deefaec543904..5e57e901778e9 100644 --- a/tasks/test_jest.js +++ b/tasks/test_jest.js @@ -31,9 +31,13 @@ module.exports = function (grunt) { }); function runJest(jestScript) { + // TODO: Remove, just temp debugging in ci + const xs = [jestScript, '--ci']; + if (jestScript.includes('integration')) xs.push('--debug'); + const serverCmd = { cmd: 'node', - args: [jestScript, '--ci'], + args: xs, // TODO: Remove, just temp debugging in ci opts: { stdio: 'inherit' } }; From 9717afc9c20879c0f958fe15c7158a46fb569d90 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 3 Sep 2019 08:05:59 -0600 Subject: [PATCH 33/41] Run the integration tests only. --- tasks/jenkins.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tasks/jenkins.js b/tasks/jenkins.js index c3a4058f84f08..4ee5171168f15 100644 --- a/tasks/jenkins.js +++ b/tasks/jenkins.js @@ -23,21 +23,21 @@ module.exports = function (grunt) { ]); grunt.registerTask('jenkins:unit', [ - 'run:eslint', - 'run:sasslint', - 'run:checkTsProjects', - 'run:checkCoreApiChanges', - 'run:typeCheck', - 'run:i18nCheck', - 'run:checkFileCasing', - 'run:licenses', - 'run:verifyDependencyVersions', - 'run:verifyNotice', - 'run:mocha', - 'run:test_jest', + // 'run:eslint', + // 'run:sasslint', + // 'run:checkTsProjects', + // 'run:checkCoreApiChanges', + // 'run:typeCheck', + // 'run:i18nCheck', + // 'run:checkFileCasing', + // 'run:licenses', + // 'run:verifyDependencyVersions', + // 'run:verifyNotice', + // 'run:mocha', + // 'run:test_jest', 'run:test_jest_integration', - 'run:test_projects', - 'run:test_browser_ci', - 'run:apiIntegrationTests', + // 'run:test_projects', + // 'run:test_browser_ci', + // 'run:apiIntegrationTests', ]); }; From 30fef0bfd6277e8a846acc9fbb2cd185ce62c4d1 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 3 Sep 2019 09:15:44 -0600 Subject: [PATCH 34/41] Add back all the tests and run in band. --- tasks/jenkins.js | 30 +++++++++++++++--------------- tasks/test_jest.js | 5 ++++- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/tasks/jenkins.js b/tasks/jenkins.js index 4ee5171168f15..c3a4058f84f08 100644 --- a/tasks/jenkins.js +++ b/tasks/jenkins.js @@ -23,21 +23,21 @@ module.exports = function (grunt) { ]); grunt.registerTask('jenkins:unit', [ - // 'run:eslint', - // 'run:sasslint', - // 'run:checkTsProjects', - // 'run:checkCoreApiChanges', - // 'run:typeCheck', - // 'run:i18nCheck', - // 'run:checkFileCasing', - // 'run:licenses', - // 'run:verifyDependencyVersions', - // 'run:verifyNotice', - // 'run:mocha', - // 'run:test_jest', + 'run:eslint', + 'run:sasslint', + 'run:checkTsProjects', + 'run:checkCoreApiChanges', + 'run:typeCheck', + 'run:i18nCheck', + 'run:checkFileCasing', + 'run:licenses', + 'run:verifyDependencyVersions', + 'run:verifyNotice', + 'run:mocha', + 'run:test_jest', 'run:test_jest_integration', - // 'run:test_projects', - // 'run:test_browser_ci', - // 'run:apiIntegrationTests', + 'run:test_projects', + 'run:test_browser_ci', + 'run:apiIntegrationTests', ]); }; diff --git a/tasks/test_jest.js b/tasks/test_jest.js index 5e57e901778e9..3018cda6e30d6 100644 --- a/tasks/test_jest.js +++ b/tasks/test_jest.js @@ -33,7 +33,10 @@ module.exports = function (grunt) { function runJest(jestScript) { // TODO: Remove, just temp debugging in ci const xs = [jestScript, '--ci']; - if (jestScript.includes('integration')) xs.push('--debug'); + if (jestScript.includes('integration')) { + xs.push('--debug'); + xs.push('--runInBand'); + } const serverCmd = { cmd: 'node', From 40957c7e82b5cafb8b659bc6da6278a7f245b862 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 3 Sep 2019 10:07:44 -0600 Subject: [PATCH 35/41] Following a hunch...now writing to a no-op stream, instead of stdout. Comment out the debug and inband options for now. --- .../integration_tests/generate_plugin.test.js | 7 ++++++- tasks/test_jest.js | 14 +++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index 18fc32dce78a9..86e7f6f3a4254 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -27,6 +27,7 @@ import del from 'del'; import { withProcRunner, ToolingLog } from '@kbn/dev-utils'; import { createEsTestCluster } from '@kbn/test'; import execa from 'execa'; +import { Stream } from 'stream'; const statP = util.promisify(stat); const ROOT_DIR = resolve(__dirname, '../../../'); @@ -75,7 +76,11 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); it(`'yarn start' should result in the spec plugin being initialized on kibana's stdout`, async () => { - const log = new ToolingLog({ level: 'info', writeTo: process.stdout }); + const noopStream = new Stream.Writable(); + noopStream._write = (chunk, encoding, next) => { + next(); + }; + const log = new ToolingLog({ level: 'info', writeTo: noopStream }); const es = createEsTestCluster({ license: 'basic', log }); await es.start(); await withProcRunner(log, async proc => { diff --git a/tasks/test_jest.js b/tasks/test_jest.js index 3018cda6e30d6..6d488d1cb0a99 100644 --- a/tasks/test_jest.js +++ b/tasks/test_jest.js @@ -31,16 +31,16 @@ module.exports = function (grunt) { }); function runJest(jestScript) { - // TODO: Remove, just temp debugging in ci - const xs = [jestScript, '--ci']; - if (jestScript.includes('integration')) { - xs.push('--debug'); - xs.push('--runInBand'); - } + // // TODO: Remove, just temp debugging in ci + // const xs = [jestScript, '--ci']; + // if (jestScript.includes('integration')) { + // xs.push('--debug'); + // xs.push('--runInBand'); + // } const serverCmd = { cmd: 'node', - args: xs, // TODO: Remove, just temp debugging in ci + args: [jestScript, '--ci'], //xs, // TODO: Remove, just temp debugging in ci opts: { stdio: 'inherit' } }; From 9a586429ba712dea91557804d3e35a7e89c27731 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 3 Sep 2019 10:49:05 -0600 Subject: [PATCH 36/41] Run in band --- tasks/test_jest.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tasks/test_jest.js b/tasks/test_jest.js index 6d488d1cb0a99..47a4bc7404f5b 100644 --- a/tasks/test_jest.js +++ b/tasks/test_jest.js @@ -31,16 +31,16 @@ module.exports = function (grunt) { }); function runJest(jestScript) { - // // TODO: Remove, just temp debugging in ci - // const xs = [jestScript, '--ci']; - // if (jestScript.includes('integration')) { - // xs.push('--debug'); - // xs.push('--runInBand'); - // } + // TODO: Remove, just temp debugging in ci + const xs = [jestScript, '--ci']; + if (jestScript.includes('integration')) { + // xs.push('--debug'); + xs.push('--runInBand'); // Run all tests serially in the current process + } const serverCmd = { cmd: 'node', - args: [jestScript, '--ci'], //xs, // TODO: Remove, just temp debugging in ci + args: xs, // TODO: Remove, just temp debugging in ci opts: { stdio: 'inherit' } }; From 3cd03dd50960e7dac9c17572a6d0ec3ea00884e6 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 3 Sep 2019 12:35:14 -0600 Subject: [PATCH 37/41] Drop the no-op stream, and refactor the jest cli option, "higher up". --- .../integration_tests/generate_plugin.test.js | 7 +------ scripts/jest_integration.js | 1 + tasks/test_jest.js | 9 +-------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index 86e7f6f3a4254..3fd06ab0a27f2 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -27,7 +27,6 @@ import del from 'del'; import { withProcRunner, ToolingLog } from '@kbn/dev-utils'; import { createEsTestCluster } from '@kbn/test'; import execa from 'execa'; -import { Stream } from 'stream'; const statP = util.promisify(stat); const ROOT_DIR = resolve(__dirname, '../../../'); @@ -76,11 +75,7 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug }); it(`'yarn start' should result in the spec plugin being initialized on kibana's stdout`, async () => { - const noopStream = new Stream.Writable(); - noopStream._write = (chunk, encoding, next) => { - next(); - }; - const log = new ToolingLog({ level: 'info', writeTo: noopStream }); + const log = new ToolingLog(); const es = createEsTestCluster({ license: 'basic', log }); await es.start(); await withProcRunner(log, async proc => { diff --git a/scripts/jest_integration.js b/scripts/jest_integration.js index 5eafcca2176cf..7da1436f5583c 100755 --- a/scripts/jest_integration.js +++ b/scripts/jest_integration.js @@ -31,6 +31,7 @@ var resolve = require('path').resolve; process.argv.push('--config', resolve(__dirname, '../src/dev/jest/config.integration.js')); +process.argv.push('--runInBand'); require('../src/setup_node_env'); require('../src/dev/jest/cli'); diff --git a/tasks/test_jest.js b/tasks/test_jest.js index 47a4bc7404f5b..deefaec543904 100644 --- a/tasks/test_jest.js +++ b/tasks/test_jest.js @@ -31,16 +31,9 @@ module.exports = function (grunt) { }); function runJest(jestScript) { - // TODO: Remove, just temp debugging in ci - const xs = [jestScript, '--ci']; - if (jestScript.includes('integration')) { - // xs.push('--debug'); - xs.push('--runInBand'); // Run all tests serially in the current process - } - const serverCmd = { cmd: 'node', - args: xs, // TODO: Remove, just temp debugging in ci + args: [jestScript, '--ci'], opts: { stdio: 'inherit' } }; From 0c7ba8cd0ad2265e97ee51d6d7be0b30db54a5e5 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Tue, 3 Sep 2019 14:43:44 -0600 Subject: [PATCH 38/41] Drop reduntant root, and drop needless escape char. --- src/dev/jest/config.js | 1 - src/dev/jest/integration_tests/junit_reporter.test.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 5e6e27f0e01f1..24c2825e28174 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -22,7 +22,6 @@ import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../constants'; export default { rootDir: '../../..', roots: [ - '/packages/kbn-plugin-generator', '/src/plugins', '/src/legacy/ui', '/src/core', diff --git a/src/dev/jest/integration_tests/junit_reporter.test.js b/src/dev/jest/integration_tests/junit_reporter.test.js index 0a595b70f0907..47618ce0fe70c 100644 --- a/src/dev/jest/integration_tests/junit_reporter.test.js +++ b/src/dev/jest/integration_tests/junit_reporter.test.js @@ -29,7 +29,7 @@ const MINUTE = 1000 * 60; const ROOT_DIR = resolve(__dirname, '../../../../'); const FIXTURE_DIR = resolve(__dirname, '__fixtures__'); const TARGET_DIR = resolve(FIXTURE_DIR, 'target'); -const XML_PATH = resolve(TARGET_DIR, 'junit/TEST-Jest\ Tests.xml'); +const XML_PATH = resolve(TARGET_DIR, 'junit/TEST-Jest Tests.xml'); afterAll(async () => { await del(TARGET_DIR); From d127721c8b6ad0bad93db92d90ae3b66413f1824 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 5 Sep 2019 10:37:39 -0600 Subject: [PATCH 39/41] Switch no_restricted_paths back to original. Switch the generator to a function declaration, instead of an arrow fn, for better readability and add a comment to help as well. --- .../kbn-eslint-plugin-eslint/rules/no_restricted_paths.js | 2 +- .../integration_tests/generate_plugin.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js b/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js index 7f77a6dda1cf4..9074c35d27c7e 100644 --- a/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js +++ b/packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.js @@ -78,7 +78,7 @@ module.exports = { }, allowSameFolder: { type: 'boolean' }, }, - additionalProperties: true, + additionalProperties: false, }, }, basePath: { type: 'string' }, diff --git a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js index 3fd06ab0a27f2..220fce8b93372 100644 --- a/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js +++ b/packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js @@ -46,8 +46,8 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug const create = spawn(process.execPath, ['scripts/generate_plugin.js', pluginName], { cwd: ROOT_DIR, }); - create.stdout.on('data', () => { - create.stdin.write('\n'); + create.stdout.on('data', function selectDefaults() { + create.stdin.write('\n'); // Generate a plugin with default options. }); create.on('close', done); }); From c7fb74ea0e544facd9a832e55c22c3cbd59ecb90 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 6 Sep 2019 08:57:41 -0600 Subject: [PATCH 40/41] Testing a theory. While debugging, I noticed the `uiApps` collection contains the integration test's plugin. Also, it looks like some logic was adding the plugin's tests, again. I want this to run in ci to see if the "Test Result : Browser Unit Tests" report is back around the 500 count mark, with this logic commented out. --- src/legacy/core_plugins/tests_bundle/index.js | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/legacy/core_plugins/tests_bundle/index.js b/src/legacy/core_plugins/tests_bundle/index.js index f34b120b71f53..d6344d40db842 100644 --- a/src/legacy/core_plugins/tests_bundle/index.js +++ b/src/legacy/core_plugins/tests_bundle/index.js @@ -52,38 +52,41 @@ export default (kibana) => { } } = kbnServer; - const testGlobs = []; - const testingPluginIds = config.get('tests_bundle.pluginId'); - - if (testingPluginIds) { - testGlobs.push('!src/legacy/ui/public/**/__tests__/**/*'); - testingPluginIds.split(',').forEach((pluginId) => { - const plugin = plugins - .find(plugin => plugin.id === pluginId); - - if (!plugin) { - throw new Error('Invalid testingPluginId :: unknown plugin ' + pluginId); - } + const testGlobs = [ + 'src/legacy/ui/public/**/*.js', + '!src/legacy/ui/public/flot-charts/**/*', + ]; - // add the modules from all of this plugins apps - for (const app of uiApps) { - if (app.getPluginId() === pluginId) { - modules.add(app.getMainModuleId()); - } - } + const testingPluginIds = config.get('tests_bundle.pluginId'); - testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); - }); - } else { - // add the modules from all of the apps - for (const app of uiApps) { - modules.add(app.getMainModuleId()); - } + // if (testingPluginIds) { + // testGlobs.push('!src/legacy/ui/public/**/__tests__/**/*'); + // testingPluginIds.split(',').forEach((pluginId) => { + // const plugin = plugins.find(plugin => plugin.id === pluginId); + + // if (!plugin) { + // throw new Error('Invalid testingPluginId :: unknown plugin ' + pluginId); + // } + + // // add the modules from all of this plugins apps + // for (const app of uiApps) { + // if (app.getPluginId() === pluginId) { + // modules.add(app.getMainModuleId()); + // } + // } + + // testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); + // }); + // } else { + // add the modules from all of the apps + for (const app of uiApps) { + modules.add(app.getMainModuleId()); + } - for (const plugin of plugins) { - testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); - } + for (const plugin of plugins) { + testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); } + // } const testFiles = await findSourceFiles(testGlobs); for (const f of testFiles) modules.add(f); From d22f61d59ae30080c919cf08082283a9a46b91d9 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 6 Sep 2019 11:35:04 -0600 Subject: [PATCH 41/41] Only add all if we are not focused on specific plugins for testing. --- src/legacy/core_plugins/tests_bundle/index.js | 58 +++++++++---------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/src/legacy/core_plugins/tests_bundle/index.js b/src/legacy/core_plugins/tests_bundle/index.js index d6344d40db842..803fe1d220f44 100644 --- a/src/legacy/core_plugins/tests_bundle/index.js +++ b/src/legacy/core_plugins/tests_bundle/index.js @@ -52,41 +52,39 @@ export default (kibana) => { } } = kbnServer; - const testGlobs = [ - 'src/legacy/ui/public/**/*.js', - '!src/legacy/ui/public/flot-charts/**/*', - ]; + const testGlobs = []; const testingPluginIds = config.get('tests_bundle.pluginId'); - // if (testingPluginIds) { - // testGlobs.push('!src/legacy/ui/public/**/__tests__/**/*'); - // testingPluginIds.split(',').forEach((pluginId) => { - // const plugin = plugins.find(plugin => plugin.id === pluginId); - - // if (!plugin) { - // throw new Error('Invalid testingPluginId :: unknown plugin ' + pluginId); - // } - - // // add the modules from all of this plugins apps - // for (const app of uiApps) { - // if (app.getPluginId() === pluginId) { - // modules.add(app.getMainModuleId()); - // } - // } - - // testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); - // }); - // } else { - // add the modules from all of the apps - for (const app of uiApps) { - modules.add(app.getMainModuleId()); - } + if (testingPluginIds) { + testingPluginIds.split(',').forEach((pluginId) => { + const plugin = plugins.find(plugin => plugin.id === pluginId); + + if (!plugin) { + throw new Error('Invalid testingPluginId :: unknown plugin ' + pluginId); + } + + // add the modules from all of this plugins apps + for (const app of uiApps) { + if (app.getPluginId() === pluginId) { + modules.add(app.getMainModuleId()); + } + } - for (const plugin of plugins) { - testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); + testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); + }); + } else { + // add all since we are not just focused on specific plugins + testGlobs.push('src/legacy/ui/public/**/*.js', '!src/legacy/ui/public/flot-charts/**/*'); + // add the modules from all of the apps + for (const app of uiApps) { + modules.add(app.getMainModuleId()); + } + + for (const plugin of plugins) { + testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); + } } - // } const testFiles = await findSourceFiles(testGlobs); for (const f of testFiles) modules.add(f);