Merge pull request #344 from benjamn/fix-silent-test-failure-due-to-requiring-React
Use a regular expression to parse out React.version
This commit is contained in:
commit
c8ec4595bb
|
@ -55,8 +55,11 @@ module.exports = function(grunt) {
|
||||||
// Check that the version we're exporting is the same one we expect in the
|
// Check that the version we're exporting is the same one we expect in the
|
||||||
// package. This is not an ideal way to do this, but makes sure that we keep
|
// package. This is not an ideal way to do this, but makes sure that we keep
|
||||||
// them in sync.
|
// them in sync.
|
||||||
|
var reactVersionExp = /\bReact\.version\s*=\s*['"]([^'"]+)['"];/;
|
||||||
grunt.registerTask('version-check', function() {
|
grunt.registerTask('version-check', function() {
|
||||||
var version = require('./build/modules/React').version;
|
var version = reactVersionExp.exec(
|
||||||
|
grunt.file.read('./build/modules/React.js')
|
||||||
|
)[1];
|
||||||
var expectedVersion = grunt.config.data.pkg.version;
|
var expectedVersion = grunt.config.data.pkg.version;
|
||||||
if (version !== expectedVersion) {
|
if (version !== expectedVersion) {
|
||||||
grunt.log.error('Versions do not match. Expected %s, saw %s', expectedVersion, version);
|
grunt.log.error('Versions do not match. Expected %s, saw %s', expectedVersion, version);
|
||||||
|
|
Loading…
Reference in New Issue