Files
less.js/test/index.js
Doug Haber de4e888211 Add Support Map Tests
This patch adds Support Map Tests to the rhino test suite.  It makes the
following changes:

1.  Fix typo in the Gruntfile.js for the sourcemap-test
2.  Update Gradle build to always build the less-rhino-<version>.js
before running the tests
3. Add a new testRhinoSourceMap and add it to the test list
4. Add a SourceMapRhinoTest that bootstraps SourceMap tests and then
validates them after they run
5. Add hooks in RhinoTest to support custom bootstraping and validation
6. Add compiled version of source-map (version 0.1.31) because Rhino
can't dynamically pull in dependencies
7. Add source-map to the Rhino build with a Header/Footer that wraps
source-map as a less-friendly dependency
8. Update lib/less/rhino.js to properly handle (some) source-map options
and add a new one (--source-map-output-map-file) that will output the
source-map to a separate file (so we can validate our Rhino tests)
9. Remove unused callback in less-test.js
2014-01-13 23:39:52 -05:00

35 lines
1.8 KiB
JavaScript

var lessTest = require("./less-test"),
lessTester = lessTest(),
path = require("path"),
stylize = require('../lib/less/lessc_helper').stylize;
function getErrorPathReplacementFunction(dir) {
return function(input) {
return input.replace(
"{path}", path.join(process.cwd(), "/test/less/" + dir + "/"))
.replace("{pathrel}", path.join("test", "less", dir + "/"))
.replace("{pathhref}", "")
.replace("{404status}", "")
.replace(/\r\n/g, '\n');
};
}
console.log("\n" + stylize("LESS", 'underline') + "\n");
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({}, "legacy/");
lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true }, "sourcemaps/",
lessTester.testSourcemap, null, null);
lessTester.testNoOptions();