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

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

Merged
merged 6 commits into from Aug 14, 2019

Conversation

nicolo-ribaudo
Copy link
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
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
Collaborator

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

@@ -141,11 +141,14 @@ export default function get(entryLoc): Array<Suite> {
const taskOptsLoc = resolve(taskDir + "/options");
if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc));

const taskLogLoc = resolve(taskDir + "/expected-log.txt");
Copy link
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
Member Author

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
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
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
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
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.

None yet

4 participants