Opened 11 years ago
Closed 11 years ago
#27343 closed defect (bug) (fixed)
Update phpunit grunt task to not use deprecated util
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description
Grunt is deprecating the Grunt.Util.* api (mentioned in the 0.4.3 announcement http://gruntjs.com/blog/2014-03-07-grunt-0.4.3-released and the 0.4.2 announcement http://gruntjs.com/blog/2013-11-21-grunt-0.4.2-released)
Attachments (2)
Change History (12)
#2
@
11 years ago
I'm going to try to look at this soon, but if anyone can help point me in the right direction regarding any new API it should be using as opposed to adding a new dependency on grunt-legacy-util, I'd appreciate it.
#3
follow-up:
↓ 5
@
11 years ago
- Milestone changed from Awaiting Review to 4.0
Looking at this, I see a number of options.
1) Do nothing for now. While it is deprecated, it isn't removed. We can continue using it and make a decision later. This has the lowest overhead.
2) We can add https://github.com/gruntjs/grunt-legacy-util which contains the spawn task. This is similar to option one, but with the benefit/cost of lasting longer.
3) We can maintain our own copy of grunt.util.spawn and use that. This has the highest long term cost since it means we will now need to maintain more outside code.
4) We can write a new wrapper using http://nodejs.org/api/child_process.html to run phpunit. This has the cost of taking the most time to get working across the most environments. grunt.util.spawn includes https://github.com/cowboy/node-exit which we would likely also want to include in order to make the task possibly work on windows. (does it work there now? I have no idea)
Option 2 seems to be the best choice to me. grunt-util-spawn is a nice function that does everything we need. If a better replacement comes out we can reassess and update then. Patch attached to do just that.
#5
in reply to:
↑ 3
@
11 years ago
Replying to jorbin:
Looking at this, I see a number of options.
Option 2 seems to be the best choice to me. grunt-util-spawn is a nice function that does everything we need. If a better replacement comes out we can reassess and update then. Patch attached to do just that.
Agreed, this sounds like the best plan for now.
I looked into the option of using grunt-phpunit though we can't currently parse environments variables to the Grunt task Issue #25 so we cannot use the task to start the PHPUnit tests for Multisite. We could look to use this in a further iteration down the road.
I'll go and test this with #bbPress2576 shortly and report back.
#6
@
11 years ago
Testing 27343.diff
is odd... Same for both bbPress and WordPress using either Grunt ~0.4.2
or ~0.4.4
Warning/Error message: Local Npm module "grunt-legacy-util" not found. Is it installed?`
$ npm install info trying registry request attempt 1 at 13:01:34 http GET https://registry.npmjs.org/grunt-legacy-util http 304 https://registry.npmjs.org/grunt-legacy-util info trying registry request attempt 1 at 13:01:35 http GET https://registry.npmjs.org/hooker info trying registry request attempt 1 at 13:01:35 http GET https://registry.npmjs.org/async info trying registry request attempt 1 at 13:01:35 http GET https://registry.npmjs.org/underscore.string info trying registry request attempt 1 at 13:01:35 http GET https://registry.npmjs.org/lodash info trying registry request attempt 1 at 13:01:35 http GET https://registry.npmjs.org/exit info trying registry request attempt 1 at 13:01:35 http GET https://registry.npmjs.org/getobject info trying registry request attempt 1 at 13:01:35 http GET https://registry.npmjs.org/which http 304 https://registry.npmjs.org/hooker http 304 https://registry.npmjs.org/underscore.string http 304 https://registry.npmjs.org/async http 304 https://registry.npmjs.org/lodash http 304 https://registry.npmjs.org/exit http 304 https://registry.npmjs.org/getobject http 304 https://registry.npmjs.org/which grunt-legacy-util@0.1.2 node_modules/grunt-legacy-util ├── which@1.0.5 ├── getobject@0.1.0 ├── async@0.1.22 ├── hooker@0.2.3 ├── exit@0.1.2 ├── lodash@0.9.2 └── underscore.string@2.2.1 $ grunt >> Local Npm module "grunt-legacy-util" not found. Is it installed?
#7
@
11 years ago
That error was do to grunt-legacy-util being passed to loadNpmTask despite not actually containing any tasks. New patch fixes that.
#8
@
11 years ago
Ahhhh... That makes sense, 27343.2.diff works for me.
All Grunt tasks that use the phpunit
task works for me: grunt phpunit
, grunt phpunit:default
, grunt phpunit:ajax
, grunt phpunit:multisite
, grunt test
and grunt travis
.
Also "grunt-legacy-util": "^0.2.0",
the ^
caret infers that only v0.2.0 is compatible, correct? (via semver)
Just committed this to bbPress via #bbPress2576 / [bbpress5346] and patch added for #BuddyPress5627
Related: #27340
https://www.npmjs.org/package/grunt-contrib-watch
grunt-contrib-watch v0.5.3 -> v0.6.0
https://www.npmjs.org/package/grunt-contrib-jshint
grunt-contrib-jshint v0.8.0 -> v0.9.0