ava: super slowdown with power assert / jsx / stateless component
Description
If you add a test that looks like this (add it 4 or 5x to get the full impact):
It will run fast
import test from 'ava';
import { render } from 'react-dom'
import React from 'react';
function CustomComponent({ value }) { return <input value={value} /> }
test('does something fast', t => {
const div = document.createElement('div')
render(<CustomComponent value="3" />, div)
const originInput = div.getElementsByTagName('input')[0]
const val = originInput.value
t.same(val, 33) // assert on a reference to the value
})
But if you do this it will be very slow
function CustomComponent({ value }) { return <input value={value} /> }
test('does something slow', t => {
const div = document.createElement('div')
render(<CustomComponent value="3" />, div)
const originInput = div.getElementsByTagName('input')[0]
t.same(originInput.value, 33) // assert directly on the value
})
Changing it to use assert
will also make it run very fast, so this is probably a power-assert issue, but I don’t know that as well.
In the little test case, it may add up to 1s to the full test output (timed with DEBUG=ava
), but in my real life app it added 10s
after the first test 20s
after the second, etc until my tests just hung.
Possibly related to https://github.com/power-assert-js/power-assert/issues/34
Environment
Node.js v4.3.2
darwin 14.5.0
ava@latest
and 0.9.2
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (12 by maintainers)
To be clear, the difference is: