Skip to content

[5.7] Add mix helper tests #26369

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

Merged
merged 1 commit into from
Nov 3, 2018
Merged

[5.7] Add mix helper tests #26369

merged 1 commit into from
Nov 3, 2018

Conversation

timacdonald
Copy link
Member

@timacdonald timacdonald commented Nov 3, 2018

Added a bunch of test for the mix helper. I guess these are really just a bunch of happy path tests, but who doesn't love a happy path?!

I believe the only mix code paths that are now not covered by tests are the when the manifest does exist, but the asset does not. Reason being it hits the global report function and gets the config off the app helper and the tests felt really brittle making it all work with that. However, I'll do up some additional tests (if this kinda thing is wanted) for 5.8 as we should be able to inject the dependencies as mix is now bound to the container in 5.8.

I did make changes to the existing test, but only to use the makeManifest() helper that I extracted. It still tests the same thing. If you want this reverted let me know.

I've made the manifest and hot files match what Laravel Mix actually outputs, for consistency.

When adding json to the manifest we are pretty printing the JSON, as well as not escaping slashes, so instead of...

{"\/unversioned.css":"\/versioned.css"}

it will now output what Mix actually outputs....

{
    "/unversioned.css": "/versioned.css"
}

Also, when Mix is run with nom run hot it has a new line, so I've also added the new line, again to stay consistent. I assume that is why when getting the file content rtrim is used - to remove that new line.

@timacdonald timacdonald changed the title [5.7] Mix tests [5.7] Add mix helper tests Nov 3, 2018
@taylorotwell taylorotwell merged commit c2cbdc0 into laravel:5.7 Nov 3, 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