forked from beautifier/js-beautify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode-beautify-css-perf-tests.js
45 lines (35 loc) · 1 KB
/
node-beautify-css-perf-tests.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
41
42
43
44
45
/*global js_beautify: true */
/*jshint node:true */
/*jshint unused:false */
'use strict';
var fs = require('fs'),
SanityTest = require('./sanitytest'),
Benchmark = require('benchmark'),
Urlencoded = require('../lib/unpackers/urlencode_unpacker'),
beautifier = require('../src/index');
function node_beautifier_html_tests() {
console.log('Testing performance...');
var github_css = fs.readFileSync(__dirname + '/../../test/resources/github.css', 'utf8');
var options = {
wrap_line_length: 80
};
//warm-up
beautifier.css(github_css, options);
var suite = new Benchmark.Suite();
suite.add("css-beautify (github.css)", function() {
beautifier.css(github_css, options);
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target));
})
.on('error', function(event) {
return 1;
})
.on('complete', function(event) {})
.run();
return 0;
}
if (require.main === module) {
process.exit(node_beautifier_html_tests());
}