Skip to content

Commit b823449

Browse files
committed
migrate BenchmarkTestCases
1 parent f0ef3fd commit b823449

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

test/BenchmarkTestCases.benchmark.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"use strict";
22

3-
require("should");
43
const path = require("path");
54
const fs = require("fs");
65
const asyncLib = require("async");
7-
var Test = require("mocha/lib/test");
86

97
const Benchmark = require("benchmark");
108

@@ -24,8 +22,7 @@ describe("BenchmarkTestCases", function() {
2422
fs.mkdirSync(baselinesPath);
2523
} catch(e) {}
2624

27-
before(function(done) {
28-
this.timeout(270000);
25+
beforeAll(function(done) {
2926
const git = require("simple-git");
3027
const rootPath = path.join(__dirname, "..");
3128
getBaselineRevs(rootPath, (err, baselineRevisions) => {
@@ -65,7 +62,7 @@ describe("BenchmarkTestCases", function() {
6562
}
6663
}, done);
6764
});
68-
});
65+
}, 270000);
6966

7067
function getBaselineRevs(rootPath, callback) {
7168
const git = require("simple-git")(rootPath);
@@ -169,17 +166,10 @@ describe("BenchmarkTestCases", function() {
169166
tests.forEach(testName => {
170167
const testDirectory = path.join(casesPath, testName);
171168
let headStats = null;
172-
const suite = describe(testName, function() {});
173-
it(`${testName} create benchmarks`, function() {
169+
describe(`${testName} create benchmarks`, function() {
174170
baselines.forEach(baseline => {
175171
let baselineStats = null;
176-
177-
function it(title, fn) {
178-
const test = new Test(title, fn);
179-
suite.addTest(test);
180-
}
181172
it(`should benchmark ${baseline.name} (${baseline.rev})`, function(done) {
182-
this.timeout(180000);
183173
const outputDirectory = path.join(__dirname, "js", "benchmark", `baseline-${baseline.name}`, testName);
184174
const config = Object.create(require(path.join(testDirectory, "webpack.config.js")));
185175
config.output = Object.create(config.output || {});
@@ -194,7 +184,7 @@ describe("BenchmarkTestCases", function() {
194184
baselineStats = stats;
195185
done();
196186
});
197-
});
187+
}, 180000);
198188

199189
if(baseline.name !== "HEAD") {
200190
it(`HEAD should not be slower than ${baseline.name} (${baseline.rev})`, function() {

0 commit comments

Comments
 (0)