Use a regular expression to parse out React.version.
This fixes a silent failure of the test suite that appears to be due to the call require('./build/modules/React').
Ben Newman committed
Sep 11, 2013 at 18:40 UTC
133ea3df091e01347ee74086bde7c091caf7a929
1 file changed
+4
-1
Gruntfile.js
+4
-1
@@ -55,8 +55,11 @@ module.exports = function(grunt) {
55
// Check that the version we're exporting is the same one we expect in the
56
// package. This is not an ideal way to do this, but makes sure that we keep
57
// them in sync.
58
+ var reactVersionExp = /\bReact\.version\s*=\s*['"]([^'"]+)['"];/;
59
grunt.registerTask('version-check', function() {
59
- var version = require('./build/modules/React').version;
60
+ var version = reactVersionExp.exec(
61
+ grunt.file.read('./build/modules/React.js')
62
+ )[1];
63
var expectedVersion = grunt.config.data.pkg.version;
64
if (version !== expectedVersion) {
65
grunt.log.error('Versions do not match. Expected %s, saw %s', expectedVersion, version);