example/03-output-info/karma.conf.js
function formatOutput (results) {
  var date = new Date()
  var commit

  try {
    commit = execSync('git rev-parse HEAD').toString().replace('\n', '')
  } catch (e) {
    commit = 'commit hash not found'
  }

  return {
    meta: {
      title: 'example benchmark',
      version: pkg.version,
      commit: commit,
      date: [
        date.toLocaleDateString(),
        date.toLocaleTimeString(),
        date.toString().match(/\(([A-Za-z\s].*)\)/)[1]
      ].join(' ')
    },
    results: results
  }
}
function formatOutput (results) {
  var date = new Date()
  var commit

  try {
    commit = execSync('git rev-parse HEAD').toString().replace('\n', '')
  } catch (e) {
    commit = 'commit hash not found'
  }

  return {
    meta: {
      title: 'example benchmark',
      version: pkg.version,
      commit: commit,
      date: [
        date.toLocaleDateString(),
        date.toLocaleTimeString(),
        date.toString().match(/\(([A-Za-z\s].*)\)/)[1]
      ].join(' ')
    },
    results: results
  }
}
function formatOutput ( results ) { var date = new Date ( ) var commit try { commit = execSync ( 'git rev-parse HEAD' ) . toString ( ) . replace ( '\n' , '' ) } catch ( e ) { commit = 'commit hash not found' } return { meta : { title : 'example benchmark' , version : pkg . version , commit : commit , date : [ date . toLocaleDateString ( ) , date . toLocaleTimeString ( ) , date . toString ( ) . match ( / \(([A-Za-z\s].*)\) / ) [ 1 ] ] . join ( ' ' ) } , results : results } }
add date, commit package version info to output JSON
add date commit package version info to output JSON