Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null-Value in config results in ERROR RangeError: Maximum call stack size exceeded #1289

Closed
plusgut opened this issue Nov 18, 2016 · 0 comments

Comments

@plusgut
Copy link
Contributor

plusgut commented Nov 18, 2016

nightwatch.json:
{ "foobar": null }

Verbose:

ERROR RangeError: Maximum call stack size exceeded
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:111:33)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
    at Object.CliRunner.replaceEnvVariables (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:116:14)
There was an error while starting the test runner:

Error: No testing environment specified.
    at Object.CliRunner.parseTestSettings 
(/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:516:13)
    at Object.CliRunner.setup (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:49:8)
    at Object.exports.runner (/Users/cjeske/tmp/nightwatch/lib/index.js:543:17)
    at /Users/cjeske/tmp/nightwatch/bin/runner.js:11:16
    at Object.exports.cli (/Users/cjeske/tmp/nightwatch/lib/index.js:537:5)
    at Object.<anonymous> (/Users/cjeske/tmp/nightwatch/bin/runner.js:9:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)

When used this config:
{ "foobar": "" }

The result is correct:

There was an error while starting the test runner:

Error: No testing environment specified.
    at Object.CliRunner.parseTestSettings (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:516:13)
    at Object.CliRunner.setup (/Users/cjeske/tmp/nightwatch/lib/runner/cli/clirunner.js:49:8)
    at Object.exports.runner (/Users/cjeske/tmp/nightwatch/lib/index.js:543:17)
    at /Users/cjeske/tmp/nightwatch/bin/runner.js:11:16
    at Object.exports.cli (/Users/cjeske/tmp/nightwatch/lib/index.js:537:5)
    at Object.<anonymous> (/Users/cjeske/tmp/nightwatch/bin/runner.js:9:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)

The reason for all this is because typeof null === 'object'
and the recursive function in lib/runner/cli/clirunner.js:112 does a not typesecure check, if the given parameter is undefined.
Because of that, it starts over again and sets target to this.settings again. When iterating over it, it goes to the key foobar and it sees a object and calls itself with null and everything starts all over again.

Fixed in #1292

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

No branches or pull requests

1 participant