taz
Little test runner for node.js
Last updated 2 months ago by mattmueller .
MIT · Original npm · Tarball · package.json
$ cnpm install taz 
SYNC missed versions from official npm registry.

Taz

Little test runner for node.js

FAQ

What inspired Taz?

Taz is mostly inspired by go test. After working in Go for awhile, you soon realize that they nailed testing and it's one of Go's top 5 features. There are features in taz that you won't find in any other Node.js test framework. These features come from go test.

I also wanted taz to feel familiar to existing Node.js users. The work done in Ava and Mocha inspired me here, particularly Ava's test API and Mocha's reporting system.

How does taz compare to Mocha, Jest, Ava, Tape, etc.?

Taz comes from using mocha for a long time. During this time, there were always just a few things I wanted to improve:

  • The ability to run tests with node test.js
  • First-class support for .mjs files
  • Parallelization across files
  • A simpler test API

I like Ava and it's pretty close to my ideal. I made a few different decisions in building taz:

  • Tests within a file run serially, rather than in parallel. This is to preserve the order of console.log.
  • No transpilation. This improves the startup performance of Taz and reduces resource usage. Taz leaves the responsibility of transpilation to the test author.
  • Mocha reporter support. I think this is just because I've been using mocha for so long, but I just love Mocha's test reporting style. Taz works with all of Mocha's reporters!

Jest is the hot new test framework and to be fair to Jest, I've used it the least out of this list. I found a minimal test to take about 1 second to run on my computer (cold startup). It appears that Jest is optimized for large test suites. This isn't my typical workload and Taz is not optimized for this workload, though I'm quite sure Taz would be competitive here as is. Philisophically, I prefer a test framework to do the minimum amount of necessary operations to support 95% of your testing needs. The last 5% of your needs can be pulled in from NPM.

Tape is the closest in spirit to taz. Tape used to be lower-level than Taz, but recently I've noticed it's become a lot higher-level. Taz has a few features that Tape doesn't have and Tape has a few features that Taz doesn't have. I don't have much else to say about Tape other than when you're trying out Taz, be sure to give Tape a shot too!

Does taz run tests within a file in parallel?

No it doesn't. This may change in the future, if we're able to figure out a way to preserve console ordering. I'd also like to explore test caching. Go's testing framework does a great job of caching tests that haven't changed.

Does taz have subtests?

Taz does not support subtests. I used to be a big subtest fan but I recently realized that every time I was using subtests, it would be less complex to do use table-driven tests instead.

Where's before(fn) and after(fn)

Taz does not support before and after functions. Like subtests, I used to think I needed them, but later realized that before(fn) and after(fn) encourage shared state across tests. It's generally better to do this:

test('my test', async t => {
  const db = await connect(
    t,
    process.env.POSTGRES_URL,
  )
  t.after(db.close)
})

If the resource is very expensive, then you can mimic before and after like this:

let expensive

test('open expensive resource', async t => {
  expensive = await connect(t)
})

test('test 1')
test('test 2')
test('test 3')

test('close expensive resource', async t => {
  await expensive.close()
})

Current Tags

  • 6.15.0                                ...           latest (2 months ago)

47 Versions

  • 6.15.0                                ...           2 months ago
  • 6.14.0                                ...           2 months ago
  • 6.13.0                                ...           2 months ago
  • 6.12.0                                ...           3 months ago
  • 6.11.0                                ...           3 months ago
  • 6.10.0                                ...           3 months ago
  • 6.9.0                                ...           3 months ago
  • 6.8.0                                ...           3 months ago
  • 6.7.0                                ...           3 months ago
  • 6.6.0                                ...           3 months ago
  • 6.5.0                                ...           3 months ago
  • 6.4.0                                ...           3 months ago
  • 6.3.0                                ...           3 months ago
  • 6.2.0                                ...           3 months ago
  • 6.1.0                                ...           3 months ago
  • 6.0.1                                ...           3 months ago
  • 5.0.1                                ...           8 months ago
  • 5.0.0                                ...           8 months ago
  • 4.0.13                                ...           a year ago
  • 4.0.12                                ...           2 years ago
  • 4.0.10                                ...           2 years ago
  • 4.0.9                                ...           2 years ago
  • 4.0.8                                ...           2 years ago
  • 4.0.7                                ...           2 years ago
  • 4.0.6                                ...           2 years ago
  • 4.0.5                                ...           2 years ago
  • 4.0.4                                ...           2 years ago
  • 4.0.3                                ...           2 years ago
  • 4.0.2                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 2.0.0-beta                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 1
This Week 2
This Month 54
Last Day 0
Last Week 48
Last Month 48
Dependencies (24)
Dev Dependencies (14)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |