diff --git a/test/browser-test-prepare.js b/test/browser-test-prepare.js index a1b0e5cc..86562fc0 100644 --- a/test/browser-test-prepare.js +++ b/test/browser-test-prepare.js @@ -26,4 +26,5 @@ createTestRunnerPage("", /javascript|urls/, "main"); createTestRunnerPage("browser", null, "browser"); createTestRunnerPage("browser", null, "relative-urls", "relative-urls"); createTestRunnerPage("browser", null, "rootpath", "rootpath"); -createTestRunnerPage("browser", null, "rootpath-relative", "rootpath-relative"); \ No newline at end of file +createTestRunnerPage("browser", null, "rootpath-relative", "rootpath-relative"); +createTestRunnerPage("browser", null, "production"); \ No newline at end of file diff --git a/test/browser/common.js b/test/browser/common.js index 1c0c0afc..d325ce5c 100644 --- a/test/browser/common.js +++ b/test/browser/common.js @@ -1,6 +1,14 @@ /*if not async then phantomjs fails to run the webserver and the test concurrently*/ var less = { async: true }; +/* record log messages for testing */ +var logMessages = [], + realConsoleLog = console.log; +console.log = function(msg) { + logMessages.push(msg); + realConsoleLog.call(console, msg); +}; + var testLessEqualsInDocument = function() { var links = document.getElementsByTagName('link'), typePattern = /^text\/(x-)?less$/; diff --git a/test/browser/runner-browser.js b/test/browser/runner-browser.js index 54419daa..79c5e1c9 100644 --- a/test/browser/runner-browser.js +++ b/test/browser/runner-browser.js @@ -1,3 +1,7 @@ -describe("less.js browser tests", function() { +describe("less.js browser behaviour", function() { testLessEqualsInDocument(); + + it("has some log messages", function() { + expect(logMessages.length).toBeGreaterThan(0); + }); }); \ No newline at end of file diff --git a/test/browser/runner-production.js b/test/browser/runner-production.js new file mode 100644 index 00000000..94c0c8da --- /dev/null +++ b/test/browser/runner-production.js @@ -0,0 +1,7 @@ +less.env = "production"; + +describe("less.js production behaviour", function() { + it("doesn't log any messages", function() { + expect(logMessages.length).toEqual(0); + }); +}); \ No newline at end of file