Comparing version 2.0.0-beta.1 to 2.0.0
{ | ||
"name": "true", | ||
"version": "2.0.0.beta.1", | ||
"version": "2.0.0", | ||
"main": "sass/_true.scss", | ||
@@ -5,0 +5,0 @@ "description": "Unit testing for Sass.", |
True Changelog | ||
============== | ||
2.0 (unreleased) | ||
---------------- | ||
2.0 (5/9/15) | ||
------------ | ||
- Improve internal logic, and namespace private functions behind `_true-*`. | ||
@@ -12,3 +12,2 @@ - Add `assert()`, `input`, and `expect` mixins for testing CSS output. | ||
- Simplify output options down to single `$true-terminal-output` setting. | ||
Defaults to `false` (required for libsass). | ||
@@ -15,0 +14,0 @@ |
var _ = require('underscore'); | ||
var parseCss = require('css').parse; | ||
var path = require('path'); | ||
var sass = require('node-sass'); | ||
@@ -13,3 +14,9 @@ var CssSelectorParser = require('css-selector-parser').CssSelectorParser; | ||
var assert = require('assert'); | ||
var css = sass.renderSync(options); | ||
var sassPath = path.join(__dirname, '..', 'sass'); | ||
if (options.includePaths) { | ||
options.includePaths.push(sassPath); | ||
} else { | ||
options.includePaths = [sassPath]; | ||
} | ||
var css = sass.renderSync(options).css.toString(); | ||
var modules = parse(css); | ||
@@ -16,0 +23,0 @@ |
{ | ||
"name": "sass-true", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0", | ||
"description": "Unit testing for Sass.", | ||
@@ -19,5 +19,5 @@ "homepage": "http://ericsuzanne.com/true", | ||
"dependencies": { | ||
"node-sass": "~1.2.0", | ||
"css": "~2.1.0", | ||
"css-selector-parser": "~1.0.0", | ||
"node-sass": "^3.0.0", | ||
"underscore": "~1.7.0" | ||
@@ -24,0 +24,0 @@ }, |
124
README.md
@@ -15,7 +15,3 @@ True | ||
At this point | ||
True can only test values (e.g. function returns), | ||
not property/value output (e.g. mixin output). | ||
Install | ||
@@ -32,11 +28,81 @@ ------- | ||
bower install true | ||
# npm module | ||
npm install sass-true | ||
``` | ||
Usage | ||
----- | ||
Command Line | ||
------------ | ||
### In Sass | ||
_This command-line tool uses Ruby | ||
and the Ruby Sass compiler._ | ||
```scss | ||
@import "true"; | ||
@include test-module('Utilities') { | ||
// Testing Functions | ||
@include test('Map Add [function]') { | ||
$base: (one: 1, two: 1, three: 1); | ||
$add: (one: 1, two: 2, three: -1); | ||
$test: map-add($base, $add); | ||
$expect: (one: 2, two: 3, three: 0); | ||
@include assert-equal($test, $expect, | ||
'Returns the sum of two numeric maps'); | ||
} | ||
// Testing Mixins | ||
@include test('Font Size [mixin]') { | ||
@include assert('Outputs a font size and line height based on keyword.') { | ||
@include input { | ||
@include font-size(large); | ||
} | ||
@include expect { | ||
font-size: 2rem; | ||
line-height: 3rem; | ||
} | ||
} | ||
} | ||
} | ||
// Optionally show summary report in CSS and/or the command line: | ||
// - If you use Mocha, reporting to the command line is automatic. | ||
// - if you use true-cli, report(terminal) is required for output. | ||
@include report; | ||
``` | ||
### With node-sass and Mocha (or other JS test runners) | ||
1. Install `true` via npm (`npm install sass-true`). | ||
2. Write some Sass tests in `test/test.scss` (see above). | ||
3. Write a shim JS test file in `test/test_sass.js`: | ||
```js | ||
var path = require('path'); | ||
var true = require('sass-true'); | ||
var sassFile = path.join(__dirname, 'test.scss'); | ||
true.runSass({file: sassFile}, describe, it); | ||
``` | ||
4. Run Mocha, and see your Sass tests reported as individual test results. | ||
You can call `runSass` more than once, if you have multiple Sass test files you | ||
want to run separately. | ||
The first argument to `runSass` accepts the same options that node-sass' | ||
`renderSync` function accepts. The only modification `runSass` makes is to add | ||
True's sass path to the `includePaths` option, so `@import 'true';` works in | ||
your Sass test file. | ||
Any other JS test runner with equivalents to Mocha's `describe` and `it` should | ||
be usable in the same way; just pass your test runner's `describe` and `it` | ||
equivalents into `runSass`. | ||
### With ruby-sass on the command line | ||
```bash | ||
@@ -55,3 +121,3 @@ true-cli [options] PATH | ||
options: | ||
color: true #enables colored output | ||
color: true # enables colored output | ||
@@ -67,34 +133,2 @@ # require ruby sass extension libraries | ||
Usage | ||
----- | ||
```scss | ||
@import "true"; | ||
@include test-module('Utilities') { | ||
@include test('Map Add [function]') { | ||
$base: (one: 1, two: 1, three: 1); | ||
$add: (one: 1, two: 2, three: -1); | ||
$test: map-add($base, $add); | ||
$expect: (one: 2, two: 3, three: 0); | ||
@include assert-equal($test, $expect, | ||
'Returns the sum of two numeric maps'); | ||
} | ||
@include test('Is Equal [function]') { | ||
$test: is-equal(1, 1rem); | ||
@include assert-equal($test, false, | ||
'Returns false for equal numbers with different units.'); | ||
$test: is-equal(1, 1); | ||
@include assert-equal($test, true, | ||
'Returns true for numbers that are truely equal.'); | ||
} | ||
} | ||
@include report; | ||
``` | ||
Settings | ||
@@ -105,8 +139,6 @@ -------- | ||
`$true-terminal-output` | ||
toggles output to the terminal on and off. | ||
toggles output to the terminal on or off. | ||
- `true` will display a final summary of your test results in the terminal, | ||
and show detailed information on failing assertions. | ||
*Required for `true-cli`.* | ||
- `true` will show detailed information on failing assertions. | ||
This is the default, and best for using `true-cli`. | ||
- `false` to turn off all terminal output. | ||
*Required for Libsass.* |
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
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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
163431
54
555
1
140
+ Addedabbrev@1.1.1(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedaproba@1.2.0(transitive)
+ Addedare-we-there-yet@1.1.7(transitive)
+ Addedarray-find-index@1.0.2(transitive)
+ Addedasync-foreach@0.1.3(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedblock-stream@0.0.9(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedcamelcase@2.1.13.0.0(transitive)
+ Addedcamelcase-keys@2.1.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcliui@3.2.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconsole-control-strings@1.1.0(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcross-spawn@3.0.1(transitive)
+ Addedcurrently-unhandled@0.4.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddelegates@1.0.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedfind-up@1.1.2(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfstream@1.0.12(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgauge@2.7.4(transitive)
+ Addedgaze@1.1.3(transitive)
+ Addedget-caller-file@1.0.3(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedglob@7.1.77.2.3(transitive)
+ Addedglobule@1.3.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-unicode@2.0.1(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedin-publish@2.0.1(transitive)
+ Addedindent-string@2.1.0(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinvert-kv@1.0.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedis-utf8@0.2.1(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjs-base64@2.6.4(transitive)
+ Addedlcid@1.0.0(transitive)
+ Addedload-json-file@1.1.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlodash.assign@4.2.0(transitive)
+ Addedlodash.clonedeep@4.5.0(transitive)
+ Addedloud-rejection@1.6.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedmeow@3.7.0(transitive)
+ Addedminimatch@3.0.83.1.2(transitive)
+ Addednan@2.22.0(transitive)
+ Addednode-gyp@3.8.0(transitive)
+ Addednode-sass@3.13.1(transitive)
+ Addednopt@3.0.6(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addednpmlog@4.1.2(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-locale@1.4.0(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedosenv@0.1.5(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpath-exists@2.1.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@1.1.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedread-pkg@1.1.0(transitive)
+ Addedread-pkg-up@1.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedredent@1.0.0(transitive)
+ Addedrepeating@2.0.1(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@1.0.1(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsass-graph@2.2.6(transitive)
+ Addedscss-tokenizer@0.2.3(transitive)
+ Addedsemver@5.3.0(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsource-map@0.4.4(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.21(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-bom@2.0.0(transitive)
+ Addedstrip-indent@1.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtar@2.2.2(transitive)
+ Addedtrim-newlines@1.0.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwhich-module@1.0.0(transitive)
+ Addedwide-align@1.1.5(transitive)
+ Addedwrap-ansi@2.1.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedy18n@3.2.2(transitive)
+ Addedyallist@2.1.2(transitive)
+ Addedyargs@7.1.2(transitive)
+ Addedyargs-parser@5.0.1(transitive)
- Removedansi-regex@0.2.1(transitive)
- Removedansi-styles@1.1.0(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcamelcase-keys@1.0.0(transitive)
- Removedchalk@0.5.1(transitive)
- Removedcommander@0.6.12.3.0(transitive)
- Removedcross-spawn@0.2.9(transitive)
- Removeddebug@2.2.0(transitive)
- Removeddiff@1.4.0(transitive)
- Removedescape-string-regexp@1.0.2(transitive)
- Removedgaze@0.5.2(transitive)
- Removedget-stdin@3.0.2(transitive)
- Removedglob@3.1.213.2.11(transitive)
- Removedglobule@0.1.0(transitive)
- Removedgraceful-fs@1.2.3(transitive)
- Removedgrowl@1.9.2(transitive)
- Removedhas-ansi@0.1.0(transitive)
- Removedindent-string@1.2.2(transitive)
- Removedinherits@1.0.2(transitive)
- Removedjade@0.26.3(transitive)
- Removedlodash@1.0.2(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedmeow@2.1.0(transitive)
- Removedminimatch@0.2.140.3.0(transitive)
- Removedminimist@0.0.8(transitive)
- Removedmkdirp@0.3.00.5.1(transitive)
- Removedmocha@2.5.3(transitive)
- Removedms@0.7.1(transitive)
- Removednan@1.9.0(transitive)
- Removednode-sass@1.2.3(transitive)
- Removedobject-assign@1.0.02.1.1(transitive)
- Removedrepeating@1.1.3(transitive)
- Removedreplace-ext@0.0.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedshelljs@0.3.0(transitive)
- Removedsigmund@1.0.1(transitive)
- Removedstrip-ansi@0.3.0(transitive)
- Removedsupports-color@0.2.01.2.0(transitive)
- Removedto-iso-string@0.0.2(transitive)
Updatednode-sass@^3.0.0