Skip to content

core(asset-saver): fix handling of undefined trace #15451

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 3 commits into from
Sep 14, 2023
Merged

Conversation

adamraine
Copy link
Member

Fixes #15450

@adamraine adamraine requested a review from a team as a code owner September 12, 2023 16:58
@adamraine adamraine requested review from brendankenny and removed request for a team September 12, 2023 16:58
fs.mkdirSync(tmpDir, {recursive: true});
const artifacts = {
DevtoolsLog: [{message: 'first'}, {message: 'second'}],
Trace: {traceEvents},
};

return assetSaver.saveAssets(artifacts, dbwResults.audits, `${tmpDir}/the_file`);
await assetSaver.saveAssets(artifacts, dbwResults.audits, `${tmpDir}/the_file`);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ope, previous attempt had multiple calls to saveAssets, I'll change it back if someone wants

const saveAll = allAssets.map(async (assets, index) => {
if (assets.devtoolsLog) {
const devtoolsLogFilename = `${pathWithBasename}-${index}${devtoolsLogSuffix}`;
await saveDevtoolsLog(assets.devtoolsLog, devtoolsLogFilename);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick callout, using saveDevtoolsLog instead of a generic JSON.stringify and fs.writeFileSync

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a readability change, but in what direction is subjective. seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug - cli: Cannot destructure property 'traceEvents'
4 participants