bahmutov / pre-git

Automatically install pre-commit / pre-push hooks in your git repo
168 stars 22 forks source link

added task to pre-commit and after success won't fire git commit. #108

Closed chriseugenerodriguez closed 7 years ago

chriseugenerodriguez commented 7 years ago

Hi,

Anyway to accomplish this. I have pre-git task, need to turn off jasmine if passed all tests, any clue?

"config": {
    "pre-git": {
      "enabled": true,
      "msg-pattern": "^(US|DE)\\d+ - .+",
      "commit-msg": "validate-commit-msg",
      "pre-commit": [
        "npm run sass-lint && npm run ts-lint",
        "npm test --single-run"
      ],
      "pre-push": [
        "npm e2e"
      ],
      "post-commit": "git status",
      "post-checkout": [],
      "post-merge": []
    }
  }

Expected behaviour

--single-run in command line, run once.

Actual behaviour

doesn't end process

Environment Details

Steps to reproduce the behaviour

  1. karma start --single-run --watch=false

karma.conf.js

// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'), // add the phantom launcher
      require('@angular/cli/plugins/karma'),
      require('karma-mocha-reporter')
    ], 
    mochaReporter: {
      colors: {
        success: 'green',
        info: 'grey',
        warning: 'yellow',
        error: 'red'
      },
      output: 'autowatch',
      showDiff: true
    },
    client:{
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
      args: ['--grep', config.grep]
    }, 
    files: [
      { pattern: './src/test.ts', watched: false },
      { pattern: './node_modules/intl/locale-data/jsonp/en-US.js', watched: false }
    ],
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },  
    mime: {
      'text/x-typescript': ['ts','tsx']
    },      
    angularCli: {
      environment: 'dev'
    },    
    reporters: ['mocha'],    
    port: 9876,
    colors: true,   
    logLevel: config.LOG_INFO,
    autoWatch: true, 
    browsers: ['ChromeHeadless'],    
    singleRun: false
  });
};
bahmutov commented 7 years ago

weird, can you run the precommit hook by itself? Like DEBUG=pre-git ./.git/hook/precommit?

chriseugenerodriguez commented 7 years ago

@bahmutov how do I run that debug? It doesn't work on any successful runs.