Skip to content

Commit

Permalink
[test] fix skipping a page if it is not matching
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Jan 31, 2020
1 parent 4f6ff90 commit a920c01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions dev-packages/cli/src/run-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default async function runTest(options: TestOptions): Promise<void> {

const testPage = await newTestPage({
files: options.files,
matchAppUrl: () => true, // all urls are application urls
newPage: async () => {
const browser = await puppeteer.launch(launch);
return browser.newPage();
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/cli/src/test-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default async function newTestPage(options: TestPageOptions): Promise<pup
page.exposeFunction('fireDidUnloadTheia', () => theiaLoaded = false);
const preLoad = (frame: puppeteer.Frame) => {
const frameUrl = frame.url();
if (matchAppUrl && matchAppUrl(frameUrl)) {
if (matchAppUrl && !matchAppUrl(frameUrl)) {
return;
}
if (theiaLoaded) {
Expand All @@ -76,7 +76,7 @@ export default async function newTestPage(options: TestPageOptions): Promise<pup
page.on('framenavigated', preLoad);

page.on('load', async () => {
if (matchAppUrl && matchAppUrl(page.url())) {
if (matchAppUrl && !matchAppUrl(page.url())) {
return;
}
console.log('loading mocha...');
Expand Down

0 comments on commit a920c01

Please sign in to comment.