-
Notifications
You must be signed in to change notification settings - Fork 139
Dont bundle wp scripts #581
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
Conversation
…bundle-wp-scripts
…bundle-wp-scripts
|
One idea - we can use the test WP install used by PHP unit. This does add a barrier to running the tests though, so I've removed them from the standard 'scripts' task. We will have it running on Travis so I think this is OK. |
|
OK I think I've got a solution. Use grunt option to pass the custom path. eg It will default to |
|
This is updated and will read the location from the environment variable if not explicitly passed. Also note that the test for dashes in an attribute was previously unsupported by WordPress, but using the scripts from core means we've got this fix. Anything further need doing here? |
Gruntfile.js
Outdated
| if ( grunt.option( "abspath" ) ) { | ||
| abspath = grunt.option( "abspath" ); | ||
| } else if ( 'WP_DEVELOP_DIR' in process.env ) { | ||
| abspath = process.env.WP_DEVELOP_DIR; |
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.
I think this needs to be process.env.WP_DEVELOP_DIR + '/src/'
$ echo $WP_DEVELOP_DIR
/srv/www/wordpress-develop.dev/
|
I get this error when I try to run the tests locally: What am I doing wrong? |
|
I've updated this to include a task that will perform the check, and throw a fatal if the path isn't found. I've also added a Finally I've updated the docs to indicate how to run these tests. |
|
@danielbachhuber I'd like to get this one live - so am interested in checking whether you are still having problems. Regarding your error, it looks like WP core files are not found. If you run The current logic is as follows
Let me know if you think this needs to be improved. |
Given the additional complexity involved in getting the test suite to run, I still think it's better to just copy the core files into the test suite. |
|
OK. The big problem with this is keeping them up to date with the latest code, as there's quite a few and we may need even more in future. How about a grunt task to automate updating them instead? We can just commit these changes. |
💯 I think this is a much better solution to the general problem. This way, it's just us that have to deal with the burden of the dependency, not everyone that wants to contribute / write tests. |
|
Updated the PR to add this task and include all the necessary scripts. |
.travis.yml
Outdated
| before_script: | ||
| - | | ||
| if [[ "$WP_TRAVISCI" == "travis:phpunit" ]] ; then | ||
| if [[ "$WP_TRAVISCI" == "travis:phpunit" ]] || [[ "$WP_TRAVISCI" == "travis:js-tests" ]]; then |
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.
Does this still need to run for js-tests?
|
@mattheu Noted a few things |
|
Updated to fix issues - I knew I should have just closed this and opened a new PR ;) |
:) |
The JS tests rely on some core WP JS. The solution so far was to bundle a copy of the scripts.
This is obviously a pain.
They get out of date easily.
We depend on quite a few, and may need more in future.
I'd much rather just reference the core files so we can run the tests against whichever version of WP you have.
PROBLEM - how to determine the relative path to these files? I've used an
abspathvariable in the Gruntfile, which you can modify as needed. EG if Shortcake is bundled in a theme on WP VIP.Is there a better solution to this problem? Should I just keep bundling the files and keep them all updated?
Would love some thoughts on this.