Skip to content
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

Passing values from grunt to nodeunit tests #26

Open
creynders opened this issue Feb 25, 2014 · 4 comments
Open

Passing values from grunt to nodeunit tests #26

creynders opened this issue Feb 25, 2014 · 4 comments

Comments

@creynders
Copy link

Is it possible? It would be really handy when testing grunt tasks.

@tkellen
Copy link
Member

tkellen commented Mar 14, 2014

@creynders Could you post an example configuration for this and describe a little more clearly what you're hoping to do?

@creynders
Copy link
Author

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.

@ruyadorno
Copy link

+1 came here looking exactly for that

@AHaliq
Copy link

AHaliq commented May 20, 2016

looking for a solution to this as well

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

No branches or pull requests

4 participants