File tree Expand file tree Collapse file tree 6 files changed +38
-26
lines changed Expand file tree Collapse file tree 6 files changed +38
-26
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import { submitFeedback } from '../../../feedback/vue/submitFeedback'
25
25
import { placeholder } from '../../../shared/vscode/commands2'
26
26
import { EditorContentController } from '../../../amazonq/commons/controllers/contentController'
27
27
import { openUrl } from '../../../shared/utilities/vsCodeUtils'
28
- import { examples } from '../../text '
28
+ import { examples } from '../../userFacingText '
29
29
30
30
export interface ChatControllerEventEmitters {
31
31
readonly processHumanChatMessage : EventEmitter < any >
File renamed without changes.
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { FollowUpTypes } from '../../amazonqFeatureDev/types'
10
10
import sinon from 'sinon'
11
11
import { FeatureDevClient } from '../../amazonqFeatureDev/client/featureDev'
12
12
import { verifyTextOrder } from './framework/text'
13
- import { examples } from '../../amazonqFeatureDev/text '
13
+ import { examples } from '../../amazonqFeatureDev/userFacingText '
14
14
import * as authUtil from '../../codewhisperer/util/authUtil'
15
15
16
16
describe ( 'Amazon Q Feature Dev' , function ( ) {
Original file line number Diff line number Diff line change 3
3
* SPDX-License-Identifier: Apache-2.0
4
4
*/
5
5
6
- import { JSDOM } from 'jsdom'
7
- /**
8
- * JSDOM is used to help hoist MynahUI to running in a node environment vs in the browser (which is what it's made for)
9
- */
10
- const dom = new JSDOM ( undefined , {
11
- pretendToBeVisual : true ,
12
- includeNodeLocations : true ,
13
- } )
14
- global . window = dom . window as unknown as Window & typeof globalThis
15
- global . document = dom . window . document
16
- global . self = dom . window as unknown as Window & typeof globalThis
17
- global . Element = dom . window . Element
18
- global . HTMLElement = dom . window . HTMLElement
19
-
20
- // jsdom doesn't have support for innerText: https://github.com/jsdom/jsdom/issues/1245 which mynah ui uses
21
- Object . defineProperty ( global . Element . prototype , 'innerText' , {
22
- get ( ) {
23
- return this . textContent
24
- } ,
25
- } )
6
+ import { injectJSDOM } from './jsdomInjector'
26
7
27
- // jsdom doesn't have support for structuredClone. See https://github.com/ jsdom/jsdom/issues/3363
28
- global . structuredClone = val => JSON . parse ( JSON . stringify ( val ) )
8
+ // This needs to be ran before all other imports so that mynah ui gets loaded inside of jsdom
9
+ injectJSDOM ( )
29
10
30
11
import * as vscode from 'vscode'
31
12
import { createMynahUI } from '../../../amazonq/webview/ui/main'
Original file line number Diff line number Diff line change
1
+ /*!
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ import { JSDOM } from 'jsdom'
7
+
8
+ export function injectJSDOM ( ) {
9
+ /**
10
+ * JSDOM is used to help hoist MynahUI to running in a node environment vs in the browser (which is what it's made for)
11
+ */
12
+ const dom = new JSDOM ( undefined , {
13
+ pretendToBeVisual : true ,
14
+ includeNodeLocations : true ,
15
+ } )
16
+ global . window = dom . window as unknown as Window & typeof globalThis
17
+ global . document = dom . window . document
18
+ global . self = dom . window as unknown as Window & typeof globalThis
19
+ global . Element = dom . window . Element
20
+ global . HTMLElement = dom . window . HTMLElement
21
+
22
+ // jsdom doesn't have support for innerText: https://github.com/jsdom/jsdom/issues/1245 which mynah ui uses
23
+ Object . defineProperty ( global . Element . prototype , 'innerText' , {
24
+ get ( ) {
25
+ return this . textContent
26
+ } ,
27
+ } )
28
+
29
+ // jsdom doesn't have support for structuredClone. See https://github.com/jsdom/jsdom/issues/3363
30
+ global . structuredClone = val => JSON . parse ( JSON . stringify ( val ) )
31
+ }
Original file line number Diff line number Diff line change @@ -66,11 +66,11 @@ export class Messenger {
66
66
}
67
67
68
68
getCommands ( ) {
69
- return this . getStore ( ) . quickActionCommands ?? [ ]
69
+ return [ ... ( this . getStore ( ) . quickActionCommands ?? [ ] ) ]
70
70
}
71
71
72
72
getChatItems ( ) {
73
- return this . getStore ( ) . chatItems ?? [ ]
73
+ return [ ... ( this . getStore ( ) . chatItems ?? [ ] ) ]
74
74
}
75
75
76
76
async waitForChatFinishesLoading ( ) {
You can’t perform that action at this time.
0 commit comments