Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gerich-home/it-depends into fixin…
Browse files Browse the repository at this point in the history
…g-diamond-perf
  • Loading branch information
gerich-home committed Apr 5, 2016
2 parents 4fbc2b6 + 93acfdf commit e1f37d4
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions gulp/performance-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var gulpIf = require('gulp-if');
var benchmark = require('gulp-benchmark');
var _ = require('lodash');
var isAppveyor = require('./util/is-appveyor.js');
var fs = require('fs');
var path = require('path');

function minimalRatio() {
return 2 / 3;
Expand Down Expand Up @@ -38,12 +40,7 @@ function getSlowTestSuites(file) {
gulp.task('performance-tests', ['all-tests-with-no-performance'], function () {
return gulp
.src('./performance-tests/tests/**/*.js', {read: false})
.pipe(benchmark({
reporters: [
benchmark.reporters.etalon('knockout'),
benchmark.reporters.json()
]
}))
.pipe(benchmarkSetup())
.pipe(gulp.dest('./out/reports'));
/*
TODO: results seem to vary on different machines (90x times faster, 50x times slover). Ignore them for now.
Expand All @@ -58,3 +55,26 @@ gulp.task('performance-tests', ['all-tests-with-no-performance'], function () {
}, true)));
*/
});

var perfTestsPath = './performance-tests/tests';
var files = fs.readdirSync(perfTestsPath);
files.forEach(function (file) {
if (!fs.lstatSync(path.join(perfTestsPath, file)).isDirectory()) return;

gulp.task('performance-scenario-' + file, [], function () {
return gulp
.src(path.join(perfTestsPath, file, '/**/*.js'), {read: false})
.pipe(benchmarkSetup())
.pipe(gulp.dest('./out/reports'));
});

});

function benchmarkSetup() {
return benchmark({
reporters: [
benchmark.reporters.etalon('knockout'),
benchmark.reporters.json()
]
});
}

0 comments on commit e1f37d4

Please sign in to comment.