diff --git a/.eslintignore b/.eslintignore index 6ea478bc2bf7..f5df2d394adf 100644 --- a/.eslintignore +++ b/.eslintignore @@ -18,8 +18,7 @@ target # plugin overrides /src/core/lib/osd_internal_native_observable /src/legacy/plugin_discovery/plugin_pack/__tests__/fixtures/plugins/broken -/src/plugins/data/common/opensearch_query/kuery/ast/_generated_/** -/src/plugins/vis_type_timeline/public/_generated_/** +/src/plugins/**/_generated_/** # package overrides /packages/opensearch-eslint-config-opensearch-dashboards diff --git a/src/plugins/vis_type_timeline/public/_generated_/chain.js b/src/plugins/vis_type_timeline/common/_generated_/chain.js similarity index 100% rename from src/plugins/vis_type_timeline/public/_generated_/chain.js rename to src/plugins/vis_type_timeline/common/_generated_/chain.js diff --git a/src/plugins/vis_type_timeline/public/components/timeline_expression_input_helpers.ts b/src/plugins/vis_type_timeline/public/components/timeline_expression_input_helpers.ts index c4c5b5a03d94..fc94037a1618 100644 --- a/src/plugins/vis_type_timeline/public/components/timeline_expression_input_helpers.ts +++ b/src/plugins/vis_type_timeline/public/components/timeline_expression_input_helpers.ts @@ -35,7 +35,7 @@ import { monaco } from '@osd/monaco'; import { Parser } from 'pegjs'; // @ts-ignore -import { parse } from '../_generated_/chain'; +import { parse } from '../../common/_generated_/chain'; import { ArgValueSuggestions, FunctionArg, Location } from '../helpers/arg_value_suggestions'; import { ITimelineFunction, TimelineFunctionArgs } from '../../common/types'; diff --git a/tasks/config/peg.js b/tasks/config/peg.js index 26cbe51eba6f..9acb7b3d3a6c 100644 --- a/tasks/config/peg.js +++ b/tasks/config/peg.js @@ -34,10 +34,28 @@ module.exports = { dest: 'src/plugins/data/common/opensearch_query/kuery/ast/_generated_/kuery.js', options: { allowedStartRules: ['start', 'Literal'], + wrapper: function (src, parser) { + return ( + '/*\n * SPDX-License-Identifier: Apache-2.0\n *\n * The OpenSearch Contributors require contributions made to\n * this file be licensed under the Apache-2.0 license or a\n * compatible open source license.\n *\n * Any modifications Copyright OpenSearch Contributors. See\n * GitHub history for details.\n */\n\n' + + 'module.exports = ' + + parser + + ';\n' + ); + }, }, }, timeline_chain: { - src: 'src/plugins/vis_type_timeline/public/chain.peg', - dest: 'src/plugins/vis_type_timeline/public/_generated_/chain.js', + src: 'src/plugins/vis_type_timeline/common/chain.peg', + dest: 'src/plugins/vis_type_timeline/common/_generated_/chain.js', + options: { + wrapper: function (src, parser) { + return ( + '/*\n * SPDX-License-Identifier: Apache-2.0\n *\n * The OpenSearch Contributors require contributions made to\n * this file be licensed under the Apache-2.0 license or a\n * compatible open source license.\n *\n * Any modifications Copyright OpenSearch Contributors. See\n * GitHub history for details.\n */\n\n' + + 'module.exports = ' + + parser + + ';\n' + ); + }, + }, }, }; diff --git a/tasks/config/run.js b/tasks/config/run.js index f0e4fb7fcd66..c02d75b2afc0 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -28,8 +28,6 @@ * under the License. */ -import { getFunctionalTestGroupRunConfigs } from '../function_test_groups'; - const { version } = require('../../package.json'); const OPENSEARCH_DASHBOARDS_INSTALL_DIR = process.env.OPENSEARCH_DASHBOARDS_INSTALL_DIR || @@ -232,9 +230,5 @@ module.exports = function () { cmd: YARN, args: ['run', 'grunt', 'test:projects'], }, - - ...getFunctionalTestGroupRunConfigs({ - opensearchDashboardsInstallDir: OPENSEARCH_DASHBOARDS_INSTALL_DIR, - }), }; }; diff --git a/tasks/function_test_groups.js b/tasks/function_test_groups.js deleted file mode 100644 index d6df1573a661..000000000000 --- a/tasks/function_test_groups.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { readFileSync } from 'fs'; -import { resolve } from 'path'; - -import execa from 'execa'; -import grunt from 'grunt'; -import { load } from 'js-yaml'; - -const JOBS_YAML = readFileSync(resolve(__dirname, '../.ci/jobs.yml'), 'utf8'); -const TEST_TAGS = load(JOBS_YAML) - .JOB.filter((id) => id.startsWith('opensearch-dashboards-ciGroup')) - .map((id) => id.replace(/^opensearch-dashboards-/, '')); - -export function getFunctionalTestGroupRunConfigs({ opensearchDashboardsInstallDir } = {}) { - return { - // include a run task for each test group - ...TEST_TAGS.reduce( - (acc, tag) => ({ - ...acc, - [`functionalTests_${tag}`]: { - cmd: process.execPath, - args: [ - 'scripts/functional_tests', - '--include-tag', - tag, - '--config', - 'test/functional/config.js', - '--config', - 'test/ui_capabilities/newsfeed_err/config.ts', - '--config', - 'test/new_visualize_flow/config.ts', - '--config', - 'test/security_functional/config.ts', - // '--config', 'test/functional/config.firefox.js', - '--bail', - '--debug', - '--opensearch-dashboards-install-dir', - opensearchDashboardsInstallDir, - ], - }, - }), - {} - ), - }; -} - -grunt.registerTask( - 'functionalTests:ensureAllTestsInCiGroup', - 'Check that all of the functional tests are in a CI group', - async function () { - const done = this.async(); - - try { - const result = await execa(process.execPath, [ - 'scripts/functional_test_runner', - ...TEST_TAGS.map((tag) => `--include-tag=${tag}`), - '--config', - 'test/functional/config.js', - '--test-stats', - ]); - const stats = JSON.parse(result.stderr); - - if (stats.excludedTests.length > 0) { - grunt.fail.fatal(` - ${stats.excludedTests.length} tests are excluded by the ciGroup tags, make sure that - all test suites have a "ciGroup{X}" tag and that "tasks/functional_test_groups.js" - knows about the tag that you are using. - - tags: ${JSON.stringify({ include: TEST_TAGS })} - - - ${stats.excludedTests.join('\n - ')} - `); - return; - } - - done(); - } catch (error) { - grunt.fail.fatal(error.stack); - } - } -);