Comments (6)
@ljharb I don't want to hijack this thread, so I'll just say we have an issue (chaijs/chai#585) which details what the new plugin interface will look like. Plugins will be abstracted away from decisions like property based assertions, and it will be determined by interface.
from chai-enzyme.
noop matchers are a huge antipattern. Could we convince chai-jquery to make a breaking change to make that be a function matcher?
They don't even have to make it breaking - they could make the getter do the assertion, and return a noop function that could be invoked.
from chai-enzyme.
i have push access to chai-jquery and can do the change and release another major version...
...however, it seems pointless to tackle those specific cases, since we are planning to rework the entire chai.js plugin system... timing is unclear but @keithamus might have an idea
until then I will suggest to implement a workaround... an assertion that overwrites both jquery's and enzyme's checked
and invokes the necessary code depending on the input
otherwise it simply feels like treating the symptoms and not the underlying cause
from chai-enzyme.
since we are planning to rework the entire chai.js plugin system... timing is unclear but @keithamus might have an idea
Timeline for this is many months away. Maybe we will have it by end of this year.
until then I will suggest to implement a workaround... an assertion that overwrites both jquery's and enzyme's checked and invokes the necessary code depending on the input
As unpleasant as this might be, it sounds like the easiest workaround IMO.
They don't even have to make it breaking - they could make the getter do the assertion, and return a noop function that could be invoked.
We tried doing this in chai core. Suffice it to say that it did not end well and we reverted it pretty quickly.
otherwise it simply feels like treating the symptoms and not the underlying cause
This issue highlights a failing in the current chai plugin system. We should absolutely (and are planning to) fix this, but it will take a long time. I don't have an answer for the best workaround for now - sorry 😞
from chai-enzyme.
when you rework it, can you prevent noop function matchers? It's a hugely bad pattern to use, and it makes mocha unusable in ES3 environments (browsers many of us still have to support).
from chai-enzyme.
Hi guys, it's been a while and I guess the chai plugin system wasn't updated yet. But, can anyone post some feasible solution or workaround or hack to solve this issue meanwhile?
In my case, some of my modules have unit tests for jQuery based UI and another for React based, so if I only get an idea how to initialize chai per module then I would use chai-jquery
and chai-enzyme
independently. Although it seems if I call chai.use
once the plugin stays there forever until I restart the browser. I couldn't figure out a way to initialize chai within a module scope. Is there a way to do so?
from chai-enzyme.
Related Issues (20)
- [1.0.0-beta.0] Cannot assert descendant not present HOT 2
- Use of reserved word 'let' in strict mode HOT 3
- [1.0.0-beta.0] className assertion failing when element has multiple classNames HOT 10
- CLOSED: Dependency issues with new version of enzyme HOT 4
- React 15.0.0 and Enzyme 3.2.0 issue HOT 3
- Cannot find module 'enzyme/build/react-compat' HOT 4
- Cannot convert a Symbol value to a string
- to.have.text(undefined) does not break the tests
- Error message for shallow render contains HOT 4
- Patch version bump for fix merged in from PR#215? HOT 2
- Is this library still maintained? `[import Adapter from 'enzyme-adapter-react-15';]` HOT 5
- .should.have.html(...) broken in 1.0.0-beta.1
- .to.have.style() requires kebab-cased keys
- TypeError: to.have.style is not a function HOT 1
- setup is vague
- Flow types HOT 1
- Preact support? HOT 3
- Chai's `assert.` style supported ? HOT 2
- Cannot read property 'have' of undefined
- Support for React 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chai-enzyme.