Skip to content

Allow testing logs with @babel/helper-transform-fixture-test-runner#10326

Merged
nicolo-ribaudo merged 6 commits intobabel:masterfrom
nicolo-ribaudo:test-log
Aug 14, 2019
Merged

Allow testing logs with @babel/helper-transform-fixture-test-runner#10326
nicolo-ribaudo merged 6 commits intobabel:masterfrom
nicolo-ribaudo:test-log

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This is used by #10325, and it would also allow to clean our tests console output and to remove the distinction between fixtures and debug-fixtures in preset-env.

@nicolo-ribaudo nicolo-ribaudo added area: tests PR: Internal 🏠 A type of pull request used for our changelog categories labels Aug 12, 2019
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Aug 12, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11321/

@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11306/

const taskOptsLoc = resolve(taskDir + "/options");
if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc));

const taskLogLoc = resolve(taskDir + "/expected-log.txt");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The debug-fixtures in preset-env is testing against stdout.txt and stderr.txt. I think we could keep consistency here? And it would be great if preset-env does not log to test output after this PR gets merged.

Copy link
Copy Markdown
Member Author

@nicolo-ribaudo nicolo-ribaudo Aug 13, 2019

Choose a reason for hiding this comment

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

👍

} catch (e) {
if (!process.env.OVERWRITE) throw e;

console.log(`Updated test file: ${expectedLoc}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we don't restore the console.log mock, would this line go to the actualLogs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's right

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this is expected. Updated test file: foo.js is used to remind the developer and therefore should always print to stdout, regardless of validateLogs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I meant: "You are right, I will fix it" 😅

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 13, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: tests outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants