fedwiki / wiki-server

Federated Wiki client and server in Node.js
Other
153 stars 35 forks source link

npm test - working? #60

Closed paul90 closed 9 years ago

paul90 commented 10 years ago

Spotted while doing a little tidy (see #59).

Running the tests, npm test, on Windows do not pass.

While the first is to be expected, the others all fail due to timeout.

Is this just an issue on Windows, or does this problem exist on other platforms?

  8 failing

  1) defaultargs #defaultargs() should modify dependant args:

      AssertionError: expected 'C:\\tmp\\asdf\\pages' to be '/tmp/asdf/pages'
      + expected - actual

      +"/tmp/asdf/pages"
      -"C:\\tmp\\asdf\\pages"

      at Assertion.prop.(anonymous function) [as exactly] (C:\github\wiki-node-server\node_modules\should\lib\should.js:60:14)
      at Context.<anonymous> (C:\github\wiki-node-server\test\defaultargs.coffee:19:22)
      at callFn (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:223:21)
      at Test.Runnable.run (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:216:7)
      at Runner.runTest (C:\github\wiki-node-server\node_modules\mocha\lib\runner.js:374:10)
      at C:\github\wiki-node-server\node_modules\mocha\lib\runner.js:452:12
      at next (C:\github\wiki-node-server\node_modules\mocha\lib\runner.js:299:14)
      at C:\github\wiki-node-server\node_modules\mocha\lib\runner.js:309:7
      at next (C:\github\wiki-node-server\node_modules\mocha\lib\runner.js:247:23)
      at Object._onImmediate (C:\github\wiki-node-server\node_modules\mocha\lib\runner.js:276:5)
      at processImmediate [as _immediateCallback] (timers.js:330:15)

  2) server #actionCB() should create a page:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  3) server #actionCB() should move the paragraphs to the order given :
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  4) server #actionCB() should add a paragraph:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  5) server #actionCB() should remove a paragraph with given id:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  6) server #actionCB() should edit a paragraph in place:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  7) server #actionCB() should default to no change:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  8) server #actionCB() should refuse to create over a page:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (C:\github\wiki-node-server\node_modules\mocha\lib\runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0
paul90 commented 10 years ago

The first test is easily fixed by doing a bit of cross platform coding.

The rest all appear to be due to the test client getting a response to say it is not authorized to write to the server, but the updates appear to get written to the file system. :confused:

rynomad commented 10 years ago

Confirm similar test failings on fresh clone in Ubuntu 14.04:

  10 passing (20s)
  10 failing

  1) page #page.get() should copy a page from plugins if nonexistant in db:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  2) page #page.get() should create a page if it exists nowhere:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  3) page #page.get() should eventually write the page to disk:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  4) server #actionCB() should create a page:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  5) server #actionCB() should move the paragraphs to the order given :
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  6) server #actionCB() should add a paragraph:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  7) server #actionCB() should remove a paragraph with given id:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  8) server #actionCB() should edit a paragraph in place:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  9) server #actionCB() should default to no change:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  10) server #actionCB() should refuse to create over a page:
     Error: timeout of 2000ms exceeded
      at null.<anonymous> (/home/ryan/git/wiki/wiki-node-server/node_modules/mocha/lib/runnable.js:139:19)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0
rynomad commented 10 years ago

I'm also getting no luck from a behavioral test: requests for nonexistent pages just hang on the client end. Chrome dev tools confirm GET request, but no response (not even a 404). it's more than possible I'm just overlooking something since last time I hacked on wiki though.

rynomad commented 10 years ago

Update: upon some inspection, I found my fresh install woes were coming from patch resolution that wasn't happening correctly due to using 'npm link' to get the server code called in the wiki-node directory. not entirely sure how to fix...

paul90 commented 10 years ago

Ryan, thanks for looking.

I've never quite trusted 'npm link' having had links disappear and not noticed. Much rather use 'npm install' with a path, but have started noticing cache issues. So, now I also remove the package from the cache once it's installed.

rynomad commented 10 years ago

that seems reasonable.

My use of 'npm link' is heavily influenced by the fact that I NEVER get anything right the first try, so running npm install against a local directory is something that would get tedious very fast for the number of times I change a dependency for the sake of a dependent that I'm also working on.

I suppose I should note for posterity that my working solution here is to instanstiate ./bin/server.js in wiki node with the -r flag set to the path of my npm linked wiki-node-server, rather than to where it actually lives, this seems to get me off the ground.

WardCunningham commented 10 years ago

I clone a fresh copy of wiki-node-server from master, npm installed, and ran npm test. My results are similar, 10 passing, 10 failing. Can anyone remember when these tests last ran? I was embarrassed to admit to @nrn that I didn't even know they were here and had not been running npm test when I dabbled in the node code.

paul90 commented 9 years ago

Caused by there being no plugins when testing, and this not being captured in file.io in page.coffee.

Fixed as part of the Express 4 upgrade, by detecting that the no plugins and return Page not found.