Skip to content

Commit 44333ae

Browse files
committed
fixup
1 parent 50e27f5 commit 44333ae

File tree

6 files changed

+38
-26
lines changed

6 files changed

+38
-26
lines changed

src/amazonqFeatureDev/controllers/chat/controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { submitFeedback } from '../../../feedback/vue/submitFeedback'
2525
import { placeholder } from '../../../shared/vscode/commands2'
2626
import { EditorContentController } from '../../../amazonq/commons/controllers/contentController'
2727
import { openUrl } from '../../../shared/utilities/vsCodeUtils'
28-
import { examples } from '../../text'
28+
import { examples } from '../../userFacingText'
2929

3030
export interface ChatControllerEventEmitters {
3131
readonly processHumanChatMessage: EventEmitter<any>
File renamed without changes.

src/testE2E/amazonq/featureDev.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { FollowUpTypes } from '../../amazonqFeatureDev/types'
1010
import sinon from 'sinon'
1111
import { FeatureDevClient } from '../../amazonqFeatureDev/client/featureDev'
1212
import { verifyTextOrder } from './framework/text'
13-
import { examples } from '../../amazonqFeatureDev/text'
13+
import { examples } from '../../amazonqFeatureDev/userFacingText'
1414
import * as authUtil from '../../codewhisperer/util/authUtil'
1515

1616
describe('Amazon Q Feature Dev', function () {

src/testE2E/amazonq/framework/framework.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,10 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

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'
267

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()
2910

3011
import * as vscode from 'vscode'
3112
import { createMynahUI } from '../../../amazonq/webview/ui/main'
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

src/testE2E/amazonq/framework/messenger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export class Messenger {
6666
}
6767

6868
getCommands() {
69-
return this.getStore().quickActionCommands ?? []
69+
return [...(this.getStore().quickActionCommands ?? [])]
7070
}
7171

7272
getChatItems() {
73-
return this.getStore().chatItems ?? []
73+
return [...(this.getStore().chatItems ?? [])]
7474
}
7575

7676
async waitForChatFinishesLoading() {

0 commit comments

Comments
 (0)