jeudi 23 août 2018

mocha tests not found: "0 passing"

I dont know why the test runner wont detect my tests.

npm test

myproject@1.0.0 test C:\Users\sjsui\Desktop\git_workshop\myproject
mocha ./built/source

  0 passing (4ms)

PS C:\Users\sjsui\Desktop\git_workshop\myproject>

I know that test is the default folder that mocha searches for so that is how I structured my project.

built
\--source
    \--test
        \--test.js

here is my test.js file

describe("consumer tests", function()
{
    it("runs bad request tests", (done) => {
        let tests = new badrequesttests()
        iteratebadtests(tests, done)

    })


    it("normal consumer tests", (done) => {
        let tests = new normaltests()
        iteratenormaltests(tests, done)
    })

    it("abnormal consumer tests", (done) => {
        let tests = new unauthorizedtests()
        iterateunauthorizedtests(tests, done)
    })
})

npm scripts section in package.json

  "scripts": {

      "test": "mocha ./built/source"

  },

as a side note, break points wont hit inside the test (visual studio code debug task -> mocha)

Aucun commentaire:

Enregistrer un commentaire