enzymejs/chai-enzyme

.not failing in watch mode with mocha

npoirey opened this issue · 2 comments

Basically, it's as if I did not have a .not in my assertion

mocha.opts
--require ignore-styles --compilers js:babel-core/register --compilers jsx:babel-core/register --colors --recursive

npm test:watch :
./node_modules/mocha/bin/_mocha --watch src/**/*.spec.js*

Loader.spec.jsx :

import chai from 'chai'
import chaiEnzyme from 'chai-enzyme'
import dirtyChai from 'dirty-chai'
import React from 'react'
import {mount, render, shallow} from 'enzyme'
import Loader from './Loader'

const expect = chai.expect
chai.use(dirtyChai)
chai.use(chaiEnzyme())

describe('Loader', () => {
  it('instantiate correctly', () => {
    const wrapper = shallow(<Loader />)
    expect(5).to.not.eql(6)
    expect(wrapper).to.not.have.attr('style')
  })
  it('has an option to remove margins', () => {
    const wrapper = shallow(<Loader noMargin />)
    expect(wrapper).to.have.style('margin').equal('0')
  })
})

At first run, tests are successful. However when I trigger the watch by adding a blank line for example I get the following error :


     AssertionError: expected <Loader /> to have a 'style' attribute

     HTML:

     <div class="row preloader-dots">
       <div class="dot"></div>
       <div class="dot"></div>
       <div class="dot"></div>
       <div class="dot"></div>
       <div class="dot"></div>
     </div>

As you can see, the expect 5≠6 is working as expected but not the one from chai-enzyme.

Any Idea why?

Thank you

@npoirey can you check if this is still an issue with 0.8.0?

Just tried it out, working as expected, thanks !
I'm closing this .