jasmine-contrib / grunt-jasmine-node

Grunt task for running jasmine-node
MIT License
67 stars 99 forks source link

added grunt 0.4.x support, added helpers, jasmine 1.4.+ #13

Closed ranzwertig closed 11 years ago

ranzwertig commented 11 years ago

I changed it to work with grunt 0.4.x and changed the Project itself to use the latest grunt version. Tested everything with jasmine-node 1.4.+.

other stuff:

patrickarlt commented 11 years ago

+1 for Grunt 0.4 support!

ralf-cestusio commented 11 years ago

+1 for Grunt 0.4 support!

But in the task you should use: junitreport: options.jUnit instead of junitreport: this.options.jUnit otherwise the junit reporter will not work

patrickarlt commented 11 years ago

It would be great is this supported a syntax like the grunt contrib jasmine task did where you can specify source, specsand helpers seperatly

    jasmine_node: {
      src: 'src/**/*.js',
      options: {
        specs: 'spec/*Spec.js',
        helpers: 'spec/*Helpers.js'
      }
    }
s9tpepper commented 11 years ago

Thanks for the PR, I had a few PRs w/ similar changes, this should now be in version 0.1.0. Let me know if there's something to change/add.

ralf-cestusio commented 11 years ago

Will send a PR with some changes soon. (probably tonight) I had a PR open with ranzwertig to add/fix some things.

s9tpepper commented 11 years ago

@patrickarlt Would that options.specs config you have up there be different than specifying specFolders? https://github.com/jasmine-contrib/grunt-jasmine-node/blob/master/tasks/jasmine-node-task.js#L19

Also, the options.helpers config you have up there, that would be a more robust config for what is currently there? Right now it looks for useHelpers to be truthy and then it looks in the "." (project root). https://github.com/jasmine-contrib/grunt-jasmine-node/blob/master/tasks/jasmine-node-task.js#L98

s9tpepper commented 11 years ago

@magicmoose Yea I saw the commits in your PR. I just had like 3 or 4 different PRs with similar changes so I tried to merge as much of the changes from the PRs into one.

Let me know what I missed and we can get that in there too.

ralf-cestusio commented 11 years ago

It seems quite a bit of ranzwertigs change did not make it in. So i cannot really do a pull request which consists of 90% of his contribution.

s9tpepper commented 11 years ago

There were several pull requests so I tried to pull in as many of the changes that covered the fixes to get grunt 0.4.1+ and Jasmine 1.4+ working. But ranzwertigs PR was significantly different from what was already there so I took what I could from all the PRs to make it work.

Are there things/features I missed?

ralf-cestusio commented 11 years ago

Ranzwertig changed the option handling to be that of a grunt 4.x multitask. I think this was actually the really big code difference. Other than that he added some documentation and a unittest.

My PR to him was to add Literate coffeescript support for specs and a few minor fixes.

s9tpepper commented 11 years ago

I see, I can make those updates over the weekend to make it a multi-task.

I did add a 'useCoffee' option that can be set to true which will get passed along to Jasmine. Is that what you were looking for also?

s9tpepper commented 11 years ago

What I added for that: https://github.com/jasmine-contrib/grunt-jasmine-node/blob/master/tasks/jasmine-node-task.js#L87

ralf-cestusio commented 11 years ago

Adding an option for coffee script and passing it to jasmine node is not enough. Normally jasmine node does some preprocessing when it finds the option to change the regular expression to match specs.

We are bypassing the cli and call jasmine with a configuration object. So we have to replicate everything jasmine node does in its cli.

jasmine node itself only knows following options

  var folders =      options['specFolders'];
  var done   =       options['onComplete'];
  var isVerbose =    options['isVerbose'];
  var showColors =   options['showColors'];
  var teamcity =     options['teamcity'];
  var useRequireJs = options['useRequireJs'];
  var matcher =      options['regExpSpec'];
  var junitreport = options['junitreport'];
  var includeStackTrace = options['includeStackTrace'];

I will send you a pull request with what i currently have. (its happily running coffeescript and litcoffee specs in some of my projects) You can use it as an example for any changes you want to make over the weekend

ralf-cestusio commented 11 years ago

Done as https://github.com/jasmine-contrib/grunt-jasmine-node/pull/15