Skip to content

Commit 50d9e84

Browse files
author
Zhen Li
committed
Make exit code 1 if error happens when running npm tests via powershell script
This fix make it easier on CI to fail a windows build when error happens
1 parent 6e03b32 commit 50d9e84

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ var runPowershell = function( cmd ) {
213213
console.log("Powershell Data: " + data);
214214
});
215215
child.stderr.on("data",function(data){
216-
console.log("Powershell Errors: " + data);
216+
console.error("Powershell Errors: " + data);
217217
});
218218
child.on("exit",function(){
219219
console.log("Powershell Script finished");

runTests.ps1

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
Try
1+
npm install
2+
npm run start-neo4j
3+
npm test
4+
5+
if(-Not ($?)) #failed to execute npm test
26
{
3-
npm install
4-
npm run start-neo4j
5-
npm test
7+
$ErrorFound = $True
68
}
7-
Catch [system.exception]
9+
10+
npm run stop-neo4j
11+
12+
if($ErrorFound -eq $True)
813
{
9-
"Error found while running tests"
10-
}
11-
Finally
12-
{
13-
npm run stop-neo4j
14+
exit 1
1415
}

0 commit comments

Comments
 (0)