ghost-inspector / node-ghost-inspector

Ghost Inspector CLl & API Library for Node.js
https://ghostinspector.com/docs/api/
MIT License
28 stars 6 forks source link

Question on running tests #22

Closed starunova closed 3 years ago

starunova commented 3 years ago

Hello E.g. I have some module with a number of folders containing scripts launching on demand some tests how do I launch then entirely(all tests in module) and by folder? I mean with npm Thank you

aaronfay commented 3 years ago

Hi @starunova,

Generally you can drop scripts into your package.json file under the "scripts" array. Assuming you had a structure that looked like this:

.
├── my-gi-tests/
│   ├── my-test.json
│   └── run-my-test.js
└──package.json

You could add this to your package.json :

{
  "scripts": {
    "gi-test": "node ./my-gi-tests/run-my-test.js"
  }
}

And then execute that like this:

npm run gi-test

To run all of the tests at once will probably require some kind of wrapper (instead of the ./my-gi-tests/run-my-test.js script) but some experimentation may be required to get the results you're looking for.

Hope that helps you get going! 👋🏻