Skip to content

Commit

Permalink
fix(build): also run ts tests in node.
Browse files Browse the repository at this point in the history
  • Loading branch information
tbosch committed May 22, 2015
1 parent 16447ce commit 05774f6
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions tools/broccoli/trees/node_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 05774f6

Please sign in to comment.