]> code.delx.au - gnu-emacs-elpa/blob - benchmark/scenarios.js
Reorganize JavaScript files.
[gnu-emacs-elpa] / benchmark / scenarios.js
1 'use strict';
2
3 var fs = require('fs'),
4 path = require('path'),
5 scopifier = require('../languages/javascript/scopifier'),
6
7 jqueryPath = path.join(__dirname, 'fixtures', 'jquery-2.1.1.js'),
8 lodashPath = path.join(__dirname, 'fixtures', 'lodash-2.4.1.js'),
9 asyncPath = path.join(__dirname, 'fixtures', 'async-0.9.0.js'),
10 mkdirpPath = path.join(__dirname, 'fixtures', 'mkdirp-0.5.0.js');
11
12 suite('scopifier', function () {
13
14 var jquery, lodash, async, mkdirp;
15
16 before(function (next) {
17 fs.readFile(jqueryPath, 'utf8', function (error, contents) {
18 jquery = contents;
19 next(error);
20 });
21 });
22 before(function (next) {
23 fs.readFile(lodashPath, 'utf8', function (error, contents) {
24 lodash = contents;
25 next(error);
26 });
27 });
28 before(function (next) {
29 fs.readFile(asyncPath, 'utf8', function (error, contents) {
30 async = contents;
31 next(error);
32 });
33 });
34 before(function (next) {
35 fs.readFile(mkdirpPath, 'utf8', function (error, contents) {
36 mkdirp = contents;
37 next(error);
38 });
39 });
40
41 bench('jquery', function () {
42 scopifier(jquery);
43 });
44 bench('lodash', function () {
45 scopifier(lodash);
46 });
47 bench('async', function () {
48 scopifier(async);
49 });
50 bench('mkdirp', function () {
51 scopifier(mkdirp);
52 });
53
54 });