mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Generate the browser test list at built time
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@ docs/js/examples
|
||||
docs/downloads
|
||||
examples/shared/*.js
|
||||
|
||||
test/the files to test.generated.js
|
||||
@@ -1,11 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var grunt = require('grunt');
|
||||
var fs = require('fs')
|
||||
|
||||
module.exports = function() {
|
||||
var config = this.data;
|
||||
var done = this.async();
|
||||
|
||||
var theFilesToTestScript = fs.createWriteStream(__dirname + '/../../test/the files to test.generated.js');
|
||||
theFilesToTestScript.write('// Generated by ');
|
||||
theFilesToTestScript.write(JSON.stringify(__filename.split(/(?=grunt)/)[1]));
|
||||
theFilesToTestScript.write(' at ');
|
||||
theFilesToTestScript.write(JSON.stringify(new Date()));
|
||||
theFilesToTestScript.write('\n\n');
|
||||
|
||||
// create the bundle we'll work with
|
||||
var args = config.args;
|
||||
|
||||
@@ -15,7 +23,9 @@ module.exports = function() {
|
||||
nonull: true, // Keep IDs that don't expand to anything.
|
||||
cwd: config.rootDirectory
|
||||
}, requires).forEach(function(name) {
|
||||
args.push(name.replace(/\.js$/i, ""));
|
||||
name = name.replace(/\.js$/i, "");
|
||||
args.push(name);
|
||||
theFilesToTestScript.write('harness.enableTest(' + JSON.stringify(name) + ');\n');
|
||||
});
|
||||
|
||||
require("populist").buildP({
|
||||
@@ -23,6 +33,7 @@ module.exports = function() {
|
||||
args: args
|
||||
}).then(function(output) {
|
||||
grunt.file.write(config.outfile, output);
|
||||
theFilesToTestScript.end();
|
||||
done();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user