1 | var path = require('path'), |
---|
2 | fs = require('fs'), |
---|
3 | sys = require('util'); |
---|
4 | |
---|
5 | var createTestRunnerPage = function(dir, exclude, testSuiteName, dir2) { |
---|
6 | var output = '<html><head>\n'; |
---|
7 | |
---|
8 | fs.readdirSync(path.join("test", dir, 'less', dir2 || "")).forEach(function (file) { |
---|
9 | if (! /\.less/.test(file)) { return; } |
---|
10 | |
---|
11 | var name = path.basename(file, '.less'), |
---|
12 | id = (dir ? dir + '-' : "") + 'less-' + (dir2 ? dir2 + "-" : "") + name; |
---|
13 | |
---|
14 | if (exclude && name.match(exclude)) { return; } |
---|
15 | |
---|
16 | output += '<link id="original-less:' + id + '" rel="stylesheet/less" type="text/css" href="http://localhost:8081/' + path.join(dir, 'less', dir2 || "", name) + '.less' +'">\n'; |
---|
17 | output += '<link id="expected-less:' + id + '" rel="stylesheet" type="text/css" href="http://localhost:8081/' + path.join(dir, 'css', dir2 || "", name) + '.css' + '">\n'; |
---|
18 | }); |
---|
19 | |
---|
20 | output += String(fs.readFileSync(path.join('test/browser', 'template.htm'))).replace("{runner-name}", testSuiteName); |
---|
21 | |
---|
22 | fs.writeFileSync(path.join('test/browser', 'test-runner-'+testSuiteName+'.htm'), output); |
---|
23 | }; |
---|
24 | |
---|
25 | createTestRunnerPage("", /javascript|urls/, "main"); |
---|
26 | createTestRunnerPage("browser", null, "browser"); |
---|
27 | createTestRunnerPage("browser", null, "relative-urls", "relative-urls"); |
---|
28 | createTestRunnerPage("browser", null, "rootpath", "rootpath"); |
---|
29 | createTestRunnerPage("browser", null, "rootpath-relative", "rootpath-relative"); |
---|