[英]React/Babel: Components not rendering only on CircleCI
I've recently added ReactJS with React-Redux and Babelify (for ES6) to a Rails application. 我最近将带有React-Redux和Babelify(用于ES6)的ReactJS添加到了Rails应用程序中。 The cucumber tests are passing locally, but they are not passing on CircleCI.
黄瓜测试在本地通过,但没有通过CircleCI。 Here is what I know so far:
到目前为止,这是我所知道的:
How can I get my cucumber tests of React components to pass on CircleCI? 我如何才能使我的React组件的黄瓜测试通过CircleCI?
# no circle.yml
# gemfile
gem 'capybara-webkit'
gem "chromedriver-helper"
gem 'capybara-screenshot'
gem 'selenium-webdriver'
# package.json
"dependencies": {
"browserify": "~> 10.2.4",
"browserify-incremental": "^3.0.1",
"lodash": "^3.10.1",
"react": "~>0.13.3",
"react-redux": "~>3.1.0",
"redux-thunk": "~>1.0.0",
"babelify": "~>6.3.0"
}
# support/env.rb
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.javascript_driver = :chrome
After SSHing into the CircleCI tests, my colleague saw that Object.assign
was undefined. 通过SSH进入CircleCI测试后,我的同事发现
Object.assign
未定义。 Apparently CircleCI is using an older version of Chrome than we have been for our tests, and Babel does not automatically polyfill that ES6 method (see comments for more info). 显然,CircleCI使用的Chrome版本比我们测试时使用的版本要旧,并且Babel不会自动填充该ES6方法(请参阅注释以获取更多信息)。
He replaced Object.assign()
with lodash's _.extend()
and tests are green everywhere. 他用lodash的
_.extend()
代替了Object.assign()
,并且测试处处都是绿色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.