You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/jest-environment-puppeteer/src/env.ts
+16-21Lines changed: 16 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -136,41 +136,36 @@ export class PuppeteerEnvironment extends NodeEnvironment {
136
136
super(config,_context);
137
137
138
138
this.global.puppeteerConfig={};
139
-
this.global.jestPuppeteer={};
140
-
}
141
-
142
-
// Jest is not available here, so we have to reverse engineer
143
-
// the setTimeout function, see https://github.com/facebook/jest/blob/ffe2352c781703b427fab10777043fb76d0d4267/packages/jest-runtime/src/index.ts#L2331
144
-
setTimeout(timeout: number){
145
-
this.global[testTimeoutSymbol]=timeout;
146
-
}
147
-
148
-
asyncsetup(): Promise<void>{
149
-
constconfig=awaitreadConfig();
150
-
constglobal=this.global;
151
-
global.puppeteerConfig=config;
152
-
153
-
global.jestPuppeteer={
139
+
this.global.jestPuppeteer={
154
140
debug: async()=>{
155
141
// Set timeout to 4 days
156
142
this.setTimeout(345600000);
157
143
// Run a debugger (in case Puppeteer has been launched with `{ devtools: true }`)
158
-
awaitgetPage(global).evaluate(()=>{
144
+
awaitgetPage(this.global).evaluate(()=>{
159
145
debugger;
160
146
});
161
147
returnblockStdin();
162
148
},
163
149
resetPage: async()=>{
164
-
awaitclosePage(global);
165
-
awaitopenPage(global);
150
+
awaitclosePage(this.global);
151
+
awaitopenPage(this.global);
166
152
},
167
153
resetBrowser: async()=>{
168
-
awaitcloseAll(global);
169
-
awaitinitAll(global);
154
+
awaitcloseAll(this.global);
155
+
awaitinitAll(this.global);
170
156
},
171
157
};
158
+
}
172
159
173
-
awaitinitAll(global);
160
+
// Jest is not available here, so we have to reverse engineer
161
+
// the setTimeout function, see https://github.com/facebook/jest/blob/ffe2352c781703b427fab10777043fb76d0d4267/packages/jest-runtime/src/index.ts#L2331
0 commit comments