2

I'm working on a little library: https://github.com/jtmkrueger/lilBox and am trying to add some jasmine tests. From what I've gathered, I just need to add a require statement at the top of the spec to include the file, like this:

require('../lilbox.js');

describe("lilBox", function() {
  it ("is loaded", function () {
    expect(lilBox).toBeDefined();
  });
});

But that test is failing. I'm not entirely sure what I'm doing wrong, but I think it has to do with how I'm including the file.

What do I need to do to get this test to pass?

6
  • how does your export statement look like in lilbox.js? Commented Jan 9, 2017 at 19:30
  • @Brian check out github.com/jtmkrueger/lilBox/blob/master/lilbox.js#L4 I think that's what you're talking about. Commented Jan 9, 2017 at 19:35
  • It's best to allow questions to stand on their own. Commented Jan 9, 2017 at 19:36
  • 1
    this should work: var lilBox = require('../lilbox'); Commented Jan 9, 2017 at 19:45
  • thanks @Brian that's all it took to get my test to pass! If you add your comment as an answer, I'll gladly accept. Commented Jan 9, 2017 at 19:49

1 Answer 1

2

Use lilbox similar to a package:

var lilBox = require('../lilbox');

It's case sensitive if i'm not mistaken, and functions can be called using lilBox.fn(). Have fun testing the app

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.