Ho problemi a capire perché questo test non sta passando.Babel/Karma/Chai restituisce TypeError: non è possibile accedere alle proprietà 'caller', 'callee' e 'arguments' su funzioni in modalità rigorosa
var expect = require('chai').expect;
describe('HelloComponent', function() {
it('passes a quite simple test', function() {
expect(1 + 4).to.equal(5);
});
});
produce questo errore:
DEBUG [web-server]: serving: /Users/ivan/dev/react-starter/node_modules/karma/static/context.html
DEBUG [web-server]: serving (cached): /Users/ivan/dev/react-starter/node_modules/mocha/mocha.js
DEBUG [web-server]: serving (cached): /Users/ivan/dev/react-starter/node_modules/karma-mocha/lib/adapter.js
DEBUG [web-server]: serving (cached): /Users/ivan/dev/react-starter/test/front-end/tests.webpack.js
Chrome 41.0.2272 (Mac OS X 10.10.2) HelloComponent passes a quite simple test FAILED
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
at new Assertion (/Users/ivan/dev/react-starter/test/front-end/tests.webpack.js:2166:43 <- webpack:///~/chai/lib/chai/assertion.js:33:42)
at chai.expect (/Users/ivan/dev/react-starter/test/front-end/tests.webpack.js:3592:13 <- webpack:///~/chai/lib/chai/interface/expect.js:9:11)
at Context.<anonymous> (/Users/ivan/dev/react-starter/test/front-end/tests.webpack.js:89:6 <- webpack:///test/front-end/hello-spec.js:10:4)
Potrebbe avere qualcosa a che fare con le cose babele di avvolgimento in modalità rigorosa?
Qualcuno sa quali passi posso iniziare a prendere per capire cosa sta succedendo qui?
Il codice è open source ed è disponibile qui: https://github.com/UWFosterIT/react-starter/tree/gulp-webpack
da installare e riprodurre questo errore:
git clone https://github.com/UWFosterIT/react-starter.git
npm install
gulp test:karma
Quindi non è possibile testare i propri moduli es6 utilizzando le asserzioni chai, giusto? Posso vedere che funziona con lo stile 'assert' ma non' expect'. – konrad