I'm trying to run tests in a mutated environment to verify that the tests are working.I've created a library that mutates a request.js response. when a test is run under mutation, I want the expected result flipped. For example, if a request is mutated to return an error, the test case should fail when it spots the error, which means the mutation test should pass.I've tried changing the currentTest state and err in my afterEach functionafterEach(function(done) {// try to un fail a testif( process.env["MUTATE"] === "true") {this.currentTest.state = this.currentTest.state == "passed" ? "failed" : "passed";delete this.currentTest.err;}done();});but the mutated test is still being marked as failed. I had the thought to manipulate the test runner event handler for 'pass' and 'fail' events, but I could find how to access the runner from within a testI'm running tests from the command line via `./node_modules/.bin/mocha tests/rm.js`Is it possible to unfail a test somehow?
Submitted December 12, 2018 at 12:10AM by cbf77
No comments:
Post a Comment