-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
40 lines (39 loc) · 1.17 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var Benchmark = require('benchmark');
var assert = require('chai').assert;
var tb = require('./');
var tjgl = require('travis-json-git-log');
var async = require('async');
var jsonfile = require('jsonfile');
describe('travis-benchmark', function() {
it('lifecycle', function(done) {
var time = new Date().valueOf();
var suite = new Benchmark.Suite('lifecycle suite');
suite.add('errored benchmark', function() {
throw new Error('message');
});
suite.add('empty benchmark', function() {});
tb.wrapSuite(suite, (error, _context, config) => {
if (error) throw error;
var context = {};
async.series([
tjgl.prepareDir(context, config),
tjgl.clone(context, config),
tjgl.findFile(context, config),
(next) => {
jsonfile.readFile(context.filepath, function(error, json) {
assert.deepEqual(json, config.data);
next();
});
},
tjgl.clean(context, config),
], (error) => {
if (error) throw error;
done();
});
}, {
repo_slug: 'evolvator/travis-benchmark',
filename: ''+time
});
suite.run({ async: true });
});
});