mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
Some operations modify the options object, which could influence the next test set. Modified the test labels in the output to include the folder (to distinguish between the normal and BOM tests). Modified warning message from data-uri file-not-found to include the filename.
52 lines
2.8 KiB
JavaScript
52 lines
2.8 KiB
JavaScript
var lessTest = require("./less-test"),
|
|
lessTester = lessTest(),
|
|
path = require("path"),
|
|
stylize = require('../lib/less-node/lessc-helper').stylize;
|
|
|
|
function getErrorPathReplacementFunction(dir) {
|
|
return function(input, baseDir) {
|
|
return input.replace(/\{path\}/g, path.join(process.cwd(), baseDir, dir + "/"))
|
|
.replace(/\{node\}/g, "")
|
|
.replace(/\{\/node\}/g, "")
|
|
.replace(/\{pathrel\}/g, path.join(baseDir, dir + "/"))
|
|
.replace(/\{pathhref\}/g, "")
|
|
.replace(/\{404status\}/g, "")
|
|
.replace(/\r\n/g, '\n');
|
|
};
|
|
}
|
|
|
|
console.log("\n" + stylize("Less", 'underline') + "\n");
|
|
lessTester.prepBomTest();
|
|
lessTester.runTestSet({strictMath: true, relativeUrls: true, silent: true});
|
|
lessTester.runTestSet({strictMath: true, strictUnits: true}, "errors/",
|
|
lessTester.testErrors, null, getErrorPathReplacementFunction("errors"));
|
|
lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/",
|
|
lessTester.testErrors, null, getErrorPathReplacementFunction("no-js-errors"));
|
|
lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null,
|
|
function(name) { return name + '-comments'; });
|
|
lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null,
|
|
function(name) { return name + '-mediaquery'; });
|
|
lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'all'}, "debug/", null,
|
|
function(name) { return name + '-all'; });
|
|
lessTester.runTestSet({strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/");
|
|
lessTester.runTestSet({strictMath: true, compress: true}, "compression/");
|
|
lessTester.runTestSet({strictMath: true, strictUnits: true}, "strict-units/");
|
|
lessTester.runTestSet({}, "legacy/");
|
|
lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/",
|
|
lessTester.testSourcemap, null, null,
|
|
function(filename, type, baseFolder) {
|
|
if (type === "vars") {
|
|
return path.join(baseFolder, filename) + '.json';
|
|
}
|
|
return path.join('test/sourcemaps', filename) + '.json';
|
|
});
|
|
lessTester.runTestSet({globalVars: true, banner: "/**\n * Test\n */\n"}, "globalVars/",
|
|
null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; });
|
|
lessTester.runTestSet({modifyVars: true}, "modifyVars/",
|
|
null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; });
|
|
lessTester.runTestSet({urlArgs: '424242'}, "url-args/");
|
|
lessTester.runTestSet({paths: ['test/data/','test/less/import/']}, "include-path/");
|
|
lessTester.testSyncronous({syncImport: true}, "import");
|
|
lessTester.testSyncronous({syncImport: true}, "css");
|
|
lessTester.testNoOptions();
|
|
lessTester.finished(); |