Skip to content

fix: debug info causes error #3882

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

Merged
merged 2 commits into from
Oct 6, 2023
Merged
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
24 changes: 24 additions & 0 deletions lib/command/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,27 @@ module.exports = async function (path) {
output.print('Please copy environment info when you report issues on GitHub: https://github.com/Codeception/CodeceptJS/issues');
output.print('***************************************');
};

module.exports.getMachineInfo = async () => {
const info = {
nodeInfo: await envinfo.helpers.getNodeInfo(),
osInfo: await envinfo.helpers.getOSInfo(),
cpuInfo: await envinfo.helpers.getCPUInfo(),
chromeInfo: await envinfo.helpers.getChromeInfo(),
edgeInfo: await envinfo.helpers.getEdgeInfo(),
firefoxInfo: await envinfo.helpers.getFirefoxInfo(),
safariInfo: await envinfo.helpers.getSafariInfo(),
};

output.print('***************************************');
for (const [key, value] of Object.entries(info)) {
if (Array.isArray(value)) {
output.print(`${key}: ${value[1]}`);
} else {
output.print(`${key}: ${JSON.stringify(value, null, ' ')}`);
}
}
output.print('If you need more detailed info, just run this: npx codeceptjs info');
output.print('***************************************');
return info;
};
4 changes: 2 additions & 2 deletions lib/command/run-workers.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ module.exports = async function (workerCount, selectedRuns, options) {

try {
if (options.verbose) {
const getInfo = require('./info');
await getInfo();
const { getMachineInfo } = require('./info');
await getMachineInfo();
}
await workers.bootstrapAll();
await workers.run();
Expand Down
4 changes: 2 additions & 2 deletions lib/command/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ module.exports = async function (test, options) {
codecept.loadTests(test);

if (options.verbose) {
const getInfo = require('./info');
await getInfo();
const { getMachineInfo } = require('./info');
await getMachineInfo();
}

await codecept.run();
Expand Down
3 changes: 1 addition & 2 deletions test/runner/interface_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ describe('CodeceptJS Interface', () => {
it('should not propagate retries to non retried steps', (done) => {
exec(`${config_run_config('codecept.retry.json')} --grep @test2 --verbose`, (err, stdout) => {
expect(stdout).toContain('Retry'); // feature
expect(stdout).toContain('Retries: 5'); // test name
expect(err).toBeFalsy();
expect(stdout).toContain('Retries: 1'); // test name
done();
});
});
Expand Down