mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(test runner): add some fixture debugging (#8918)
This commit is contained in:
parent
219d00d17b
commit
40ae28e3bb
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { formatLocation, wrapInPromise } from './util';
|
||||
import { formatLocation, wrapInPromise, debugTest } from './util';
|
||||
import * as crypto from 'crypto';
|
||||
import { FixturesWithLocation, Location, WorkerInfo, TestInfo, TestStepInternal } from './types';
|
||||
|
||||
@ -67,6 +67,7 @@ class Fixture {
|
||||
let called = false;
|
||||
const setupFence = new Promise<void>((f, r) => { setupFenceFulfill = f; setupFenceReject = r; });
|
||||
const teardownFence = new Promise(f => this._teardownFenceCallback = f);
|
||||
debugTest(`setup ${this.registration.name}`);
|
||||
this._tearDownComplete = wrapInPromise(this.registration.fn(params, async (value: any) => {
|
||||
if (called)
|
||||
throw new Error(`Cannot provide fixture value for the second time`);
|
||||
@ -94,6 +95,7 @@ class Fixture {
|
||||
await fixture.teardown();
|
||||
this.usages.clear();
|
||||
if (this._setup) {
|
||||
debugTest(`teardown ${this.registration.name}`);
|
||||
this._teardownFenceCallback();
|
||||
await this._tearDownComplete;
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import url from 'url';
|
||||
import type { TestError, Location } from './types';
|
||||
import { default as minimatch } from 'minimatch';
|
||||
import { errors } from '../..';
|
||||
import debug from 'debug';
|
||||
|
||||
export async function pollUntilDeadline(testInfo: TestInfoImpl, func: (remainingTime: number) => Promise<boolean>, pollTime: number | undefined, deadlinePromise: Promise<void>): Promise<void> {
|
||||
let defaultExpectTimeout = testInfo.project.expect?.timeout;
|
||||
@ -189,3 +190,5 @@ export function expectType(receiver: any, type: string, matcherName: string) {
|
||||
export function sanitizeForFilePath(s: string) {
|
||||
return s.replace(/[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-');
|
||||
}
|
||||
|
||||
export const debugTest = debug('pw:test');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user