assaf / zombie

Insanely fast, full-stack, headless browser testing using node.js
http://zombie.js.org/
MIT License
5.65k stars 518 forks source link

Getting Error when use react-components #1206

Closed zakvyn closed 4 years ago

zakvyn commented 4 years ago

Step to reproduce.

  1. git clone https://github.com/vlucas/universal-react-helloworld.git
  2. add import {browserUtil} from 'react-components'; to ./src/client.js
    
    import React from 'react';
    import ReactDOM from 'react-dom';
    import HelloWorld from './components/HelloWorld';
    import {browserUtil} from 'react-components';

ReactDOM.render(, document.getElementById('content'));

3. add test.js to ./test/test.js  

const Browser = require('zombie'); Browser.localhost('localhost', 8007);

describe('User visits ', function() { const browser = new Browser();

before(function(done) {
    browser.visit('/', done);
});

describe('hello', function() {
    it('should be successful', function() {
        browser.assert.success();
    });
});

});

./node_modules/.bin/mocha test/test.js  

1) User visits "before all" hook in "User visits ": http://localhost/js/bundle.js:66019 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function ); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } ^

TypeError: Super expression must either be null or a function at _inherits (http://localhost/js/bundle.js:66019:113) at http://localhost/js/bundle.js:66034:3 at Object.123../NodeResolver (http://localhost/js/bundle.js:66114:2) at o (http://localhost/js/bundle.js:1:265) at http://localhost/js/bundle.js:1:316 at Object.128../A11yText (http://localhost/js/bundle.js:66611:43) at o (http://localhost/js/bundle.js:1:265) at http://localhost/js/bundle.js:1:316 at Object.96../accessibility/index (http://localhost/js/bundle.js:61282:14) at o (http://localhost/js/bundle.js:1:265) in http://localhost/

When try with webpack, we got following error

1) User visits signup page "before all" hook in "User visits signup page": webpack-internal:///./node_modules/brace/index.js:4192 var src = script.src || script.getAttribute("src"); ^

TypeError: Cannot read property 'src' of undefined at init (webpack-internal:///./node_modules/brace/index.js:4192:26) at eval (webpack-internal:///./node_modules/brace/index.js:4176:1) at lookup (webpack-internal:///./node_modules/brace/index.js:141:31) at _acequire (webpack-internal:///./node_modules/brace/index.js:75:23) at req (webpack-internal:///./node_modules/brace/index.js:138:24) at eval (webpack-internal:///./node_modules/brace/index.js:4242:14) at lookup (webpack-internal:///./node_modules/brace/index.js:141:31) at _acequire (webpack-internal:///./node_modules/brace/index.js:75:23) at req (webpack-internal:///./node_modules/brace/index.js:138:24) at eval (webpack-internal:///./node_modules/brace/index.js:12801:20) in http://localhost/booking/index.html

zakvyn commented 4 years ago

After some research, I think it's issue with react-components