Skip to content

Commit

Permalink
feat(core): Add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
wadackel committed Nov 3, 2020
1 parent 0ec7b94 commit c0b9837
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/core/src/tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class Tester {

await this._config.onTestStart(this._config.url, ids);

this._debug(`start ${ids.length} rules`);

await Promise.all(
rules.map((loop) =>
pool.execute(async (browser, args) => {
Expand Down Expand Up @@ -157,14 +159,19 @@ export class Tester {
browser: Browser,
[id, rule, options]: TesterRuleGroup,
): Promise<void> {
this._debug('creating page...');
const page = await browser.page();
this._debug('created page!');

this._debug('set headers & viewport');
await Promise.all([
this._config.headers && page.setExtraHTTPHeaders(this._config.headers),
this._config.viewport && page.setViewport(this._config.viewport),
]);

this._debug('wait for ready...');
await this._waitForReady(page);
this._debug('ready!');

const results: TestcaseResult[] = [];

Expand Down Expand Up @@ -274,4 +281,8 @@ export class Tester {
),
]);
}

private _debug(...args: any[]) {
debug(`${this._config.url}:`, ...args);
}
}

0 comments on commit c0b9837

Please sign in to comment.