A test framework engine.
- Extendable
- Easy to understand
The first step is installing the core library and cli application
$ npm install -D @testingrequired/bespin-cli
This provides the foundation for the framework but it still needs to know how to locate test files, parse them and run them.
$ npm install -D @testingrequired/bespin-glob-test-file-locator @testingrequired/bespin-spec-test-file-parser @testingrequired/bespin-serial-runner
These will provide finding test files using a glob pattern (e.g. **/*.test.js
), parse test files with a describe
/it
/beforeEach
syntax and execute the tests in parallel.
Now create a configuration file called bespin.config.js
at your project root:
const { Config } = require("@testingrequired/bespin-core");
const {
GlobTestFileLocator,
} = require("@testingrequired/bespin-glob-test-file-locator");
const {
SpecTestFileParse,
} = require("@testingrequired/bespin-spec-test-file-parser");
const { AsyncRunner } = require("@testingrequired/bespin-async-runner");
module.exports = new Config(__filename)
.withLocator(new GlobTestFileLocator("**/*.test.js"))
.withParser(new SpecTestFileParse())
.withRunner(new AsyncRunner())
.withSetting("randomizeTests", true);
const assert = require("assert");
describe("beforeEach", () => {
let baseValue;
beforeEach(() => {
baseValue = 10;
});
it("should sum with base value", async () => {
assert.strictEqual(baseValue, 10);
});
describe("nesting", () => {
beforeEach(() => {
baseValue++;
});
it("should sum with incremented base value", async () => {
assert.strictEqual(baseValue, 11);
});
});
});
$ bespin
- @testingrequired/bespin-core Core library for framework primitives
- @testingrequired/bespin-cli Command line application to run tests
- example An example integration project
- @testingrequired/bespin-mock Mocking library
- @testingrequired/bespin-async-runner Run tests asynchronously using promises
- @testingrequired/bespin-serial-runner Run tests in serial order
- @testingrequired/bespin-parallel-runner Run tests asynchronously using worker threads
- @testingrequired/bespin-glob-test-file-locator Locate test files using a glob pattern
- @testingrequired/bespin-spec-test-file-parser Parse test files with describe/it syntax
- @testingrequired/bespin-junit-reporter Write test results to a JUnit file
- @testingrequired/bespin-html-reporter Write test results to a HTML file
- @testingrequired/bespin-debug-reporter Debug breakpoints and logging reporter events
bespin is a working title and will change upon initial release.