@@ -35,6 +35,13 @@ const server = require('karma-server-side');
3535const webidl = require ( './test-webidl' ) ;
3636const join = require ( 'join-path-js' ) ;
3737
38+ // special benchmark setup
39+ const _ = require ( 'lodash' ) ;
40+ const _process = require ( 'process' ) ;
41+ const benchmark = require ( 'benchmark' ) ;
42+ const Benchmark = benchmark . runInContext ( { _, _process} ) ;
43+ window . Benchmark = Benchmark ;
44+
3845const entries = [ ] ;
3946
4047if ( process . env . JSONLD_TESTS ) {
@@ -75,20 +82,21 @@ if(process.env.JSONLD_TESTS) {
7582 entries . push ( webidl ) ;
7683}
7784
78- let benchmark = null ;
85+ let benchmarkOptions = null ;
7986if ( process . env . JSONLD_BENCHMARK ) {
80- benchmark = { } ;
87+ benchmarkOptions = { } ;
8188 if ( ! ( [ '1' , 'true' ] . includes ( process . env . JSONLD_BENCHMARK ) ) ) {
8289 process . env . JSONLD_BENCHMARK . split ( ',' ) . forEach ( pair => {
8390 const kv = pair . split ( '=' ) ;
84- benchmark [ kv [ 0 ] ] = kv [ 1 ] ;
91+ benchmarkOptions [ kv [ 0 ] ] = kv [ 1 ] ;
8592 } ) ;
8693 }
8794}
8895
8996const options = {
9097 nodejs : false ,
9198 assert,
99+ benchmark,
92100 jsonld,
93101 /* eslint-disable-next-line no-unused-vars */
94102 exit : code => {
@@ -103,7 +111,7 @@ const options = {
103111 verboseSkip : process . env . VERBOSE_SKIP === 'true' ,
104112 bailOnError : process . env . BAIL === 'true' ,
105113 entries,
106- benchmark ,
114+ benchmarkOptions ,
107115 readFile : filename => {
108116 return server . run ( filename , function ( filename ) {
109117 const fs = serverRequire ( 'fs-extra' ) ;
0 commit comments