Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 436 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what does grunt "test command" do on npm init

#1
I'm trying to learn grunt. When I run npm init, I get a prompt in the process of creating a package.json file that asks for "test command" - I'm not sure how to utilize this, or what it's expecting. It doesn't seem to be well documented. If I leave it blank, I get this in the resulting package.json file:

"scripts": {
//"test": "echo \"Error: no test specified\" && exit 1"
},

Can anybody shed some light on how to set up a test script?
Reply

#2
at first, the scripts-property in your package.json has nothing to do with grunt itself. its just a cli-command from npm, wich will be run if you run

$ npm test

read more about that here:

[To see links please register here]


e.g. if you test your application with the [grunt & nodeunit](

[To see links please register here]

) you could just add that to the scripts-block

"scripts": {
"test": "grunt nodeunit"
}

and your nodeunit-task is run if you run 'npm test'

this basically makes it easier for continuous integration and so on, if you change your underlying testframework.

of course you could add an [alias-task](

[To see links please register here]

) if you need more to be done before and after your tests are run (e.g. concatenation before, cleanup after)
Reply

#3
As mentioned in the answer above you can run your test command when you specify it during creation of package json from cmd or by editing the json file manually.
Basically as per the npm docs it is used to run the provided package's test script.

[npm docs test][1]

In my case , Iam using it to test an angular application using Jasmine(spec.js files) a sample usage can be found in this article :-

[Getting Started with Node.js and Jasmine][2]


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through