File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 16
16
"precommit" : " lint-staged" ,
17
17
"prepublishOnly" : " npm run clean && npm run build:unmin && npm run build:min" ,
18
18
"release" : " standard-version --no-verify" ,
19
- "test" : " mocha"
19
+ "test" : " mocha" ,
20
+ "test:benchmark" : " node ./test/benchmark.js"
20
21
},
21
22
"repository" : {
22
23
"type" : " git" ,
40
41
"devDependencies" : {
41
42
"@commitlint/cli" : " ^6.1.0" ,
42
43
"@commitlint/config-conventional" : " ^6.1.0" ,
44
+ "benchmark" : " 2.1.4" ,
43
45
"coveralls" : " ^3.0.0" ,
44
46
"eslint" : " ^4.18.0" ,
45
47
"eslint-plugin-prettier" : " ^2.6.0" ,
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var Benchmark = require ( 'benchmark' ) ;
4
+ var helpers = require ( './helpers/' ) ;
5
+ var Parser = require ( '../' ) ;
6
+
7
+ var suite = new Benchmark . Suite ( ) ;
8
+ var mocks = helpers . mocks ;
9
+
10
+ suite
11
+ . add ( 'html-to-react - Single' , function ( ) {
12
+ Parser ( mocks . html . single ) ;
13
+ } )
14
+ . add ( 'html-to-react - Multiple' , function ( ) {
15
+ Parser ( mocks . html . multiple ) ;
16
+ } )
17
+ . add ( 'html-to-react - Complex' , function ( ) {
18
+ Parser ( mocks . html . complex ) ;
19
+ } )
20
+ . on ( 'cycle' , function ( event ) {
21
+ process . stdout . write ( String ( event . target ) + '\n' ) ;
22
+ } )
23
+ . run ( {
24
+ minSamples : 100 ,
25
+ delay : 2
26
+ } ) ;
You can’t perform that action at this time.
0 commit comments