Continuous Integration: Codeship + Gulp (Jasmine) - codeship

My Continuous Integration works pretty great using Codeship except one thing: stop deploying and alert us when unit tests are failing.
Here is our current commands:
npm install
npm install bower
bower install
gulp test
gulp build
The problem is whether gulp test end with success or fail, the gulp build builds.
I succeed to console.log() my gulp test exit status but I have no idea about how to make Codeship listen to this exit status.

The build on Codeship will fail as soon as any command exits with an exit code other than zero.
Please make sure this is the case with running gulp test.
(You can also reach out to us via support#codeship.com if any other questions come up!)

Using #mlocker answer and this discussion on Github, I've found a workaround that works fine for me:
gulp.task('test', function (done) {
karma.start({}, function(exitStatus){
done(exitStatus ? "There are failing unit tests" : undefined);
});
});
The trick here is that if the exitStatus is different from 0, you'll get a formatError on "There are failing unit tests" which will exit gulp test with 1 making Codeship to stop and consider the build as failed.

maybe you can try chaining the test and build tasks?
gulp test && gulp build

Related

How can I solve error in teamcity (Nunit)?

Recently our NUnit build configuration has occasionally stopped halfway through the tests, but the overall build outcome is successful . When I look at the build log, the last test that actually got executed shows:
Process exited with code -100 (Step: tests (NUnit))
and then the build stops. Under "Failure Conditions". Our NUnit Consol is 3.10.0 .
Below is our NUnit configuration image.
I've found this comment in the TeamCity YouTrack. Seems, dotnet projects aren't supported in NUnit build step.
Try to use .NET CLI build step with "dotnet test" command to run tests in this project. Does it work?

How to fix ' Disconnected, because no message in 10000 ms.' error while trying to run karma unit test?

I am getting 'Disconnected, because no message in 10000 ms' error while trying to run karma unit tests. This error triggered only after the installation of webdriver-manager ( to run protractor) and ran unit tests successfully before this installation.
I assumed that the error might be hitting since webdriver is up and running. So,I passed command 'webdriver-manager shoutdown' to stop it. but,it showed that no server is up and running.
My requirement is to run both protractor functional test and karma unit tests in same machine without any error.
Found the solution for this issue by myself.
Solution: Install angular cli using the command 'npm install -g #angular/cli'.
I am able to execute both karma unit tests and protractor functional tests in my system without any issue after installing angular cli.

vsts phase conditions: How to continue with next phase?

I have a build steps like:
- ...
- npm install
- npm start sb:server (start http-server to serve static files)
- npm run e2e
By the npm start sb:server; it starts the server and it hangs... and doesn't go the next phase which is npm run e2e.
I would like to add a condition to npm run e2e that it should just start without looking previous phase state (failed or succeeded).
I have checked the https://learn.microsoft.com/en-us/vsts/pipelines/process/conditions?view=vsts#job-status-functions
I can't figure out what kind of command I have to set in 'custom condition' field..
Any help would be appreciated!
Every task has a "continue on error" checkbox. Check that. Then, if that task fails, it is treated as a warning, not an error. Execution of subsequent tasks will happen normally.
I suspect that the npm start sb:server must keeps running so that it can be used all the time. So the command is never finished. The workaround is using cmd task to start another cmd task and run the npm start command in new cmd.

run "clean-up": Job failed: exit status 1

I have Ionic pro, packaging for Android keeps failing with the following output:
$ run "clean-up"
Running Stage clean-up for Job: 5444336
ERROR: Job failed: exit status 1
The APK seems to generate correctly, but after the APK is generated this clean up command is attempted and fails.
Response from Ionic support:
I see you're using cordova-android 7.0.0. Unfortunately v7 isn't yet supported for package builds. You'll need to revert to v6.4.0 to complete the build. Have a look at this article for more details.

Ionic CLI: [ERROR] Gulpfile (or dependent module) not found: .\gulpfile.js

Senario
I recently upon running an Ionic 3 app, updated (well accidentally) the Ionic CLI version. Now upon running the build from command line, it produces the following error every time and halts the build:
In the error message it says to disable the gulp integration by running the command ionic config set gulp.enabled false which I did. But still getting the same error. I also tried to add the command to the start script of package.json to no avail (not needed though since it seems the config is set globally).
Any help would be appreciated.
Ionic CLI version: 3.9.2
Finally figured out what the problem was. Even if Gulp integration has been disabled with the command ionic config set gulp.enabled false, as long as Gulp is a Dev dependency (i.e. there is a reference to it in the package.json under devDependencies) the Ionic CLI would (well, logically) assume that the Ionic project has a dependency on Gulp, therefore would throw the error (see original post).
Solution
The solution for a case where you don't want Gulp integration, apart from disabling it by running the command ionic config set gulp.enabled false, is to also make sure Gulp is NOT under the devDependencies in the package.json file.
Hope this helps anyone else with a similar issue.
NOTE: Not sure from which version onwards Ionic requires integration with Cordova and Gulp in the shape of ionic.config.json file. Anyway, the above solution will be relevant for a similar case in any of those versions.