sassy-test
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,2 +0,2 @@ | ||
# sassy-test API<br><small>version: `1.0.1`</small> | ||
# sassy-test API<br><small>version: `1.1.0`</small> | ||
@@ -3,0 +3,0 @@ This is the JavaScript API documentation for the sassy-test software. [The code |
@@ -94,2 +94,6 @@ 'use strict'; | ||
* proper sourcemap options) | ||
* - Captures messages generated with `@warn` and puts them in an array stored | ||
* in render.warn. | ||
* - Captures messages generated with `@debug` and puts them in an array | ||
* stored in render.debug. | ||
* | ||
@@ -125,2 +129,4 @@ * ``` | ||
try { | ||
var warn = [], | ||
debug = []; | ||
options.includePaths = options.includePaths || []; | ||
@@ -133,2 +139,12 @@ // Add the test fixtures directory. | ||
} | ||
options.functions = { | ||
'@warn': function(message) { | ||
warn.push(message.getValue()); | ||
return sass.NULL; | ||
}, | ||
'@debug': function(message) { | ||
debug.push(message.getValue()); | ||
return sass.NULL; | ||
} | ||
}; | ||
@@ -144,2 +160,4 @@ // Run node-sass' render(). | ||
} | ||
result.warn = warn; | ||
result.debug = debug; | ||
} | ||
@@ -146,0 +164,0 @@ callback(error, result); |
{ | ||
"name": "sassy-test", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/JohnAlbin/sassy-test", | ||
@@ -5,0 +5,0 @@ "author": "John Albin Wilkins <virtually.johnalbin@gmail.com> (http://john.albin.net/)", |
@@ -32,3 +32,6 @@ [![Build Status](https://secure.travis-ci.org/JohnAlbin/sassy-test.png?branch=master)](http://travis-ci.org/JohnAlbin/sassy-test) [![Coverage Status](https://coveralls.io/repos/JohnAlbin/sassy-test/badge.svg?branch=master&service=github)](https://coveralls.io/github/JohnAlbin/sassy-test?branch=master) | ||
│ │ └── output.css | ||
│ └─┬ my-modules-error/ | ||
│ ├─┬ my-modules-error/ | ||
│ │ ├── input.scss | ||
│ │ └── output.css | ||
│ └─┬ my-modules-warn/ | ||
│ ├── input.scss | ||
@@ -81,3 +84,3 @@ │ └── output.css | ||
// and node-sass's result object are available. | ||
if (error) throw error; | ||
should.not.exist(error); | ||
done(); | ||
@@ -99,2 +102,17 @@ }); | ||
}); | ||
it('should warn in another situation', function(done) { | ||
// Sassy Test's renderFixture() can also test if your module produces an | ||
// intentional warning message with Sass' @warn directive. | ||
sassyTest.renderFixture('my-modules-warn', {}, function(error, result, expectedOutput) { | ||
// If the Sass in test/fixtures/my-modules-warn/input.scss triggers a | ||
// @warn in your module, you should expect the result object to exist | ||
// and to contain the warn message from your module. | ||
should.not.exist(error); | ||
// Sassy Test adds two new arrays to node-sass' result object: | ||
// result.warn and result.debug are arrays of strings. | ||
result.warn[0].should.equal('Some helpful warning from your module.'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -101,0 +119,0 @@ }); |
@@ -148,2 +148,6 @@ 'use strict'; | ||
result.css.should.be.object; | ||
result.should.have.property('warn'); | ||
result.warn.should.be.array; | ||
result.should.have.property('debug'); | ||
result.debug.should.be.array; | ||
done(); | ||
@@ -192,2 +196,22 @@ }); | ||
}); | ||
it('should capture @warn messages', function(done) { | ||
sassyTest.render({ | ||
file: sassyTest.fixture('render/some-warn.scss') | ||
}, function(error, result) { | ||
should.not.exist(error); | ||
result.warn[0].should.equal('render() test warning'); | ||
done(); | ||
}); | ||
}); | ||
it('should capture @debug messages', function(done) { | ||
sassyTest.render({ | ||
file: sassyTest.fixture('render/some-debug.scss') | ||
}, function(error, result) { | ||
should.not.exist(error); | ||
result.debug[0].should.equal('render() test debug'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -194,0 +218,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1101542
56
1153
130