-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
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 Report
|
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
Test are running fine on my local machine, not sure what's with the failing checks. |
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: