index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. var lessTest = require('./less-test'),
  2. lessTester = lessTest(),
  3. path = require('path'),
  4. stylize = require('../lib/less-node/lessc-helper').stylize;
  5. console.log('\n' + stylize('Less', 'underline') + '\n');
  6. lessTester.prepBomTest();
  7. var testMap = [
  8. [{}, 'namespacing/'],
  9. [{
  10. // TODO: Change this to rewriteUrls: 'all' once the relativeUrls option is removed
  11. relativeUrls: true,
  12. silent: true,
  13. javascriptEnabled: true
  14. }],
  15. [{
  16. math: 'strict-legacy'
  17. }, 'math/strict-legacy/'],
  18. [{
  19. math: 'parens'
  20. }, 'math/strict/'],
  21. [{
  22. math: 'parens-division'
  23. }, 'math/parens-division/'],
  24. // Use legacy strictMath: true here to demonstrate it still works
  25. [{strictMath: true, strictUnits: true, javascriptEnabled: true}, 'errors/',
  26. lessTester.testErrors, null],
  27. [{math: 'strict', strictUnits: true, javascriptEnabled: false}, 'no-js-errors/',
  28. lessTester.testErrors, null],
  29. [{math: 'strict', dumpLineNumbers: 'comments'}, 'debug/', null,
  30. function(name) { return name + '-comments'; }],
  31. [{math: 'strict', dumpLineNumbers: 'mediaquery'}, 'debug/', null,
  32. function(name) { return name + '-mediaquery'; }],
  33. [{math: 'strict', dumpLineNumbers: 'all'}, 'debug/', null,
  34. function(name) { return name + '-all'; }],
  35. // TODO: Change this to rewriteUrls: false once the relativeUrls option is removed
  36. [{math: 'strict', relativeUrls: false, rootpath: 'folder (1)/'}, 'static-urls/'],
  37. [{math: 'strict', compress: true}, 'compression/'],
  38. [{math: 0, strictUnits: true}, 'strict-units/'],
  39. [{}, 'legacy/'],
  40. [{math: 'strict', strictUnits: true, sourceMap: true, globalVars: true }, 'sourcemaps/',
  41. lessTester.testSourcemap, null, null,
  42. function(filename, type, baseFolder) {
  43. if (type === 'vars') {
  44. return path.join(baseFolder, filename) + '.json';
  45. }
  46. return path.join('test/sourcemaps', filename) + '.json';
  47. }],
  48. [{math: 'strict', strictUnits: true, sourceMap: {sourceMapFileInline: true}},
  49. 'sourcemaps-empty/', lessTester.testEmptySourcemap],
  50. [{globalVars: true, banner: '/**\n * Test\n */\n'}, 'globalVars/',
  51. null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }],
  52. [{modifyVars: true}, 'modifyVars/',
  53. null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }],
  54. [{urlArgs: '424242'}, 'url-args/'],
  55. [{rewriteUrls: 'all'}, 'rewrite-urls-all/'],
  56. [{rewriteUrls: 'local'}, 'rewrite-urls-local/'],
  57. [{rootpath: 'http://example.com/assets/css/', rewriteUrls: 'all'}, 'rootpath-rewrite-urls-all/'],
  58. [{rootpath: 'http://example.com/assets/css/', rewriteUrls: 'local'}, 'rootpath-rewrite-urls-local/'],
  59. [{paths: ['test/data/', 'test/less/import/']}, 'include-path/'],
  60. [{paths: 'test/data/'}, 'include-path-string/'],
  61. [{plugin: 'test/plugins/postprocess/'}, 'postProcessorPlugin/'],
  62. [{plugin: 'test/plugins/preprocess/'}, 'preProcessorPlugin/'],
  63. [{plugin: 'test/plugins/visitor/'}, 'visitorPlugin/'],
  64. [{plugin: 'test/plugins/filemanager/'}, 'filemanagerPlugin/'],
  65. [{}, 'no-strict-math/'],
  66. [{}, '3rd-party/']
  67. ];
  68. testMap.forEach(function(args) {
  69. lessTester.runTestSet.apply(lessTester, args)
  70. });
  71. lessTester.testSyncronous({syncImport: true}, 'import');
  72. lessTester.testSyncronous({syncImport: true}, 'math/strict-legacy/css');
  73. lessTester.testNoOptions();
  74. lessTester.testJSImport();
  75. lessTester.finished();