If I invoke the jasmine_node task with the "teamcity" option set to true, I see Teamcity-friendly console output for the task, but Grunt stops executing abruptly after the jasmine_node task completes. There is no error output, even on verbose mode.
I've distilled the problem down to a simple Grunt project and package.json. I can reproduce the problem on both OS X & CentOS. Here's my Gruntfile:
'use strict';
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.initConfig({
clean: {
all: ['.tmp']
},
// Tests for server-side node components
jasmine_node: {
specFolders: ["./spec" ],
projectRoot: "./app",
// if 'deploy.project' is given, the build is running in TeamCity
teamcity: !!grunt.option('deploy.project'),
forceExit: true,
jUnit: {
report: false,
savePath : "./reports/",
useDotNotation: true,
consolidate: true
}
}
});
grunt.registerTask('default', [
'clean',
'jasmine_node',
'clean'
]);
};
And my package.json:
{
"name": "grunt_bug",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.0",
"grunt-jasmine-node": "~0.1.0",
"grunt-contrib-clean": "0.4.0"
},
"engines": {
"node": ">=0.8.0"
}
}
I expect that running 'grunt' executes the tasks clean, jasmine_node and clean again, in that order. This is exactly what happens if I invoke grunt without my 'deploy.project' option to enable teamcity reporting:
$grunt
Running "clean:all" (clean) task
Running "jasmine_node" task
main.calculate(a, b)
adds two numbers: a & b
Finished in 0.005 seconds
1 test, 1 assertion, 0 failures
Running "clean:all" (clean) task
Done, without errors.
$
If I invoke it with 'deploy.project' however, It runs the first 'clean' and jasmine_node, but grunt exits before executing the second 'clean' and completing the build.
$grunt --deploy.project=Foo
Running "clean:all" (clean) task
Running "jasmine_node" task
##teamcity[testSuiteStarted name='main.calculate(a, b)']
##teamcity[testStarted name='adds two numbers: a & b' captureStandardOutput='true']
##teamcity[testFinished name='adds two numbers: a & b']
##teamcity[testSuiteFinished name='main.calculate(a, b)']
$
I would expect it to execute all three tasks. I spent some time looking at the jasmine-reporters code for the Teamcity reporter, but I cannot understand why this is happening.