Установил в webstorm пакет karma. Делал по гайду.
Но возникла следующая проблема.
/**
* Created by Maks on 15.01.2016.
*/
var HelloWorld = function(World) {
console.log("Hello, World" + " " + World + "!");
}
HelloWorld("");
HelloWorld("abcd");
Это основной код, который содержится в подпапке проекта под названием js/
Вот часть конфига, которую исправлял в karma.conf.js:
// list of files / patterns to load in the browser
files: ['js/*.js','tests/*.js'
],
// list of files to exclude
exclude: ['js/dontTestIt.js'
],
Вот сам тест validate_test.js из tests:
/**
* Created by Maks on 15.01.2016.
*/
describe("The name validator", function(){
describe("Checks for empty string", function(){
it("should return true when the string is empty",function(){
expect(HelloWorld("")).toBe(true);
});
it("should return false when the string is not empty",function(){
expect(HelloWorld("abcd")).toBe(false);
});
});
});
Само тестрирование запускается, но вот ошибка:
Как решить данную проблему?
HelloWorld
при вызове ничего явно не возвращает, а неявно по умолчанию возвращаетundefined
.