grunt-contrib-nodeunit
grunt-contrib-nodeunit copied to clipboard
Passing values from grunt to nodeunit tests
Is it possible? It would be really handy when testing grunt tasks.
@creynders Could you post an example configuration for this and describe a little more clearly what you're hoping to do?
Maybe something like this:
nodeunit:{
tests : {
values : {
foo : 'bar'
},
options:{
//options
}
}
}
In which case foo would be injected into all relevant tests.
I encountered it first when working on grunt_generate_configs where my npm test consisted out of multiple runs of the grunt task with different flags. However I needed to be able to access those flags in my tests as well to verify the correct functioning of the task. In the end I solved it by storing the flags in process.env and having the tests access them there. Certainly doable, but it would've been nicer to have been able to access them directly.
+1 came here looking exactly for that
looking for a solution to this as well