Skip to content Skip to sidebar Skip to footer

Requiring External Js File For Mocha Testing

So I'm playing around with BDD and mocha with my express.js project. I'm just getting started so here is what I have as my first test case: should = require 'should' require '../li

Solution 1:

You need to export your Skill class like this:

classSkill
    constructor: (@name,@years,@width) ->

module.exports = Skill

And assign it to variable in your test:

should = require"should"Skill = require"../lib/models/skill.js"


describe 'Skill', ->
    describe '#constructor()', ->
        it 'should return an instance of class skill', ->
            testSkill = newSkill"iOS", "4 years", 100
            testSkill.constructor.name.should.equal'Skill'

Solution 2:

Post a Comment for "Requiring External Js File For Mocha Testing"