index.js 3.6 KB

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