@@ -186,7 +186,7 @@ module.exports = function(grunt) {
186
186
const nodeVersion = semver . major ( process . versions . node ) ;
187
187
let scriptRuntime = 'node' ;
188
188
if ( nodeVersion < 8 ) {
189
- scriptRuntime = path . resolve ( path . join ( 'node_modules' , '.bin' , 'babel -node' ) ) + ' --presets=@babel/env' ;
189
+ scriptRuntime = path . resolve ( path . join ( 'node_modules' , '.bin' , 'ts -node' ) ) ;
190
190
}
191
191
192
192
// Project configuration.
@@ -206,21 +206,30 @@ module.exports = function(grunt) {
206
206
command : [
207
207
scriptRuntime + " build/rollup.js --lessc --out=./tmp/lessc" ,
208
208
scriptRuntime + " build/rollup.js --node --out=./tmp/less.cjs.js" ,
209
- scriptRuntime + " build/rollup.js --browser --out=./test /browser/less.min.js"
209
+ scriptRuntime + " build/rollup.js --browser --out=./tmp /browser/less.min.js"
210
210
] . join ( " && " )
211
211
} ,
212
212
testcjs : {
213
213
command : scriptRuntime + " build/rollup.js --node --out=./tmp/less.cjs.js"
214
214
} ,
215
215
testbrowser : {
216
- command : scriptRuntime + " build/rollup.js --browser --out=./test /browser/less.min.js"
216
+ command : scriptRuntime + " build/rollup.js --browser --out=./tmp /browser/less.min.js"
217
217
} ,
218
218
test : {
219
219
command : "node test/index.js"
220
220
} ,
221
+ generatebrowser : {
222
+ command : 'node test/browser/generator/generate.js'
223
+ } ,
224
+ runbrowser : {
225
+ command : 'node test/browser/generator/runner.js'
226
+ } ,
221
227
benchmark : {
222
228
command : "node benchmark/index.js"
223
229
} ,
230
+ benchmarkbrowser : {
231
+ command : "node test/browser/generator/runner.js benchmark"
232
+ } ,
224
233
opts : {
225
234
// test running with all current options (using `opts` since `options` means something already)
226
235
command : [
@@ -277,201 +286,7 @@ module.exports = function(grunt) {
277
286
}
278
287
} ,
279
288
280
- jasmine : {
281
- options : {
282
- keepRunner : true ,
283
- host : "http://localhost:8081/" ,
284
- polyfills : [
285
- "./node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js" ,
286
- "test/browser/vendor/promise.js"
287
- ] ,
288
- vendor : [
289
- "test/browser/vendor/jasmine-jsreporter.js" ,
290
- "test/browser/common.js" ,
291
- "test/browser/less.min.js"
292
- ] ,
293
- template : "test/browser/test-runner-template.tmpl"
294
- } ,
295
- main : {
296
- // src is used to build list of less files to compile
297
- src : [
298
- "test/less/*.less" ,
299
- "!test/less/plugin-preeval.less" , // uses ES6 syntax
300
- // Don't test NPM import, obviously
301
- "!test/less/plugin-module.less" ,
302
- "!test/less/import-module.less" ,
303
- "!test/less/javascript.less" ,
304
- "!test/less/urls.less" ,
305
- "!test/less/empty.less"
306
- ] ,
307
- options : {
308
- helpers : "test/browser/runner-main-options.js" ,
309
- specs : "test/browser/runner-main-spec.js" ,
310
- outfile : "tmp/browser/test-runner-main.html"
311
- }
312
- } ,
313
- legacy : {
314
- src : [ "test/less/legacy/*.less" ] ,
315
- options : {
316
- helpers : "test/browser/runner-legacy-options.js" ,
317
- specs : "test/browser/runner-legacy-spec.js" ,
318
- outfile : "tmp/browser/test-runner-legacy.html"
319
- }
320
- } ,
321
- strictUnits : {
322
- src : [ "test/less/strict-units/*.less" ] ,
323
- options : {
324
- helpers : "test/browser/runner-strict-units-options.js" ,
325
- specs : "test/browser/runner-strict-units-spec.js" ,
326
- outfile : "tmp/browser/test-runner-strict-units.html"
327
- }
328
- } ,
329
- errors : {
330
- src : [
331
- "test/less/errors/*.less" ,
332
- "!test/less/errors/javascript-error.less" ,
333
- "test/browser/less/errors/*.less"
334
- ] ,
335
- options : {
336
- timeout : 20000 ,
337
- helpers : "test/browser/runner-errors-options.js" ,
338
- specs : "test/browser/runner-errors-spec.js" ,
339
- outfile : "tmp/browser/test-runner-errors.html"
340
- }
341
- } ,
342
- noJsErrors : {
343
- src : [ "test/less/no-js-errors/*.less" ] ,
344
- options : {
345
- helpers : "test/browser/runner-no-js-errors-options.js" ,
346
- specs : "test/browser/runner-no-js-errors-spec.js" ,
347
- outfile : "tmp/browser/test-runner-no-js-errors.html"
348
- }
349
- } ,
350
- browser : {
351
- src : [
352
- "test/browser/less/*.less" ,
353
- "test/browser/less/plugin/*.less"
354
- ] ,
355
- options : {
356
- helpers : "test/browser/runner-browser-options.js" ,
357
- specs : "test/browser/runner-browser-spec.js" ,
358
- outfile : "tmp/browser/test-runner-browser.html"
359
- }
360
- } ,
361
- relativeUrls : {
362
- src : [ "test/browser/less/relative-urls/*.less" ] ,
363
- options : {
364
- helpers : "test/browser/runner-relative-urls-options.js" ,
365
- specs : "test/browser/runner-relative-urls-spec.js" ,
366
- outfile : "tmp/browser/test-runner-relative-urls.html"
367
- }
368
- } ,
369
- rewriteUrls : {
370
- src : [ "test/browser/less/rewrite-urls/*.less" ] ,
371
- options : {
372
- helpers : "test/browser/runner-rewrite-urls-options.js" ,
373
- specs : "test/browser/runner-rewrite-urls-spec.js" ,
374
- outfile : "tmp/browser/test-runner-rewrite-urls.html"
375
- }
376
- } ,
377
- rootpath : {
378
- src : [ "test/browser/less/rootpath/*.less" ] ,
379
- options : {
380
- helpers : "test/browser/runner-rootpath-options.js" ,
381
- specs : "test/browser/runner-rootpath-spec.js" ,
382
- outfile : "tmp/browser/test-runner-rootpath.html"
383
- }
384
- } ,
385
- rootpathRelative : {
386
- src : [ "test/browser/less/rootpath-relative/*.less" ] ,
387
- options : {
388
- helpers : "test/browser/runner-rootpath-relative-options.js" ,
389
- specs : "test/browser/runner-rootpath-relative-spec.js" ,
390
- outfile : "tmp/browser/test-runner-rootpath-relative.html"
391
- }
392
- } ,
393
- rootpathRewriteUrls : {
394
- src : [ "test/browser/less/rootpath-rewrite-urls/*.less" ] ,
395
- options : {
396
- helpers :
397
- "test/browser/runner-rootpath-rewrite-urls-options.js" ,
398
- specs : "test/browser/runner-rootpath-rewrite-urls-spec.js" ,
399
- outfile :
400
- "tmp/browser/test-runner-rootpath-rewrite-urls.html"
401
- }
402
- } ,
403
- production : {
404
- src : [ "test/browser/less/production/*.less" ] ,
405
- options : {
406
- helpers : "test/browser/runner-production-options.js" ,
407
- specs : "test/browser/runner-production-spec.js" ,
408
- outfile : "tmp/browser/test-runner-production.html"
409
- }
410
- } ,
411
- modifyVars : {
412
- src : [ "test/browser/less/modify-vars/*.less" ] ,
413
- options : {
414
- helpers : "test/browser/runner-modify-vars-options.js" ,
415
- specs : "test/browser/runner-modify-vars-spec.js" ,
416
- outfile : "tmp/browser/test-runner-modify-vars.html"
417
- }
418
- } ,
419
- globalVars : {
420
- src : [ "test/browser/less/global-vars/*.less" ] ,
421
- options : {
422
- helpers : "test/browser/runner-global-vars-options.js" ,
423
- specs : "test/browser/runner-global-vars-spec.js" ,
424
- outfile : "tmp/browser/test-runner-global-vars.html"
425
- }
426
- } ,
427
- postProcessorPlugin : {
428
- src : [ "test/less/postProcessorPlugin/*.less" ] ,
429
- options : {
430
- helpers : [
431
- "test/plugins/postprocess/index.js" ,
432
- "test/browser/runner-postProcessorPlugin-options.js"
433
- ] ,
434
- specs : "test/browser/runner-postProcessorPlugin.js" ,
435
- outfile :
436
- "tmp/browser/test-runner-post-processor-plugin.html"
437
- }
438
- } ,
439
- preProcessorPlugin : {
440
- src : [ "test/less/preProcessorPlugin/*.less" ] ,
441
- options : {
442
- helpers : [
443
- "test/plugins/preprocess/index.js" ,
444
- "test/browser/runner-preProcessorPlugin-options.js"
445
- ] ,
446
- specs : "test/browser/runner-preProcessorPlugin.js" ,
447
- outfile : "tmp/browser/test-runner-pre-processor-plugin.html"
448
- }
449
- } ,
450
- visitorPlugin : {
451
- src : [ "test/less/visitorPlugin/*.less" ] ,
452
- options : {
453
- helpers : [
454
- "test/plugins/visitor/index.js" ,
455
- "test/browser/runner-VisitorPlugin-options.js"
456
- ] ,
457
- specs : "test/browser/runner-VisitorPlugin.js" ,
458
- outfile : "tmp/browser/test-runner-visitor-plugin.html"
459
- }
460
- } ,
461
- filemanagerPlugin : {
462
- src : [ "test/less/filemanagerPlugin/*.less" ] ,
463
- options : {
464
- helpers : [
465
- "test/plugins/filemanager/index.js" ,
466
- "test/browser/runner-filemanagerPlugin-options.js"
467
- ] ,
468
- specs : "test/browser/runner-filemanagerPlugin.js" ,
469
- outfile : "tmp/browser/test-runner-filemanager-plugin.html"
470
- }
471
- }
472
- } ,
473
-
474
- "saucelabs-jasmine" : sauceJobs ,
289
+ "saucelabs-mocha" : sauceJobs ,
475
290
476
291
// Clean the version of less built for the tests
477
292
clean : {
@@ -506,13 +321,13 @@ module.exports = function(grunt) {
506
321
grunt . registerTask ( "browsertest" , [
507
322
"browsertest-lessjs" ,
508
323
"connect" ,
509
- "jasmine "
324
+ "shell:runbrowser "
510
325
] ) ;
511
326
512
327
// setup a web server to run the browser tests in a browser rather than phantom
513
328
grunt . registerTask ( "browsertest-server" , [
514
329
"browsertest-lessjs" ,
515
- "jasmine::build " ,
330
+ "shell:generatebrowser " ,
516
331
"connect::keepalive"
517
332
] ) ;
518
333
@@ -530,13 +345,13 @@ module.exports = function(grunt) {
530
345
531
346
grunt . registerTask ( "sauce" , [
532
347
"browsertest-lessjs" ,
533
- "jasmine::build " ,
348
+ "shell:generatebrowser " ,
534
349
"connect" ,
535
350
"sauce-after-setup"
536
351
] ) ;
537
352
538
353
grunt . registerTask ( "sauce-after-setup" , [
539
- "saucelabs-jasmine :all" ,
354
+ "saucelabs-mocha :all" ,
540
355
"clean:sauce_log"
541
356
] ) ;
542
357
@@ -548,14 +363,12 @@ module.exports = function(grunt) {
548
363
"shell:opts" ,
549
364
"shell:plugin" ,
550
365
"connect" ,
551
- "jasmine "
366
+ "shell:runbrowser "
552
367
] ;
553
368
554
369
if (
555
370
isNaN ( Number ( process . env . TRAVIS_PULL_REQUEST , 10 ) ) &&
556
- Number ( process . env . TRAVIS_NODE_VERSION ) === 4 &&
557
- ( process . env . TRAVIS_BRANCH === "master" ||
558
- process . env . TRAVIS_BRANCH === "3.x" )
371
+ ( process . env . TRAVIS_BRANCH === "master" )
559
372
) {
560
373
testTasks . push ( "force:on" ) ;
561
374
testTasks . push ( "sauce-after-setup" ) ;
@@ -586,8 +399,15 @@ module.exports = function(grunt) {
586
399
] ) ;
587
400
588
401
// Run benchmark
589
- grunt . registerTask ( "benchmark" , [
402
+ grunt . registerTask ( "benchmark-node " , [
590
403
"shell:testcjs" ,
591
404
"shell:benchmark"
592
405
] ) ;
406
+
407
+ // Run all browser tests
408
+ grunt . registerTask ( "benchmark" , [
409
+ "browsertest-lessjs" ,
410
+ "connect" ,
411
+ "shell:benchmarkbrowser"
412
+ ] ) ;
593
413
} ;
0 commit comments