Plugin issues with Chai v4 #890

Open
meeber opened this Issue Dec 19, 2016 · 5 comments

Projects

None yet

4 participants

@meeber
Contributor
meeber commented Dec 19, 2016 edited

I went through the popular Chai plugins to see how their test suites fair with Chai v4. (Actually, I used the #884 build instead of the current canary release). Overall, we're in good shape. Here are my findings:

Major issues

  • chai-immutable

    • Code had to be updated because of breaking change of deep.property to nested.property. Also because of change in capitalization in values returned by type-detect. Further changes are likely needed due to change in not.property.
    • Updated code only works in Chai v4.0; therefore, these are breaking changes for end users
    • Tests had to be updated accordingly to change deep.property to nested.property
    • Updated tests only work in Chai v4.0
    • PR submitted (astorije/chai-immutable#69) but shouldn't be merged because there's more work to be done, and it shouldn't be merged until Chai v4 is released; package.json needs updating
  • chai-things

    • Code was already broken prior to v4 due to any flag in Chai core
    • Tests had to be updated because of changed wording in failed property assertion
    • Updated tests only work in Chai v4.0; still one broken test because of any flag in core
    • No PR submitted yet because of major any issue
    • Independently of this, I have an open issue (#881) about possibly deprecating any in core, which would happen to resolve this problem

Minor issues

  • chai-as-promised

    • Code had to be updated because in Chai v4, assertions return new Assertion objects with flags transferred over, and the promise was getting lost as a result
    • Updated code still works in Chai v3.5
    • One test had to be updated to change deep.property to nested.property
    • Updated test only works in Chai v4.0
    • PR submitted (domenic/chai-as-promised#157) but shouldn't be merged until Chai v4 is released; package.json needs updating
  • chai-jquery

    • Code had to be updated because in Chai v4, if undefined is explicitly passed as the second parameter to the property assertion, it asserts that the value value of the property equals undefined.
    • Updated code still works in Chai v3.5
    • No tests had to be updated
    • PR submitted (chaijs/chai-jquery#105) and can be merged now
  • chai-http

    • No code had to be updated
    • Tests had to be updated to change deep.property to nested.property
    • Updated tests only work in Chai v4.0
    • PR submitted (chaijs/chai-http#131) but shouldn't be merged until Chai v4 is released; package.json needs updating
  • dirty-chai

    • No code had to be updated
    • Two tests had to be updated because they were asserting on Chai Assertion objects in a way that caused problems
    • Updated tests still work in Chai v3.5
    • PR submitted (prodatakey/dirty-chai#22) but shouldn't be merged until Chai v4 is released; package.json needs updating
  • chai-timers

    • No code had to be updated
    • One test had to be fixed because above no longer accepts strings.
    • Updated tests still work in Chai v3.5
    • PR submitted (chaijs/chai-timers#14) and can be merged now

No issues

  • sinon-chai
  • chai-enzyme
  • chai-webdriver
  • chai-spies
  • chai-json-schema
  • chai-react
  • chai-backbone
  • chai-subset
  • jsx-chai
  • chai-fs
  • chai-stats
  • chai-null
  • chai-factories
  • chai-change
@jeromemacias

Can you also include https://github.com/producthunt/chai-enzyme please ?

@meeber
Contributor
meeber commented Dec 20, 2016

@jeromemacias Thanks for the heads up! Just ran the test suite with Chai v4; no issues.

@lucasfcosta
Member

Hey friends! So, is anything left here @meeber?
We were thinking about releasing 4.0.0 and it would be good to avoid issues with any plugins.

All we've gotta do is make sure those PRs are merged when 4.0.0 gets released right?

@meeber
Contributor
meeber commented Jan 11, 2017

There have been a number of commits in master since I tested these plugins. And we have a couple more on the way. I don't anticipate any new issues, but will need to test them again with the updated code for due diligence.

Assuming there aren't any additional issues: The plugins listed under "minor issues" already either have a PR ready to merge, or a PR that just needs the version updated once 4.0 is release, and then it can be merged. The plugins listed under "major issues" need more work. @astorije is already aware of some changes that impact chai-immutable. chai-things is broken since before v3.5 due to a conflict with Chai core regarding the any flag; I don't think it's essential that we fix this prior to v4.0 release, but it's something we should look into going forward.

@keithamus
Member

Development on chai-things has mostly stalled - in the current situation the featureset that chai-things really needs is not well catered for with chai's current plugin system. The proposed new system in #585 takes plugins like chai-things into account (hopefully).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment