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

Output dir support wip #180 #396

Closed
wants to merge 4 commits into from
Closed

Conversation

vladnicula
Copy link

What:
#180

Why:
Prevents polluting src tree when preparing production / static builds.

How:
By saving the optional key outputDir in the babel plugin state and doing extra stuff if that key is present at the end of the babel transformation.

Checklist:

  • Documentation N/A
  • Tests
  • Code complete

@vladnicula
Copy link
Author

Cannot add test. With the current master, duplicating the first fs test breaks the following tests. Need help with that. Not sure what code complete is.

@codecov
Copy link

codecov bot commented Oct 12, 2017

Codecov Report

Merging #396 into master will decrease coverage by 0.26%.
The diff coverage is 77.77%.

Impacted Files Coverage Δ
packages/babel-plugin-emotion/src/index.js 92.59% <77.77%> (-1.41%) ⬇️

@@ -32,13 +38,34 @@ describe('babel plugin fs', () => {
babelrc: false
})
expect(fs.existsSync).toBeCalledWith(cssFilename)
expect(mkdirp.sync).not.toBeCalledWith()
expect(touch.sync).toBeCalledWith(cssFilename)
expect(fs.writeFileSync).toHaveBeenCalled()
expect(fs.writeFileSync.mock.calls[0][0]).toBe(cssFilename)
Copy link
Member

Choose a reason for hiding this comment

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

In order to use the fs mock, you need to increment the array index like these.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

That's a mistake. I wanted to check it wasn't called with anything, because the mkdirp should only be used when the outputDir property is provided.

@vladnicula
Copy link
Author

Test are running fine on my local machine, not sure what's with the failing checks.

@wardpeet wardpeet mentioned this pull request Mar 2, 2018
3 tasks
@tkh44 tkh44 closed this Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants