# Need test func
src/fn.js
1 | module.exports = { |
src/math.js
1 | function sumOne(a, b) { |
# assert
断言失败会抛出异常
test/assert_test.js
1 | const { add, mul } = require('../src/math') |
# chai
chai 不仅包含 assert 这种 TDD (测试驱动方式),还包含 BDD (行为驱动方式)
test/chai_test.js
1 | const { add, mul } = require('../src/math') |
# mocha
test/mocha_test.js
1 | const { add, mul, cover } = require('../src/math') |
# benchmark
test/benchmark_test.js
1 | const Benchmark = require('benchmark') |