I've been using Dalek.js for testing and have been enjoying it. I would like to take some tests from one of my files and put them in a separate "common_tests.js" file so that I can use them in other places without having to duplicate code. However, whenever I try moving the test code out of the main file, the test fails to execute correctly -- I get the "RUNNING TEST - '[TEST NAME]'" message twice. The first does nothing, and the second immediately hangs while trying to open the page. Is there something I'm doing wrong?
My code is in this format:
In common_tests.js:
module.exports = {
testFunction: function(test) {
test
.open("www.google.com")
// other testing stuff here that's fine when in the other file
.done();
}
In my tests file:
var common = require('../common_tests.js");
module.exports = {
'Trying to test with functions': function(test) {
common.testFunction(test);
test.done();
}
}