Add browser unit tests to product build (#90353)

* wip - add browser unit tests to product build

* run with more output

* load loader via script tag
This commit is contained in:
Benjamin Pasero
2020-02-10 12:44:28 +01:00
committed by GitHub
parent 7b8c5cdf86
commit cdf4026fb6
5 changed files with 42 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ const playwright = require('playwright');
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
const optimist = require('optimist')
// .describe('grep', 'only run tests matching <pattern>').alias('grep', 'g').alias('grep', 'f').string('grep')
// .describe('build', 'run with build output (out-build)').boolean('build')
.describe('build', 'run with build output (out-build)').boolean('build')
.describe('run', 'only run tests matching <relative_file_path>').string('run')
.describe('glob', 'only run tests matching <glob_pattern>').string('glob')
.describe('debug', 'do not run browsers headless').boolean('debug')
@@ -122,6 +122,9 @@ async function runTestsInBrowser(testModules, browserType) {
const browser = await playwright[browserType].launch({ headless: !Boolean(argv.debug) });
const page = (await browser.defaultContext().pages())[0]
const target = url.pathToFileURL(path.join(__dirname, 'renderer.html'));
if (argv.build) {
target.search = `?build=true`;
}
await page.goto(target.href);
const emitter = new events.EventEmitter();