node.js - Change grunt (express) / protractor debug port -
abstract
hi, i've used yeoman angular-fullstack in order scaffold initial configuration project. unfortunatelly angular-fullstack doesn't contain protractor bundle utilize end-2-end test runner. i've tried connect protractor myself.
though i've succeeded connecting protractor, i've failed @ making work in debug mode. problem both protractor , express debuggers launched on same port 5858 , there no way i've found allow changing ports.
how create both protractor , express debuggers run on different custom ports?
here's gruntfile.js, i'll post additional info upon request:
// generated on 2014-04-27 using generator-angular-fullstack 1.4.2 'use strict'; // # globbing // performance reasons we're matching 1 level down: // 'test/spec/{,*/}*.js' // utilize if want recursively match subfolders: // 'test/spec/**/*.js' module.exports = function (grunt) { // load grunt tasks automatically require('load-grunt-tasks')(grunt); // time how long tasks take. can help when optimizing build times require('time-grunt')(grunt); // define configuration tasks grunt.initconfig({ // project settings yeoman: { // configurable paths app: require('./bower.json').apppath || 'app', dist: 'dist' }, express: { options: { debug: 5555, port: process.env.port || 9000 }, dev: { options: { script: 'server.js', debug: 7777 } }, prod: { options: { script: 'dist/server.js', node_env: 'production' } } }, open: { server: { url: 'http://localhost:<%= express.options.port %>' } }, watch: { js: { files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], tasks: ['newer:jshint:all'], options: { livereload: true } }, mochatest: { files: ['test/server/{,*/}*.js'], tasks: ['env:test', 'mochatest'] }, jstest: { files: ['test/client/spec/{,*/}*.js'], tasks: ['newer:jshint:test', 'karma'] }, styles: { files: ['<%= yeoman.app %>/styles/{,*/}*.css'], tasks: ['newer:copy:styles', 'autoprefixer'] }, gruntfile: { files: ['gruntfile.js'] }, livereload: { files: [ '<%= yeoman.app %>/views/{,*//*}*.{html,jade}', '{.tmp,<%= yeoman.app %>}/styles/{,*//*}*.css', '{.tmp,<%= yeoman.app %>}/scripts/{,*//*}*.js', '<%= yeoman.app %>/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}' ], options: { livereload: true } }, express: { files: [ 'server.js', 'lib/**/*.{js,json}' ], tasks: ['newer:jshint:server', 'express:dev', 'wait'], options: { livereload: true, nospawn: true //without alternative specified express won't reloaded } } }, // create sure code styles par , there no obvious mistakes jshint: { options: { jshintrc: '.jshintrc', reporter: require('jshint-stylish') }, server: { options: { jshintrc: 'lib/.jshintrc' }, src: [ 'lib/{,*/}*.js'] }, all: [ '<%= yeoman.app %>/scripts/{,*/}*.js' ], test: { options: { jshintrc: 'test/client/.jshintrc' }, src: ['test/client/spec/{,*/}*.js'] } }, // empties folders start fresh clean: { dist: { files: [ { dot: true, src: [ '.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*', '!<%= yeoman.dist %>/procfile' ] } ] }, heroku: { files: [ { dot: true, src: [ 'heroku/*', '!heroku/.git*', '!heroku/procfile' ] } ] }, server: '.tmp' }, // add together vendor prefixed styles autoprefixer: { options: { browsers: ['last 1 version'] }, dist: { files: [ { expand: true, cwd: '.tmp/styles/', src: '{,*/}*.css', dest: '.tmp/styles/' } ] } }, // debugging node inspector 'node-inspector': { custom: { options: { 'web-host': 'localhost' } } }, // utilize nodemon run server in debug mode initial breakpoint nodemon: { debug: { script: 'server.js', options: { nodeargs: ['--debug-brk'], env: { port: process.env.port || 9000 }, callback: function (nodemon) { nodemon.on('log', function (event) { console.log(event.colour); }); // opens browser on initial server start nodemon.on('config:update', function () { settimeout(function () { require('open')('http://localhost:8080/debug?port=5858'); }, 500); }); } } } }, // automatically inject bower components app 'bowerinstall': { app: { src: '<%= yeoman.app %>/views/index.html', html: '<%= yeoman.app %>/views/index.html', ignorepath: '<%= yeoman.app %>/' } }, // renames files browser caching purposes rev: { dist: { files: { src: [ '<%= yeoman.dist %>/public/scripts/{,*/}*.js', '<%= yeoman.dist %>/public/styles/{,*/}*.css', '<%= yeoman.dist %>/public/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', '<%= yeoman.dist %>/public/styles/fonts/*' ] } } }, // reads html usemin blocks enable smart builds automatically // concat, minify , revision files. creates configurations in memory // additional tasks can operate on them useminprepare: { html: ['<%= yeoman.app %>/views/index.html', '<%= yeoman.app %>/views/index.jade'], options: { dest: '<%= yeoman.dist %>/public' } }, // performs rewrites based on rev , useminprepare configuration usemin: { html: ['<%= yeoman.dist %>/views/{,*/}*.html', '<%= yeoman.dist %>/views/{,*/}*.jade'], css: ['<%= yeoman.dist %>/public/styles/{,*/}*.css'], options: { assetsdirs: ['<%= yeoman.dist %>/public'] } }, // next *-min tasks produce minified files in dist folder imagemin: { options: { cache: false }, dist: { files: [ { expand: true, cwd: '<%= yeoman.app %>/images', src: '{,*/}*.{png,jpg,jpeg,gif}', dest: '<%= yeoman.dist %>/public/images' } ] } }, svgmin: { dist: { files: [ { expand: true, cwd: '<%= yeoman.app %>/images', src: '{,*/}*.svg', dest: '<%= yeoman.dist %>/public/images' } ] } }, htmlmin: { dist: { options: { //collapsewhitespace: true, //collapsebooleanattributes: true, //removecommentsfromcdata: true, //removeoptionaltags: true }, files: [ { expand: true, cwd: '<%= yeoman.app %>/views', src: ['*.html', 'partials/**/*.html'], dest: '<%= yeoman.dist %>/views' } ] } }, // allow utilize of non-minsafe angularjs files. automatically makes // minsafe compatible uglify not destroy ng references ngmin: { dist: { files: [ { expand: true, cwd: '.tmp/concat/scripts', src: '*.js', dest: '.tmp/concat/scripts' } ] } }, // replace google cdn references cdnify: { dist: { html: ['<%= yeoman.dist %>/views/*.html'] } }, // copies remaining files places other tasks can utilize copy: { dist: { files: [ { expand: true, dot: true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>/public', src: [ '*.{ico,png,txt}', '.htaccess', 'bower_components/**/*', 'images/{,*/}*.{webp}', 'fonts/**/*' ] }, { expand: true, dot: true, cwd: '<%= yeoman.app %>/views', dest: '<%= yeoman.dist %>/views', src: '**/*.jade' }, { expand: true, cwd: '.tmp/images', dest: '<%= yeoman.dist %>/public/images', src: ['generated/*'] }, { expand: true, dest: '<%= yeoman.dist %>', src: [ 'package.json', 'server.js', 'lib/**/*' ] } ] }, styles: { expand: true, cwd: '<%= yeoman.app %>/styles', dest: '.tmp/styles/', src: '{,*/}*.css' } }, // run tasks in parallel speed build process concurrent: { server: [ 'copy:styles' ], test: [ 'copy:styles' ], debug: { tasks: [ 'nodemon', 'node-inspector' ], options: { logconcurrentoutput: true } }, dist: [ 'copy:styles', 'imagemin', 'svgmin', 'htmlmin' ] }, // default, `index.html`'s <!-- usemin block --> take care of // minification. these next options pre-configured if not wish // utilize usemin blocks. // cssmin: { // dist: { // files: { // '<%= yeoman.dist %>/styles/main.css': [ // '.tmp/styles/{,*/}*.css', // '<%= yeoman.app %>/styles/{,*/}*.css' // ] // } // } // }, // uglify: { // dist: { // files: { // '<%= yeoman.dist %>/scripts/scripts.js': [ // '<%= yeoman.dist %>/scripts/scripts.js' // ] // } // } // }, // concat: { // dist: {} // }, // test settings karma: { unit: { configfile: 'karma.conf.js', singlerun: true } }, mochatest: { options: { reporter: 'spec' }, src: ['test/server/**/*.js'] }, env: { test: { node_env: 'test' } } }); // used delaying livereload until after server has restarted grunt.registertask('wait', function () { grunt.log.ok('waiting server reload...'); var done = this.async(); settimeout(function () { grunt.log.writeln('done waiting!'); done(); }, 500); }); grunt.registertask('express-keepalive', 'keep grunt running', function () { this.async(); }); grunt.registertask('debug', function (target) { debugger; }); grunt.registertask('serve', function (target) { if (target === 'dist') { homecoming grunt.task.run(['build', 'express:prod', 'open', 'express-keepalive']); } if (target === 'debug') { homecoming grunt.task.run([ 'clean:server', 'bowerinstall', 'concurrent:server', 'autoprefixer', 'concurrent:debug' ]); } grunt.task.run([ 'clean:server', 'bowerinstall', 'concurrent:server', 'autoprefixer', 'express:dev', 'open', 'watch' ]); }); grunt.registertask('server', function () { grunt.log.warn('the `server` task has been deprecated. utilize `grunt serve` start server.'); grunt.task.run(['serve']); }); grunt.registertask('test', function (target) { if (target === 'server') { homecoming grunt.task.run([ 'env:test', 'mochatest' ]); } else if (target === 'client') { homecoming grunt.task.run([ 'clean:server', 'concurrent:test', 'autoprefixer', 'karma' ]); } else grunt.task.run([ 'test:server', 'test:client' ]); }); grunt.registertask('build', [ 'clean:dist', 'bowerinstall', 'useminprepare', 'concurrent:dist', 'autoprefixer', 'concat', 'ngmin', 'copy:dist', 'cdnify', 'cssmin', 'uglify', 'rev', 'usemin' ]); grunt.registertask('heroku', function () { grunt.log.warn('the `heroku` task has been deprecated. utilize `grunt build` build deployment.'); grunt.task.run(['build']); }); grunt.registertask('default', [ 'newer:jshint', 'test', 'build' ]); }; thank in advance!
i had problem grunt-express-server, rather protractor, , upon investigation turns out port isn't beingness picked grunt-express-server.
i made alter locally , have have forked grunt-express-server repo. there pull request created here:
https://github.com/ericclemmons/grunt-express-server/pull/84
you can apply same alter in local grunt-express-server code base of operations , can set port grunt.js config this:
express: { options: { port: process.env.port || 9000 }, dev: { options: { script: 'server/app.js', debug: 5859 } }, prod: { options: { script: 'dist/server/app.js' } } }, note debug port there.
node.js express gruntjs protractor
No comments:
Post a Comment