1

I'm new to nodejs, working on Webstorm 9.0.1, i'm trying to use Lab module for tests using this tutorial https://medium.com/the-spumko-suite/testing-hapi-services-with-lab-96ac463c490a

My package.json file contains the following :

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "./node_modules/lab/bin/lab -c"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "hapi": "^8.0.0",
    "joi": "^5.0.2",
    "lab": "^5.1.0"
  }
}

The local node_modules directory is created in the directory C:\Users\DT002\WebstormProjects\hapiB\test>

the problem is that when i try to test, i got the following error :

> C:\Users\DT002\WebstormProjects\hapiB\test>npm test
> 
> test@1.0.0 test C:\Users\DT002\WebstormProjects\hapiB\test
> ./node_modules/lab/bin/lab -c

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

Thank you for any suggestions.

DT-dev
  • 11
  • 1
  • 4
  • Please see http://stackoverflow.com/questions/18413157/how-do-i-get-rid-of-error-is-not-recognized-as-an-internal-or-external-comm: you need to remove './' and change path separators – lena Dec 24 '14 at 13:54

1 Answers1

0

The instructions in your scripts runs as a commands in the terminal. You have in your npm test: "./node_modules/lab/bin/lab -c".

What the system is complaining is the first dot that you have there. You can remove the ./ and the error will go away.

{ "test": "node_modules/lab/bin/lab -c" }
fmsf
  • 36,317
  • 49
  • 147
  • 195
  • I tried this but it gives me the following: C:\Users\DT002\WebstormProjects\hapiB\test>npm test > test@1.0.0 test C:\Users\DT002\WebstormProjects\hapiB\test > node_modules/lab/bin/lab -c **'node_modules' is not recognized as an internal or external command,** operable program or batch file. npm ERR! Test failed. See above for more details. npm ERR! not ok code 0 – DT-dev Dec 24 '14 at 10:02
  • since it is windows, don't you need to have the bars pointing to the left? \ instead of / ? – fmsf Dec 24 '14 at 11:55