Skip to content

Commit 13f4101

Browse files
committed
move the tester into a seperate module so it can be used by other projects
1 parent 3b242da commit 13f4101

File tree

3 files changed

+250
-236
lines changed

3 files changed

+250
-236
lines changed

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = function(grunt) {
2929
shell: {
3030
options: {stdout: true, failOnError: true},
3131
test: {
32-
command: 'node test/less-test.js'
32+
command: 'node test'
3333
},
3434
benchmark: {
3535
command: 'node benchmark/less-benchmark.js'

test/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
var lessTest = require("./less-test"),
2+
lessTester = lessTest(),
3+
path = require("path"),
4+
stylize = require('../lib/less/lessc_helper').stylize;
5+
6+
function getErrorPathReplacementFunction(dir) {
7+
return function(input) {
8+
return input.replace(
9+
"{path}", path.join(process.cwd(), "/test/less/" + dir + "/"))
10+
.replace("{pathrel}", path.join("test", "less", dir + "/"))
11+
.replace("{pathhref}", "")
12+
.replace("{404status}", "")
13+
.replace(/\r\n/g, '\n');
14+
};
15+
}
16+
17+
console.log("\n" + stylize("LESS", 'underline') + "\n");
18+
19+
lessTester.runTestSet({strictMath: true, relativeUrls: true, silent: true});
20+
lessTester.runTestSet({strictMath: true, strictUnits: true}, "errors/",
21+
lessTester.testErrors, null, getErrorPathReplacementFunction("errors"));
22+
lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/",
23+
lessTester.testErrors, null, getErrorPathReplacementFunction("no-js-errors"));
24+
lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null,
25+
function(name) { return name + '-comments'; });
26+
lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null,
27+
function(name) { return name + '-mediaquery'; });
28+
lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'all'}, "debug/", null,
29+
function(name) { return name + '-all'; });
30+
lessTester.runTestSet({strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/");
31+
lessTester.runTestSet({strictMath: true, compress: true}, "compression/");
32+
lessTester.runTestSet({}, "legacy/");
33+
lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true }, "sourcemaps/",
34+
lessTester.testSourcemap, null, null, function(filename) { return path.join('test/sourcemaps', filename) + '.json'; });
35+
36+
lessTester.testNoOptions();

0 commit comments

Comments
 (0)