I'm running async tests and the test fails silently without throwing the error.
const chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
var expect = chai.expect;
chai.use(chaiAsPromised);
describe("API calls work", function () {
it("Should have a property", function () {
return expect(someAsyncLongRunningCall(mockedData)).to.eventually.have.property("status");
});
});
The result returns as failed, the execution seems to stop on readFile
without showing errors:
const fs = require("fs").promises;
async loadJson() {
try {
const jsonFile = await fs.readFile(
"/some.json",
"utf8"
);
return jsonFile;
} catch (e) {
console.log(e.message);
}
}
Am I doing something wrong? I'm running mocha like this ./node_modules/.bin/mocha --reporter spec ./tests/*.js
Aucun commentaire:
Enregistrer un commentaire