Giter VIP home page Giter VIP logo

Comments (17)

vesln avatar vesln commented on May 18, 2024

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.

logicalparadox avatar logicalparadox commented on May 18, 2024

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.

 avatar commented on May 18, 2024

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.

logicalparadox avatar logicalparadox commented on May 18, 2024

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.

logicalparadox avatar logicalparadox commented on May 18, 2024

In release 0.4.2. If you have further problems with a browserify implementation, please reopen this issue.

from chai.

 avatar commented on May 18, 2024

Awesome; that fixed the issue!

from chai.

logicalparadox avatar logicalparadox commented on May 18, 2024

Great!

from chai.

ricardobeat avatar ricardobeat commented on May 18, 2024

[email protected]

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.

logicalparadox avatar logicalparadox commented on May 18, 2024

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.

ricardobeat avatar ricardobeat commented on May 18, 2024

@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.

logicalparadox avatar logicalparadox commented on May 18, 2024

The error that is being thrown is from browserify's "compile" sequence, not at run time then?

from chai.

domenic avatar domenic commented on May 18, 2024

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.

logicalparadox avatar logicalparadox commented on May 18, 2024

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.

domenic avatar domenic commented on May 18, 2024

+1 to that

from chai.

domenic avatar domenic commented on May 18, 2024

@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.

logicalparadox avatar logicalparadox commented on May 18, 2024

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.

tjwebb avatar tjwebb commented on May 18, 2024

still does not work

from chai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.