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

Adding the ability to write tests inline, without fixture files #204

Merged
merged 2 commits into from
Jun 19, 2017

Conversation

elicwhite
Copy link
Member

@elicwhite elicwhite commented Jun 16, 2017

Closes #203

}

const output = transform(
{path: inputPath, source},
Copy link
Member Author

Choose a reason for hiding this comment

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

The one thing that feels a bit gross in this change is that inline tests aren't able to have a path here. It seems like most transforms only use source, but people will be unable to use inline tests with their transform if they use the file path directly.

@fkling
Copy link
Contributor

fkling commented Jun 16, 2017

cc @Daniel15 who built the test utils

@Daniel15
Copy link
Member

Daniel15 commented Jun 17, 2017 via email

@elicwhite
Copy link
Member Author

Yeah, I was thinking about the snapshot test option as I was writing this. I think the snapshot test piece will be able to use the runInlineTest function in this pr under the hood.

// Handle ES6 modules using default export for the transform
const transform = module.default ? module.default : module;

// Jest resets the module registry after each test, so we need to always get
Copy link
Member

Choose a reason for hiding this comment

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

It looks like these comments have gone missing - Could you please re-insert them?

@Daniel15
Copy link
Member

This looks pretty good to me! Please re-insert the comments that have been deleted:

// Handle ES6 modules using default export for the transform
// Jest resets the module registry after each test, so we need to always get
// a fresh copy of jscodeshift on every test run.

And I'll merge this 😃

@elicwhite
Copy link
Member Author

Whoops. Good catch. Updated.

@Daniel15
Copy link
Member

Thank you! :D

@Daniel15 Daniel15 merged commit 454f09d into facebook:master Jun 19, 2017
@elicwhite elicwhite deleted the defineInlineTest branch June 19, 2017 01:40
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.

4 participants