Comments (17)
The process.env is located in ./index.js and it should not be a problem. In order to use chai in the browser you need to load only ./chai.js, which is the compiled version of chai for browser use only. Full, working example: http://chaijs.com/support/tests/
from chai.
You can also hot link to http://chaijs.com/chai.js
for the most recent version, just fyi. Let us know if this fixes your problem.
from chai.
Thanks guys for the response. The problem is that since we use var should = require('chai').should();
, we do not get to decide what to include chai.js instead of index.js.
This sounds counter-intuitive since I said we test in the browser, but we do actually use browserify to put our node code in the browser :)
from chai.
oh! well that makes sense! I will make a work around to check to see if process and process.env exist so that you can still use via browserify.
from chai.
In release 0.4.2. If you have further problems with a browserify implementation, please reopen this issue.
from chai.
Awesome; that fixed the issue!
from chai.
Great!
from chai.
Cannot find module: "./lib-cov/chai" from directory ".../node_modules/chai"
The require('./lib-cov/chai')
is interpreted by browserify but ./lib-cov
doesn't seem to be included in the NPM package.
from chai.
We leave the coverage lib out of the npm dist. This issue should have been resolved by the commit 9 months ago to index.js.
@domenic - I saw you have been doing some browserify work lately. Have you had this issue?
from chai.
@logicalparadox that commit only fixes the process
issue. Browserify tries to bundle ./lib-cov/chai
, since it can't figure out conditional requires.
from chai.
The error that is being thrown is from browserify's "compile" sequence, not at run time then?
from chai.
Hmm this is a tough one. Personally I've always hated the conditional require of lib-cov; I think it's a very shoddy and intrusive way of doing code coverage. Is there a way to not do that? Failing that, we could add
"browserify": "./lib/chai"
to package.json; that might fix things.
from chai.
The other idea im liking even more is to have the package.json main be './lib/chai' and leave the conditionals for coverage support to our test bootstrap.
from chai.
+1 to that
from chai.
@logicalparadox I actually need this for a new project. I verified that the fix to change main
to ./lib/chai
works great. Do you want to commit it, and update the testing bootstrap, or should I just push that change?
from chai.
Go ahead and push. The tests will still require ./index.js
so I can check coverage when I need to. Ill push an update out this evening.
from chai.
still does not work
from chai.
Related Issues (20)
- Buffer is not recognized as an object HOT 1
- Officia type definitions for 5.x? HOT 6
- 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
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.