Classy Test
Opinionated class based testing framework.
Features
- Extensible es6 class test case. Leverage more with less code.
- Structured tests name syntax - testMyComponentCanAdd.
- TAP reporting with node-tap
- Full A+ promise support through bluebird
Install
$ npm install classy-test
Usage
Command Line Interface
$ node node_modules/classy-test/bin/classy-test-cli.js
Exported Module
const ClassyTestRunner = ;;
API
ClassyTestRunner([options])
options
directories
Type: string[]
Default: ['test']
Relative paths to all directories that should be searched for test case files.
extension
Type: string
(test file extension)
Default: '.test.js'
Set the default file extension for your test files.
disableLogging
Type: boolean
(disable interal classy test logging)
Default: false
This is used for our internal testing to make the logs cleaner. It is exposed has a "quality-of-life" feature.
Examples
Simple
Component
my-project/lib/component.js
"use strict"; { thisnumbers = numbers; } { return thisnumbers; } { return thisnumbers; } moduleexports = SimpleComponent;
Test File
my-project/test/component.test.js
"use strict"; const Component = classyTest = assert = assert; // extend base test case.BaseTestCase { super; } // prefix all test functions in your test case with 'test' { assert; } { assert; } // export an array of test cases you want to runmoduleexports = ComponentTestCase;
Promise Support
"use strict"; const classyTest = assert = assert; // simulate async database interaction static { return { ; }; } // test case for all your project needsBaseTestCase { super; } { super; return this; } { super; return this; } { return { }; } { return { }; } // Simple test case extended our base project test case { super; } { return Invoice; } { return Invoice; } moduleexports = InvoiceTestCase;
For more examples check here.
Team
License
MIT © John Rake