File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
packages/core/src/testE2E/amazonq Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 3
3
* SPDX-License-Identifier: Apache-2.0
4
4
*/
5
5
6
+ import { overrideRequire , resetRequire } from './framework/setup'
7
+ overrideRequire ( )
8
+
6
9
import assert from 'assert'
7
10
import { qTestingFramework } from './framework/framework'
8
11
import sinon from 'sinon'
@@ -52,6 +55,10 @@ describe('Amazon Q Feature Dev', function () {
52
55
sinon . restore ( )
53
56
} )
54
57
58
+ after ( ( ) => {
59
+ resetRequire ( )
60
+ } )
61
+
55
62
describe ( 'quick action availability' , ( ) => {
56
63
it ( 'Shows /dev when feature dev is enabled' , async ( ) => {
57
64
const command = tab . findCommand ( '/dev' )
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 Module from 'module'
7
+
8
+ const originalRequire = Module . prototype . require
9
+
10
+ export function overrideRequire ( ) {
11
+ Module . prototype . require = new Proxy ( Module . prototype . require , {
12
+ apply ( target , thisArg , argArray ) {
13
+ const name = argArray [ 0 ]
14
+
15
+ /**
16
+ * HACK: css can't be loaded into jsdom so we have to ignore it
17
+ */
18
+ if ( name . endsWith ( 'amazonq-webview.css' ) ) {
19
+ return { }
20
+ }
21
+
22
+ return Reflect . apply ( target , thisArg , argArray )
23
+ } ,
24
+ } )
25
+ }
26
+
27
+ export function resetRequire ( ) {
28
+ Module . prototype . require = originalRequire
29
+ }
You can’t perform that action at this time.
0 commit comments