This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Run jest with worker count higher than 1. Empty test that just sleeps for a minute will do. | |
2. Kill one of the workers intentionally. In practice, they may die for whatever reason, for us we suspect it is OOM. | |
3. Jest will indefinitely hang. | |
Related and recent fix https://github.com/facebook/jest/pull/13054/files#diff-e99351d361fdd6f55d39c7c41af94576baccc2b9dce73a5bfd0b516c6ab648e9 | |
However the workers may crash with other signals and those scenarios are not covered. In our case, after some debugging, the signal is null. For some reason these workers are crashing in jest-runtime at the compileFunction.call line, and causes a null exit code, which gets ignored. jest-runner waits on a thread pool that'll never fulfil the submitted job. | |
The signal appears to be SIGKILL instead of SIBABRT , and the exitCode appears to be null. Please see screenshots of the debug process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('myApp', []) | |
.directive('myDirective', function(){ | |
return { | |
restrict: 'E', | |
template: '<div ng-if="isVisible"></div>', | |
scope: true, | |
controller: function(){ | |
$scope.isVisible = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app', []) | |
.directive('myAwsomeDirective', function($rootScope) { | |
return { | |
restrict: 'A', | |
link: function(scope) { | |
// $scope.$on() returns an unbind function of the binding | |
// | |
// So use the bind function directly within scope's $destroy event | |
// to unbind event automatically. | |
scope.$on('$destroy', $rootScope.$on('my:event', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'), | |
path = require('path'); | |
afterEach(function(){ | |
var passed = jasmine.getEnv().currentSpec.results().passed(); | |
// Replace all space characters in spec name with dashes | |
var specName = jasmine.getEnv().currentSpec.description.replace(/ /g, '-'), | |
baseFileName = specName, | |
screenshotsDir = path.resolve(__dirname + '../screenshots/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.config = { | |
// ----- What tests to run ----- | |
specs: [ | |
'test/e2e/*.js' | |
], | |
// ----- Capabilities to be passed to the webdriver instance ---- | |
capabilities: {}, // not required anymore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a rejected promise | |
return protractor.promise.rejected(); | |
// create a resolved promise | |
return protractor.promise.fulfilled(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create local branches that target remote branches | |
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do | |
git branch --track ${branch#remotes/origin/} $branch | |
done | |
// delete all remote branches that have been merged to master | |
git branch --merged master | grep -v master | xargs -n 1 git push --delete origin | |
// delete all local branches that have been merged to master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$routeProvider | |
.when('/about-us', { | |
title: 'About Us', | |
templateUrl: 'views/about_us_view.html', | |
controller: 'AboutUs_controller', | |
resolve: { | |
resolvedData: function($q, $timeout){ | |
// create a promise that only gets resolved when all components are loaded | |
var defer = $q.defer(); | |
// Load and execute scripts. You can use any script loader you prefer. In this example I use $LAB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize your angular app module | |
angular.module('ngApp', [/* any other dependet modules */]) | |
// our configuration method | |
.config(function($controllerProvider, $compileProvider, $filterProvider, $provide){ | |
// Save old component registration methods (optional). | |
angular.module('ngApp')._controller = angular.module('ngApp').controller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to register a controller normally | |
angular.module('ngApp').controller(/*controller code*/); | |
// How to register a controller after application bootstrap | |
$controllerProvider.register(/*controller code*/); |
NewerOlder