question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The role of chai and chai plugins

See original GitHub issue

One of the reasons why Chai is my favourite assertion library is its amazing ecosystem, which includes a rich collection of plugins for all the extra functionality you might want. Sadly though, we sometimes have a blind spot for our plugins, and end up reimplementing them in core. This really sucks because we’re pulling the rug from under our hard working contributors who spend time and effort solving problems, which then sometimes end up as incomplete half solutions in chai. The most notable example of this is @timruffleschai-change & @matthijsgroen’s chai-changes (see #218, #339, #428 and #544 for history there).

I’ve mentioned in #428 that I’d like to see chai-core cover JavaScript builtins - meaning Strings, Numbers, Booleans, Objects, Arrays (and TypedArrays), Functions, Dates, and the new builtins like Promises & Symbols. Things that you can do with the native API (like, for example, checking if an Object isFrozen), there should be a chai assertion for - which is slowly but surely happening (we added support for Object.isFrozen in 3.2.0).

However, what we don’t want to do is step on existing plugins which offer the same functionality - this would be a mistake. I think an important precedent needs to be set that - whenever we encroach on the territory of a chai plugin, we reach out to the authors and try to fold the plugin to the chaijs org, with the hope of eventually including that plugin as part of chai core. With the ideas inside #457 (Roadmap issue) - that the chaijs/chai repo becomes a meta repo of plugins, I think this looks like a very achievable goal. We could look toward folding in plugins like chai-change, chai-string, chai-match into the chaijs org while keeping the original authorship and lifting plugins instead of stepping on them.

In addition to this, I’d like improve our documentation around contributing and plugin authorship - and outline a clear separation of where we’d welcome PRs vs plugins. Whereby plugins become a “userland” feature, for example chai-spies, chai-react, chai-jquery etc.

I want to keep this issue around to get some feedback from plugin authors & chai users & contributors - to field some opinions, so please, if you see this and are a chai user - comment your 2¢!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lucasfcostacommented, Jun 11, 2018

As me and @keithamus discussed this weekend, plugins will no longer be treated as an external third-party when we get to v5. They’ll instead become first class citizens and we’ll make sure that we make it as easy for plugin authors to add assertions as it is for us to write new ones in the lib’s core.

Due to that and to house-cleaning, I’m closing this one.

0reactions
keithamuscommented, Mar 9, 2016

@brutalcrozt if you want to find some things to work on, you could have a look at our pull requests wanted label, starting with the easy-fix issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Core Plugin Concepts - Chai Assertion Library
The function which will be used gets passed two parameters to its scope. The first is the chai export, the second is an...
Read more >
Chai - Best of JS
Chai is an assertion library, similar to Node's built-in assert . It makes testing much easier by giving you lots of assertions you...
Read more >
Chai
Chai JS Plugin for testing if an array has sorted values (strings, numbers, booleans). Very helpful when writing tests for features that implement ......
Read more >
chai-spies | Yarn - Package Manager
Chai Spies. This is an addon plugin for the chai assertion library. It provides the most basic function spy ability and tests.
Read more >
chaijs/chai-http: HTTP Response assertions for the ... - GitHub
Chai HTTP provides an interface for live integration testing via superagent. To do this, you must first construct a request to an application...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found