From 05774f6c8a7c271f4f7c5b150a9f84c463e06d97 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Fri, 22 May 2015 12:50:58 -0700 Subject: [PATCH] fix(build): also run ts tests in node. --- tools/broccoli/trees/node_tree.ts | 39 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/tools/broccoli/trees/node_tree.ts b/tools/broccoli/trees/node_tree.ts index 8a1f1b4cdf..d9356a98f4 100644 --- a/tools/broccoli/trees/node_tree.ts +++ b/tools/broccoli/trees/node_tree.ts @@ -43,25 +43,6 @@ module.exports = function makeNodeTree(destinationPath) { } }); - // Transform all tests to make them runnable in node - nodeTree = replace(nodeTree, { - files: ['**/test/**/*_spec.js'], - patterns: [ - { - // Override the default DOM adapter with Parse5 for all tests - match: /"use strict";/, - replacement: - "'use strict'; var parse5Adapter = require('angular2/src/dom/parse5_adapter'); " + - "parse5Adapter.Parse5DomAdapter.makeCurrent();" - }, - { - // Append main() to all tests since all of our tests are wrapped in exported main fn - match: /$/g, - replacement: "\r\n main();" - } - ] - }); - // Now we add the LICENSE file into all the folders that will become npm packages outputPackages.forEach(function(destDir) { var license = new Funnel('.', {files: ['LICENSE'], destDir: destDir}); @@ -134,9 +115,27 @@ module.exports = function makeNodeTree(destinationPath) { target: 'ES5' }); - nodeTree = mergeTrees([nodeTree, typescriptTree, docs, packageJsons]); + // Transform all tests to make them runnable in node + nodeTree = replace(nodeTree, { + files: ['**/test/**/*_spec.js'], + patterns: [ + { + // Override the default DOM adapter with Parse5 for all tests + match: /"use strict";/, + replacement: + "'use strict'; var parse5Adapter = require('angular2/src/dom/parse5_adapter'); " + + "parse5Adapter.Parse5DomAdapter.makeCurrent();" + }, + { + // Append main() to all tests since all of our tests are wrapped in exported main fn + match: /$/g, + replacement: "\r\n main();" + } + ] + }); + // TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate! // ENOENT error is thrown while doing fs.readdirSync on inputRoot // in the meantime, we just do noop mv to create a new tree