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

Karma 0.10: Issue creating new karma.conf.js #681

Closed
cmjonescm opened this issue Aug 6, 2013 · 0 comments
Closed

Karma 0.10: Issue creating new karma.conf.js #681

cmjonescm opened this issue Aug 6, 2013 · 0 comments

Comments

@cmjonescm
Copy link

Running Karma 0.10 on Windows 7:

Steps:

  1. Delete or rename the existing karma.conf.js file
  2. Run karma init:

Output:

C:\webserver>karma init

Which testing framework do you want to use ?
Press tab to list possible options. Enter to move to the next question.

jasmine
Do you want to use Require.js ?
This will add Require.js plugin.
Press tab to list possible options. Enter to move to the next question.
no
Do you want to capture a browser automatically ?
Press tab to list possible options. Enter empty string to move to the next question.
Chrome

What is the location of your source and test files ?
You can use glob patterns, eg. "js/_.js" or "test/__/_Spec.js".
Enter empty string to move to the next question.

Should any of the files included by the previous patterns be excluded ?
You can use glob patterns, eg. "*/.swp".
Enter empty string to move to the next question.

Do you want Karma to watch all the files and run the tests on change ?
Press tab to list possible options.
yes
path.js:116
throw new TypeError('Arguments to path.resolve must be strings');
^
TypeError: Arguments to path.resolve must be strings
at Object.exports.resolve (path.js:116:15)
at C:\Typhoon\webserver\node_modules\karma\lib\init.js:361:31
at nextQuestion (C:\Typhoon\webserver\node_modules\karma\lib\init.js:241:7)
at onLine (C:\Typhoon\webserver\node_modules\karma\lib\init.js:211:14)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.EventEmitter.emit (events.js:117:20)
C:\webserver>

Looked into this issue and it seems that if the original karma.conf.js or just create a file with the same name everything works ok!

Looking at the cli.js code processArgs function it looks like the following logic is not correct when an existing karma.conf.js does not exist. (options.configFile ends up being null).

...
var configFile = argv._.shift();

if (!configFile) {
// default config file (if exists)
if (fs.existsSync('./karma.conf.js')) {
configFile = './karma.conf.js';
} else if (fs.existsSync('./karma.conf.coffee')) {
configFile = './karma.conf.coffee';
}
}

options.configFile = configFile ? path.resolve(configFile) : null;

return options;
};

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