Comments (8)
You don't have to include sinon
separately, sinon-chai
should be exactly enough.
from karma-chai-plugins.
@princed so we have to npm i --save-dev sinon-chai
? Or are you saying karma-chai-plugins
should suffice ? (which is not, hence this report)
from karma-chai-plugins.
No, you haven't.
I meant you shouldn't include sinon
in frameworks list in config as well: [... 'mocha', 'chai', 'sinon-chai']
Sorry for me being confusing.
from karma-chai-plugins.
Ahh ! I'll try...
from karma-chai-plugins.
Tricky ! I think I got it. In my code, I'm doing const expect = require('chai').expect
in order to have a typed expect (for typescript reasons).
However, it appear that doing so returns me another, non sinon-enabled instance of "expect" which is not the same as the global one, which is correctly sinon-enabled. Blame the webpack ?
from karma-chai-plugins.
All that karma plugins stuff doesn't really connect with webpack.
But I have some idea for you: you could use externals
option somewhere in your webpack config for tests to be able to βrequireβ them from global, like:
// webpack-test.config.js
externals: {
chai: 'var chai'
}
// test.js
import {expect} from 'chai';
from karma-chai-plugins.
Thanks for the help. I ended up not typing sinon :-( Not sure if my coworkers will agree.
Created a PR for warning of what you told me #91
from karma-chai-plugins.
Sinon is rather good. Didn't externals
help you?
from karma-chai-plugins.
Related Issues (20)
- Plugin error when using Firefox with Travis HOT 2
- expect is not defined HOT 3
- Upgrade sinon to v2.0
- Update sinon-chai to 2.9.0 HOT 3
- Support chai 4.0 HOT 4
- An in-range update of mocha is breaking the build π¨ HOT 1
- Can this load any Chai plugin, not just the bundled ones? HOT 3
- Deprecation Warning with [email protected] HOT 1
- Function.prototype.bind polyfill is a gotcha HOT 3
- update outdated dependencies
- expect( true ).to.be.ok() "object is not a function" HOT 9
- loading chai with requirejs fails intermittently HOT 8
- Documentation incomplete HOT 2
- No timestamp error HOT 1
- Broken sinon.js include. HOT 6
- Loading chai plugins along requirejs gives mismatch error HOT 21
- No timestamp error HOT 11
- busted w/ browserify HOT 4
- Cannot use sinon-chai plugin HOT 9
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 karma-chai-plugins.