Situation: Node project (v8.0.0)
Intention: TDD with Jasmine (v2.3)
How installed? $ npm install jasmine -g --save-dev $ jasmine init
As per their docs.
Simple Test Written: spec/unit/FooSpec.js
:
require('../../server/models/Foo');
describe('Foo', function() {
var foo;
});
beforeEach(function() {
foo = new Foo();
});
(No expectation yet)
Command line: $ jasmine
Output:
Message:
ReferenceError: Foo is not defined
Stack:
ReferenceError: Foo is not defined
at Object.<anonymous>
(/Users/me/Projects/thisproject/spec/unit/FooSpec.js:8:15)
Foo.js
contains function Foo() {}
as you might imagine.
Attempted Solutions:
- wrap Foo.js code in a module.exports IIFE (no luck)
- requiring file directly in FooSpec.js
var thing = require('path/to/file')
via RJones
No comments:
Post a Comment