namshi / mockserver

Mock your backends in a matter of seconds. HTTP is King.
351 stars 89 forks source link

npm install fails on windows #18

Open seetsy opened 9 years ago

seetsy commented 9 years ago

On Windows 7: "npm install -D mockserver"

npm ERR! Error: ENOENT: no such file or directory, open 'C:\myProject\node_modules\mockserver\test\mocks\return-200\POST--{"json": "yesPlease"}.mock'

I think it is because Windows doesn't like the quotes in the file name.

ZaValera commented 9 years ago

I have a same problem on Windows 8:

$ npm install mockserver npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "mockserver" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! path D:\node_modules\mockserver\test\mocks\return-200\POST--{"json": "yesPlease"}.mock npm ERR! code ENOENT npm ERR! errno -4058

npm ERR! enoent ENOENT, open 'D:\node_modules\mockserver\test\mocks\return-200\POST--{"json": "yesPlease"}.mock' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent

npm ERR! Please include the following file with any support request: npm ERR! D:\npm-debug.log

unlucio commented 9 years ago

Hi guys, thank you for point out the issue but unfortunately nobody of us owns a windows where to try to debug this. Just out of curiosity: can you clone this repo and try running the included tests? That would start kind of pointing out the direction. It would be great to see a PR tho from who for sure knows windows better ^^

seetsy commented 9 years ago

Just did a fresh pull. Here are the test results from windows. It looks like line breaks are causing some tests to fail.

c:\github\mockserver>mocha

mockserver mockserver() 1) should return a valid response √ should return 404 if the mock does not exist 2) should be able to handle trailing slashes without changing the name of the mockfile 3) should be able to handle multiple headers √ should be able to handle status codes different than 200 √ should be able to handle HTTP methods other than GET √ should be able to handle empty bodies √ should be able to correctly map / √ should be able to map multi-level urls √ should be able to handle GET parameters √ should default to GET.mock if no matching parameter file is found √ should be able track custom headers √ should attempt to fall back to a base method if a custom header is not found in a file √ should look for alternate combinations of headers if a custom header is not found √ should be able track custom headers with variation and query params 4) should keep line feeds (U+000A) √ should be able to include POST bodies in the mock location 5) should be able to include POST json in the mock location √ Should default to POST.mock if no match for body is found √ Should return 404 when no default .mock files are found

15 passing (58ms) 5 failing

1) mockserver mockserver() should return a valid response:

  AssertionError: '{"Content-Type":"text\\r"}' == '{"Content-Type":"text"}'
  + expected - actual

  -{"Content-Type":"text\r"}
  +{"Content-Type":"text"}

  at Context.<anonymous> (c:\github\mockserver\test\mockserver.js:51:20)
  at callFn (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:286:21)
  at Test.Runnable.run (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:279:7)
  at Runner.runTest (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:421:10)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:528:12
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:341:14)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:351:7
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:283:14)
  at Immediate._onImmediate (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:319:5)

2) mockserver mockserver() should be able to handle trailing slashes without changing the name of the mockfile:

  AssertionError: '{"Content-Type":"text\\r"}' == '{"Content-Type":"text"}'
  + expected - actual

  -{"Content-Type":"text\r"}
  +{"Content-Type":"text"}

  at Context.<anonymous> (c:\github\mockserver\test\mockserver.js:66:20)
  at callFn (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:286:21)
  at Test.Runnable.run (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:279:7)
  at Runner.runTest (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:421:10)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:528:12
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:341:14)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:351:7
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:283:14)
  at Immediate._onImmediate (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:319:5)

3) mockserver mockserver() should be able to handle multiple headers:

  AssertionError: '{"Content-Type":"text/xml; charset=utf-8\\r","Cache-Control":"public, max-age=300\\r"}' == '{"Content-Type":"text/xml; charset=utf-8","Cache-Control":"p

ublic, max-age=300"}'

  -{"Content-Type":"text/xml; charset=utf-8\r","Cache-Control":"public, max-age=300\r"}
  +{"Content-Type":"text/xml; charset=utf-8","Cache-Control":"public, max-age=300"}

  at Context.<anonymous> (c:\github\mockserver\test\mockserver.js:73:20)
  at callFn (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:286:21)
  at Test.Runnable.run (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:279:7)
  at Runner.runTest (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:421:10)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:528:12
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:341:14)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:351:7
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:283:14)
  at Immediate._onImmediate (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:319:5)

4) mockserver mockserver() should keep line feeds (U+000A):

  AssertionError: 'ColumnA\tColumnB\tColumnC\r\nA1\tB1\tC1\r\nA2\tB2\tC2\r\nA3\tB3\tC3\r\n' == 'ColumnA\tColumnB\tColumnC\nA1\tB1\tC1\nA2\tB2\tC2\nA3\tB3\tC3\n'
  + expected - actual

  -ColumnA  ColumnB ColumnC
  -A1       B1      C1
  -A2       B2      C2
  -A3       B3      C3
  +ColumnA  ColumnB ColumnC
  +A1       B1      C1
  +A2       B2      C2
  +A3       B3      C3

  at Context.<anonymous> (c:\github\mockserver\test\mockserver.js:194:20)
  at callFn (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:286:21)
  at Test.Runnable.run (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:279:7)
  at Runner.runTest (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:421:10)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:528:12
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:341:14)
  at C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:351:7
  at next (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:283:14)
  at Immediate._onImmediate (C:\Users\seetsy\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:319:5)

5) mockserver mockserver() should be able to include POST json in the mock location: Uncaught AssertionError: undefined == 'yes, we haZ it' at MockIncomingMessage. (c:\github\mockserver\test\mockserver.js:240:22) at endReadableNT (_stream_readable.js:893:12)

vinothvk commented 8 years ago

is this resolved? i am getting same error