Comments (10)
this is in Firefox 9.0.1
from chai.
The should interface does it's thing by extending Object.prototype
on L22. Unfortunately, the fact is that FF and IE don't like this. The should
tests suite does pass in chrome however, if your curious.
Unfortunately, nothing can be done. My recommendation is to use the expect
interface:
var expect = chai.expect
, foo = 'bar';
expect(foo).to.be.a('string');
expect(foo).to.equal('bar');
expect(foo).to.have.length(3);
All of the same language applies.
from chai.
Very odd.
This seems to work fine in firefox:
Object.defineProperty(Object.prototype, 'should', {
get: function() {
console.log(this);
}
});
var a = '123';
console.log(a.should);
What, specifically, does firefox not like? It seems like it's fine with extending the Object.prototype, but all strings, numbers, etc, turn into object literals inside the property? is that right?
from chai.
Found a bit of a work around. Check out branch bug/issue-6 ... 067d966
Should tests for this branch are passing in Chrome 16, FF 9.0.1, Safari 5.1.2.
Let me know if it works out and I will pull it into the next release later today/tomorrow.
from chai.
I just grabbed 0.1.7 and everything works great in firefox now. Thanks!
from chai.
This patch has been included in 0.1.7. The commit was 48f3815 if your curious.
I also retract my previous statement. Apparently something can be done. Thanks for the motivation :)
Let me know if it troubles you further.
from chai.
FYI, it's really close to working in IE9 as well. For some reason any number sets this == 0. Trying to figure out a workaround. Other than that, everything seems to work
from chai.
That would be awesome if it did. Thanks for the update... will accept pull requests!
from chai.
Should the website be updated? It still says "Should tests do not run in the browser."
from chai.
Yeah, the api also a few versions outdate. I'm in the process of updating my docs generator so should be up in a day or two. Opened #12 in response.
from chai.
Related Issues (20)
- Package subpath './register-should' is not defined by "exports" in node_modules/chai/package.json for node 18.14.0 HOT 1
- ERR_REQUIRE_ESM in v5 HOT 41
- v5 vs chai-as-promised HOT 1
- [v5] `assert.isFunction()` fails with async function HOT 4
- v5 - `Unknown file extension ".ts"` when running with mocha HOT 11
- mutating chai exports no longer works in v5 HOT 22
- Add support for Promise HOT 16
- SyntaxError: Invalid or unexpected token HOT 1
- [email protected] syntax error in assertion.js:69 HOT 2
- NPM README and GitHub README don't match
- @types/chai seems not to be adapted to version 5.0.0 HOT 9
- Documentation revamp HOT 3
- please provide commonjs exports again HOT 5
- Migrating to Chai 5.0 in browser
- use() function only returns plugin first time HOT 1
- assert.throws() does not work correctly in node/vm spawned context HOT 5
- TypeError: Unknown file extension ".ts" with Chai 5.0.0 and later HOT 2
- chai-spies broken in v5.1.0 HOT 1
- The plugin API makes me want to murder someone
- without "@types/chai" my IDE didn't recognize some attributes
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.