@@ -44,20 +44,25 @@ function loadAgent (moduleName, version, isAgentlessTest, isEvpProxyTest) {
44
44
if ( ! isEvpProxyTest ) {
45
45
agent . setAvailableEndpoints ( [ ] )
46
46
}
47
+ const isHappyDom = moduleName === '@happy-dom/jest-environment'
47
48
return agent . load ( [ 'jest' , 'http' ] , { service : 'test' } , { experimental : { exporter } } ) . then ( ( ) => {
48
49
global . __libraryName__ = moduleName
49
50
global . __libraryVersion__ = version
50
51
51
52
return {
52
- jestExecutable : require ( `../../../versions/jest@${ version } ` ) . get ( ) ,
53
+ jestExecutable : isHappyDom
54
+ ? require ( '../../../versions/jest' ) . get ( )
55
+ : require ( `../../../versions/jest@${ version } ` ) . get ( ) ,
53
56
jestCommonOptions : {
54
57
projects : [ __dirname ] ,
55
58
testPathIgnorePatterns : [ '/node_modules/' ] ,
56
59
coverageReporters : [ 'none' ] ,
57
60
reporters : [ ] ,
58
61
silent : true ,
59
- testEnvironment : path . join ( __dirname , 'env.js' ) ,
60
- testRunner : require ( `../../../versions/jest-circus@${ version } ` ) . getPath ( 'jest-circus/runner' ) ,
62
+ testEnvironment : isHappyDom ? '@happy-dom/jest-environment' : path . join ( __dirname , 'env.js' ) ,
63
+ testRunner : isHappyDom
64
+ ? require ( '../../../versions/jest-circus' ) . getPath ( 'jest-circus/runner' )
65
+ : require ( `../../../versions/jest-circus@${ version } ` ) . getPath ( 'jest-circus/runner' ) ,
61
66
cache : false ,
62
67
maxWorkers : '50%'
63
68
}
@@ -72,7 +77,10 @@ describe('Plugin', function () {
72
77
this . timeout ( testTimeout )
73
78
this . retries ( 2 )
74
79
75
- withVersions ( 'jest' , [ 'jest-environment-node' , 'jest-environment-jsdom' ] , ( version , moduleName ) => {
80
+ // const versions = ['jest-environment-node', 'jest-environment-jsdom', '@happy-dom/jest-environment']
81
+ const versions = [ '@happy-dom/jest-environment' ]
82
+
83
+ withVersions ( 'jest' , versions , ( version , moduleName ) => {
76
84
afterEach ( ( ) => {
77
85
delete process . env . DD_API_KEY
78
86
const jestTestFile = fs . readdirSync ( __dirname ) . filter ( name => name . startsWith ( 'jest-' ) )
0 commit comments