[Pkg-javascript-commits] [less.js] 28/58: Make copy of options before each test set.

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:28:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.3.0
in repository less.js.

commit 023dd62c88d82741a265995e6cd91d37931bceb5
Author: shaun <shaun at prointegrations.com>
Date:   Wed Jan 14 08:26:39 2015 -0800

    Make copy of options before each test set.
    
    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.
---
 lib/less/functions/data-uri.js |  2 +-
 test/index.js                  |  2 +-
 test/less-test.js              | 11 ++++++-----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/less/functions/data-uri.js b/lib/less/functions/data-uri.js
index ad75d97..798b5a7 100644
--- a/lib/less/functions/data-uri.js
+++ b/lib/less/functions/data-uri.js
@@ -54,7 +54,7 @@ module.exports = function(environment) {
 
         var fileSync = fileManager.loadFileSync(filePath, currentDirectory, this.context, environment);
         if (!fileSync.contents) {
-            logger.warn("Skipped data-uri embedding because file not found");
+            logger.warn("Skipped data-uri embedding of " + filePath + " because file not found");
             return fallback(this, filePathNode || mimetypeNode);
         }
         var buf = fileSync.contents;
diff --git a/test/index.js b/test/index.js
index 33e9cb8..7ae1560 100644
--- a/test/index.js
+++ b/test/index.js
@@ -32,7 +32,7 @@ lessTester.runTestSet({strictMath: true, relativeUrls: false, rootpath: "folder
 lessTester.runTestSet({strictMath: true, compress: true}, "compression/");
 lessTester.runTestSet({strictMath: true, strictUnits: true}, "strict-units/");
 lessTester.runTestSet({}, "legacy/");
-lessTester.runTestSetNormalOnly({strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/",
+lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/",
     lessTester.testSourcemap, null, null,
     function(filename, type, baseFolder) {
         if (type === "vars") {
diff --git a/test/less-test.js b/test/less-test.js
index 09b7e06..e9d41a6 100644
--- a/test/less-test.js
+++ b/test/less-test.js
@@ -71,9 +71,9 @@ module.exports = function() {
         }
     });
 
-    function testSourcemap(name, err, compiledLess, doReplacements, sourcemap) {
+    function testSourcemap(name, err, compiledLess, doReplacements, sourcemap, baseFolder) {
         fs.readFile(path.join('test/', name) + '.json', 'utf8', function (e, expectedSourcemap) {
-            process.stdout.write("- " + name + ": ");
+            process.stdout.write("- " + path.join(baseFolder, name) + ": ");
             if (sourcemap === expectedSourcemap) {
                 ok('OK');
             } else if (err) {
@@ -90,7 +90,7 @@ module.exports = function() {
 
     function testErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) {
         fs.readFile(path.join(baseFolder, name) + '.txt', 'utf8', function (e, expectedErr) {
-            process.stdout.write("- " + name + ": ");
+            process.stdout.write("- " + path.join(baseFolder, name) + ": ");
             expectedErr = doReplacements(expectedErr, baseFolder);
             if (!err) {
                 if (compiledLess) {
@@ -155,8 +155,9 @@ module.exports = function() {
     }
 
     function runTestSet(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
+        var options2 = options ? JSON.parse(JSON.stringify(options)) : {};
         runTestSetInternal(normalFolder, options, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
-        runTestSetInternal(bomFolder, options, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
+        runTestSetInternal(bomFolder, options2, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
     }
 
     function runTestSetNormalOnly(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
@@ -226,7 +227,7 @@ module.exports = function() {
                 var css_name = name;
                 if(nameModifier) { css_name = nameModifier(name); }
                 fs.readFile(path.join('test/css', css_name) + '.css', 'utf8', function (e, css) {
-                    process.stdout.write("- " + css_name + ": ");
+                    process.stdout.write("- " + path.join(baseFolder, css_name) + ": ");
 
                         css = css && doReplacements(css, path.join(baseFolder, foldername));
                     if (result.css === css) { ok('OK'); }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list