Skip to content

Commit

Permalink
[DEVX-1739] Print exception for loading playwright config (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianfeng92 authored May 27, 2022
1 parent 50e951b commit 08fd639
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/sauce.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const process = require('process');
const _ = require('lodash');
const fs = require('fs');

let userConfig = {};

Expand All @@ -9,15 +10,19 @@ const configFiles = process.env.PLAYWRIGHT_CFG_FILE ?
['./playwright.config.ts', './playwright.config.js'];

for (const file of configFiles) {
try {
userConfig = require(file);
// it should put config just under root level to get it work with playwright.config.ts
// there is no such issue with playwright.config.js
if (userConfig.default) {
userConfig = userConfig.default;
if (fs.existsSync(file)) {
try {
userConfig = require(file);
// it should put config just under root level to get it work with playwright.config.ts
// there is no such issue with playwright.config.js
if (userConfig.default) {
userConfig = userConfig.default;
}
break;
} catch (e) {
console.error(e);
}
break;
} catch {}
}
}

const overrides = {
Expand Down

0 comments on commit 08fd639

Please sign in to comment.