Skip to content

Commit 05774f6

Browse files
committed
fix(build): also run ts tests in node.
1 parent 16447ce commit 05774f6

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

tools/broccoli/trees/node_tree.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,6 @@ module.exports = function makeNodeTree(destinationPath) {
4343
}
4444
});
4545

46-
// Transform all tests to make them runnable in node
47-
nodeTree = replace(nodeTree, {
48-
files: ['**/test/**/*_spec.js'],
49-
patterns: [
50-
{
51-
// Override the default DOM adapter with Parse5 for all tests
52-
match: /"use strict";/,
53-
replacement:
54-
"'use strict'; var parse5Adapter = require('angular2/src/dom/parse5_adapter'); " +
55-
"parse5Adapter.Parse5DomAdapter.makeCurrent();"
56-
},
57-
{
58-
// Append main() to all tests since all of our tests are wrapped in exported main fn
59-
match: /$/g,
60-
replacement: "\r\n main();"
61-
}
62-
]
63-
});
64-
6546
// Now we add the LICENSE file into all the folders that will become npm packages
6647
outputPackages.forEach(function(destDir) {
6748
var license = new Funnel('.', {files: ['LICENSE'], destDir: destDir});
@@ -134,9 +115,27 @@ module.exports = function makeNodeTree(destinationPath) {
134115
target: 'ES5'
135116
});
136117

137-
138118
nodeTree = mergeTrees([nodeTree, typescriptTree, docs, packageJsons]);
139119

120+
// Transform all tests to make them runnable in node
121+
nodeTree = replace(nodeTree, {
122+
files: ['**/test/**/*_spec.js'],
123+
patterns: [
124+
{
125+
// Override the default DOM adapter with Parse5 for all tests
126+
match: /"use strict";/,
127+
replacement:
128+
"'use strict'; var parse5Adapter = require('angular2/src/dom/parse5_adapter'); " +
129+
"parse5Adapter.Parse5DomAdapter.makeCurrent();"
130+
},
131+
{
132+
// Append main() to all tests since all of our tests are wrapped in exported main fn
133+
match: /$/g,
134+
replacement: "\r\n main();"
135+
}
136+
]
137+
});
138+
140139
// TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate!
141140
// ENOENT error is thrown while doing fs.readdirSync on inputRoot
142141
// in the meantime, we just do noop mv to create a new tree

0 commit comments

Comments
 (0)