With Node.js installed and testing with mocha,
I have two files, numbers.js and test.js in the same directory
Following the top answer: What is the purpose of Node.js module.exports and how do you use it?
numbers.js
var myFunc = function myFunc() {
return 10;
};
exports.myFunc = myFunc;
test.js
var assert = require('assert');
var numbers = require('./numbers');
describe('numbers', function() {
it('first function returns 10', function() {
var result = numbers.myFunc;
assert.equal(result, 10);
});
});
But when running $ mocha
it returns the error:
AssertionError: [Function: myFunc] == 10
What am I doing wrong?