jeudi 8 octobre 2015

can mocha tests load reuqirements once?

I think every spec files first load by mocha and mocha runs them at least describe part if "it"s wasn't selected with "only".

// Lines before first "it" will run for every spec files 
// even if I don't mark them with ".only" word
var db = require("../../node/server/db"),
should = require('should')
...;

describe("main describe...", function () {
    var user = {},
        apiRootUrl = "http://127.0.0.1:3000";
        user.nameSurname = "Cem Topkaya";

    kullanici = schema.AJV.validate(schema_name, user);

    describe("child describe", function () {
        it(....)
        it.only(....)
        it(....)
    }
}

I want to run only one spec file not others. Is there any way to prevent this?

Aucun commentaire:

Enregistrer un commentaire