lite-test
How to install
- Use npm to get it. You can install lite-test by following command
npm install lite-test
How to use
-
The most lite lite test need import two thing, first one is
Lite
, another isexpect
.
const {lite, expect} = require('lite-test')
It is what it look like.
And following code show how to use// TestCase.js lite.Test($Name) .it($describe what is this test should do, function() { expect(result).toBe(expected); });
-
Run all tests
// RunAllTests.js const {RunAllTests} = require('lite-test'); RunAllTests();
Use this file to be test script
// package.json // ... "test": "node RunAllTests.js" // ...
default setting is execute any file ends with 'test.js' under the dir that you assign.
The command like
npm test <dir-name>
If no dir name, default is '.'. -
Mock
const {lite, lets} = require('lite-test'); let obj = { name: 'obj' }; lets.Mock({ obj }) lite.Test('Mock') .it('should have following props', () => { lets.obj.should.hasProps('name'); });
Target
- For JavaScript(Temporarily node.js only)
- Without too many configure
- Run all test became easier
- Binding with native run way of the platfrom