Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE: debug: add log lines #287

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/playwright-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
);
return;
}
let result: any = convert.xml2js(xmlData, { compact: true });

Check warning on line 51 in src/playwright-runner.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
if (!result.testsuites || !result.testsuites.testsuite) {
console.warn('JUnit file generation skipped: no test suites detected.');
return;
Expand All @@ -65,7 +65,7 @@
let totalSkipped = 0;
let totalTime = 0;
for (let i = 0; i < result.testsuites.testsuite.length; i++) {
const testsuite = result.testsuites.testsuite[i] as any;

Check warning on line 68 in src/playwright-runner.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
if (testsuite._attributes) {
totalTests += +testsuite._attributes.tests || 0;
totalFailures += +testsuite._attributes.failures || 0;
Expand Down Expand Up @@ -277,6 +277,7 @@

// Copy our runner's playwright config to a custom location in order to
// preserve the customer's config which we may want to load in the future
console.log('Copying Playwright config file.');
const configFileName = (await utils.isEsmProject(runCfg.projectPath))
? 'sauce.config.mjs'
: 'sauce.config.cjs';
Expand All @@ -288,6 +289,7 @@
config: configFile,
};

console.log('Constructing Playwright command arguments.');
const playwrightBin = path.join(
__dirname,
'..',
Expand Down Expand Up @@ -350,6 +352,7 @@
SAUCE_WEB_ASSETS_DIR: runCfg.webAssetsDir,
};

console.log('Setting environment variables.');
utils.setEnvironmentVariables(env);

// Define node/npm path for execution
Expand All @@ -367,13 +370,15 @@
};

// runCfg.path must be set for prepareNpmEnv to find node_modules. :(
console.log('Preparing NPM environment.');
await prepareNpmEnv(runCfg, nodeCtx);

// Run suite preExecs
if (!(await preExec.run(suite, runCfg.preExecTimeout))) {
return false;
}

console.log('Launching Playwright');
const playwrightProc = spawn(nodeBin, procArgs, {
stdio: 'inherit',
cwd: runCfg.projectPath,
Expand All @@ -397,6 +402,7 @@
});

try {
console.log('Waiting for Playwright to finish...');
return await Promise.race([timeoutPromise, playwrightPromise]);
} catch (e) {
console.error(`Failed to run Playwright: ${e}`);
Expand Down
4 changes: 4 additions & 0 deletions src/sauce.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
console.log('Top of sauce.config.cjs');

const process = require('process');
const _ = require('lodash');
const fs = require('fs');
Expand All @@ -13,6 +15,7 @@ for (const file of configFiles) {
if (fs.existsSync(file)) {
try {
userConfig = require(file);
console.log('User config file loaded...');
// 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) {
Expand Down Expand Up @@ -90,4 +93,5 @@ function arrMerger(objValue, srcValue) {
}
}

console.log('Config merged!');
module.exports = _.mergeWith(userConfig, overrides, arrMerger);
Loading