Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Rowdy throws error if used in strict mode #48

Closed
benbayard opened this issue Apr 27, 2016 · 8 comments
Closed

Rowdy throws error if used in strict mode #48

benbayard opened this issue Apr 27, 2016 · 8 comments

Comments

@benbayard
Copy link

If you supply mocha/node with the --use_strict flag, rowdy throws the following error:

     TypeError: Cannot read property 'async' of undefined
      at node_modules/portscanner/node_modules/async/lib/async.js:8:30
      at Object.<anonymous> (node_modules/portscanner/node_modules/async/lib/async.js:690:2)
      at require (internal/module.js:20:19)
      at Object.<anonymous> (node_modules/portscanner/node_modules/async/index.js:3:18)
      at require (internal/module.js:20:19)
      at Object.<anonymous> (node_modules/portscanner/lib/portscanner.js:3:14)
      at require (internal/module.js:20:19)
      at Server.start (node_modules/rowdy/lib/server.js:83:21)
      at Function.rowdy.setupServer (node_modules/rowdy/index.js:59:19)
      at Context.<anonymous> (node_modules/rowdy/adapters/mocha/server.js:30:11)
@ryan-roemer
Copy link
Member

@benbayard -- Holla! Can you get me a reproduction within this repo (against one of the /examples tests) and with upgrade steps?

@benbayard
Copy link
Author

@ryan-roemer let me try.

@benbayard
Copy link
Author

Hey @ryan-roemer ! Yes, I can reproduce this with an example.

Changing scripts.test-webdriverio-per-test-client to cd examples/mocha/webdriverio && mocha --require ./setup-per-test-client --use_strict

produces the same error above in the before all hook. Here is the output from npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/Users/ben/.nvm/versions/node/v5.11.0/bin/node',
1 verbose cli   '/Users/ben/.nvm/versions/node/v5.11.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'test-webdriverio' ]
2 info using npm@3.8.7
3 info using node@v5.11.0
4 verbose run-script [ 'pretest-webdriverio',
4 verbose run-script   'test-webdriverio',
4 verbose run-script   'posttest-webdriverio' ]
5 info lifecycle rowdy@0.5.0~pretest-webdriverio: rowdy@0.5.0
6 silly lifecycle rowdy@0.5.0~pretest-webdriverio: no script for pretest-webdriverio, continuing
7 info lifecycle rowdy@0.5.0~test-webdriverio: rowdy@0.5.0
8 verbose lifecycle rowdy@0.5.0~test-webdriverio: unsafe-perm in lifecycle true
9 verbose lifecycle rowdy@0.5.0~test-webdriverio: PATH: /Users/ben/.nvm/versions/node/v5.11.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/ben/Projects/github.com/FormidibleLabs/rowdy/node_modules/.bin:/Users/ben/.nvm/versions/node/v5.11.0/bin:./node_modules/.bin:/Users/ben/.rbenv/shims:/Users/ben/.nvm/versions/node/v5.11.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle rowdy@0.5.0~test-webdriverio: CWD: /Users/ben/Projects/github.com/FormidibleLabs/rowdy
11 silly lifecycle rowdy@0.5.0~test-webdriverio: Args: [ '-c',
11 silly lifecycle   'npm run test-webdriverio-manual-config && npm run test-webdriverio-per-test-client' ]
12 silly lifecycle rowdy@0.5.0~test-webdriverio: Returned: code: 1  signal: null
13 info lifecycle rowdy@0.5.0~test-webdriverio: Failed to exec test-webdriverio script
14 verbose stack Error: rowdy@0.5.0 test-webdriverio: `npm run test-webdriverio-manual-config && npm run test-webdriverio-per-test-client`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/Users/ben/.nvm/versions/node/v5.11.0/lib/node_modules/npm/lib/utils/lifecycle.js:244:16)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at EventEmitter.emit (events.js:185:7)
14 verbose stack     at ChildProcess.<anonymous> (/Users/ben/.nvm/versions/node/v5.11.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at ChildProcess.emit (events.js:185:7)
14 verbose stack     at maybeClose (internal/child_process.js:850:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid rowdy@0.5.0
16 verbose cwd /Users/ben/Projects/github.com/FormidibleLabs/rowdy
17 error Darwin 15.4.0
18 error argv "/Users/ben/.nvm/versions/node/v5.11.0/bin/node" "/Users/ben/.nvm/versions/node/v5.11.0/bin/npm" "run" "test-webdriverio"
19 error node v5.11.0
20 error npm  v3.8.7
21 error code ELIFECYCLE
22 error rowdy@0.5.0 test-webdriverio: `npm run test-webdriverio-manual-config && npm run test-webdriverio-per-test-client`
22 error Exit status 1
23 error Failed at the rowdy@0.5.0 test-webdriverio script 'npm run test-webdriverio-manual-config && npm run test-webdriverio-per-test-client'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the rowdy package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     npm run test-webdriverio-manual-config && npm run test-webdriverio-per-test-client
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs rowdy
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls rowdy
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

@ryan-roemer
Copy link
Member

ryan-roemer commented Apr 28, 2016

@benbayard -- It looks like the issue is that portscanner requires an ancient version of async@0.1.15 that still has this (now closed) issue: caolan/async#189

UPDATE: portscanner has a PR to update async which should fix this: baalexander/node-portscanner#37

Hopefully we can just wait on that and update portscanner...

@ryan-roemer
Copy link
Member

... but that PR is old and unmerged. If you can suggest a new lib / code snippet to detect if a server is listening already on a port, I can swap it out for portscanner...

@laggingreflex
Copy link

laggingreflex commented Nov 19, 2016

Update: portscanner has updated async to 1.5.2. Released a new minor version 1.1.0.

@ryan-roemer
Copy link
Member

ryan-roemer commented Nov 23, 2016

So, the portscanner thing is fixed on just a reinstall (picking up minor), but vargs fails now:

$  npm run test-wd-default-config -- --use_strict

> rowdy@0.5.0 test-wd-default-config /Users/rye/scm/fmd/rowdy
> cd examples/mocha/wd && mocha "--use_strict"

/Users/rye/scm/fmd/rowdy/node_modules/vargs/lib/vargs.js:24
exports.Constructor = function Vargs(arguments) {
                                     ^^^^^^^^^

SyntaxError: Unexpected eval or arguments in strict mode

Oh, and for anyone watching along, you can repro this on the unchanged repo with:

$ npm run test-wd-default-config -- --use_strict

More info:

$ npm ls vargs
rowdy@0.5.0 /Users/rye/scm/fmd/rowdy
└─┬ wd@0.3.12
  └── vargs@0.1.0 

@ryan-roemer
Copy link
Member

OK, so wd has the offending vargs, but that's an optional install. webdriverio is the recommended engine (it's what I use) and those tests now work just fine and should for this app as a real dependency.

Closing!

@benbayard -- Let me know if anything else crops up!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants