Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Fix monaco import issue in UTs #834

Conversation

mengweieric
Copy link
Contributor

@mengweieric mengweieric commented Aug 8, 2024

Description

Upstream core dashboard added new dependency @osd/monaco in autocomplete provider. Anomaly dashboards previously had tests where indirectly triggers autocomplete registration in data plugin, and the load of autocomplete providers SQL and DQL

    Cannot find module '!!raw-loader!../../target/public/xjson.editor.worker.js' from '../../packages/osd-monaco/target/xjson/language.js'

    Require stack:
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/packages/osd-monaco/target/xjson/language.js
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/packages/osd-monaco/target/xjson/index.js
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/packages/osd-monaco/target/index.js
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/data/public/antlr/opensearch_sql/code_completion.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/data/public/plugin.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/data/public/index.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/saved_objects/public/saved_object/helpers/serialize_saved_object.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/saved_objects/public/saved_object/helpers/build_saved_object.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/saved_objects/public/saved_object/saved_object.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/saved_objects/public/saved_object/index.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/saved_objects/public/plugin.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/saved_objects/public/index.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/vis_augmenter/public/saved_augment_vis/saved_augment_vis.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/vis_augmenter/public/saved_augment_vis/index.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/vis_augmenter/public/plugin.ts
      /Users/runner/work/anomaly-detection-dashboards-plugin/anomaly-detection-dashboards-plugin/OpenSearch-Dashboards/src/plugins/vis_augmenter/public/index.ts
      public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx
      public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/__tests__/AssociatedDetectors.test.tsx

      37 | import { registerWorker } from '../worker_store';
      38 | // @ts-ignore
    > 39 | import workerSrc from '!!raw-loader!../../target/public/xjson.editor.worker.js';
         | ^
      40 |
      41 | const wps = new WorkerProxyService();
      42 |

      at Resolver.resolveModule (../../node_modules/jest-resolve/build/resolver.js:324:11)
      at Object.<anonymous> (../../packages/osd-monaco/src/xjson/language.ts:39:1)
      at Object.<anonymous> (../../packages/osd-monaco/src/xjson/index.ts:34:1)
      at Object.<anonymous> (../../packages/osd-monaco/src/index.ts:32:1)
      at Object.<anonymous> (../../src/plugins/data/public/antlr/opensearch_sql/code_completion.ts:6:1)
      at Object.<anonymous> (../../src/plugins/data/public/plugin.ts:96:1)
      at Object.<anonymous> (../../src/plugins/data/public/index.ts:500:1)
      at Object.<anonymous> (../../src/plugins/saved_objects/public/saved_object/helpers/serialize_saved_object.ts:34:1)
      at Object.<anonymous> (../../src/plugins/saved_objects/public/saved_object/helpers/build_saved_object.ts:34:1)
      at Object.<anonymous> (../../src/plugins/saved_objects/public/saved_object/saved_object.ts:42:1)

to unblock CIs, added monaco import mock to fix.

Issues Resolved

#832
opensearch-project/OpenSearch-Dashboards#7648

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Eric <menwe@amazon.com>
@kaituo
Copy link
Collaborator

kaituo commented Aug 8, 2024

all tests passed. Merged. @mengweieric

@kaituo kaituo merged commit 4c49c8c into opensearch-project:main Aug 8, 2024
11 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 8, 2024
Signed-off-by: Eric <menwe@amazon.com>
(cherry picked from commit 4c49c8c)
kaituo pushed a commit that referenced this pull request Aug 8, 2024
Signed-off-by: Eric <menwe@amazon.com>
(cherry picked from commit 4c49c8c)

Co-authored-by: Eric Wei <menwe@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants