bm

brace_maybe

❓ Adds functionality to mocha to allow skipping unit tests at run time.

Showing:

Popularity

Downloads/wk

7

GitHub Stars

1

Maintenance

Last Commit

2yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Brace Maybe

Synopsis

Brace Maybe adds the ability to skip unit tests at run-time with the mocha testing framework to only show failed tests which matter.

Build status Downloads

A part of the Brace suiteDeveloped with Windows 10 and Ubuntu 16
BraceUbuntu on Windows

Brace Maybe help pages


Author: Robert Steckroth, Bust0ut <RobertSteckroth@gmail.com>

Licensed under: MIT

Bonuses:

  • Finding what test failed is now possible in large unit test files.

Caveats:

  • Not unit tested (extensive use in many projects however).

Below is an example of how to use Brace maybe in unit tests.

var maybe = require("brace_maybe")
var it_will = global

describe("Using stop further progression methodology for dependencies in: "+path.basename(__filename), function() {

    // The it property is mutated by brace_maybe to allow for other functionality. It still has the same functionality as the original however.
    var it = maybe(it_will)
    it_will.stop = !!process.env.DRY_RUN  
    it_will.quiet = !!process.env.QUIET

    it("r_js in the system as a program", function(done) {
        it_will.stop = true
        expect((function() {try { require("requirejs"); return true; } catch(e) { return e;}})(), "could not find r.js dependency").to.be.true
        // This is the only way to proceed with the other tests.
        it_will.stop = false
        done()
    })

    describe("Running unit tests", function() {
        var requirejs
        beforeEach(function() {
            remove_cache()
            requirejs = require("requirejs")
            requirejs.config({baseUrl: path.join(__dirname, "..", "lib"), nodeRequire: require})

        })

        // This test will never run if the requirejs module is not available above.
        it("can load the module", function(done) {

            requirejs(["yourModule"], function(mod) {
                expect(true).to.be.true
                done()
            })
        })

        // All of the built-in mocha it functionality works the same way.
        //it.skip("This is a skipped test", function(done) { })
        //it.only("This is the only test which will run", function(done) { })
    })
})

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial