Skip to content

Commit

Permalink
default npx qawolf test to headless
Browse files Browse the repository at this point in the history
  • Loading branch information
jperl committed Mar 10, 2020
1 parent 11df539 commit 59091c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ program
.option('--all-browsers', 'run tests on chromium, firefox, and webkit')
.option('--chromium', 'run tests on chromium')
.option('--firefox', 'run tests on firefox')
.option('--headless', 'run tests headless')
.option('--repl', 'open a REPL when repl() is called')
.option('--webkit', 'run tests on webkit')
.description('run a test with Jest')
Expand All @@ -89,6 +90,7 @@ program
'--all-browsers',
'--chromium',
'--firefox',
'--headless',
'--repl',
'--webkit',
]);
Expand All @@ -110,6 +112,7 @@ program
try {
runJest(args, {
browsers,
headless: !!cmd.headless,
repl: !!cmd.repl,
rootDir: cmd.rootDir,
});
Expand Down
9 changes: 8 additions & 1 deletion src/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type RunJestOptions = {
browsers?: BrowserName[];
config?: string;
env?: NodeJS.ProcessEnv;
headless?: boolean;
repl?: boolean;
rootDir?: string;
};
Expand Down Expand Up @@ -32,7 +33,13 @@ export const runJest = (
/**
* Returns exit code. 0 for success, 1 for failed.
*/
let command = `npx jest`;
let command = '';

if (!options.headless) {
command += 'QAW_HEADLESS=false ';
}

command += `npx jest`;

if (!args.some(arg => arg.startsWith('--config'))) {
// prevent using the local jest config
Expand Down

0 comments on commit 59091c5

Please sign in to comment.