Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Verb
in command line:
# ruby gem
gem install true
# bower package
bower install true
# npm module
npm install sass-true
@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;
Install true
via npm (npm install sass-true
).
Write some Sass tests in test/test.scss
(see above).
Write a shim JS test file in test/test_sass.js
:
var path = require('path');
var true = require('sass-true');
var sassFile = path.join(__dirname, 'test.scss');
true.runSass({file: sassFile}, describe, it);
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
.
true-cli [options] PATH
Options:
-s
silent-c
config file-d
debug config file settingsConfig file (optional):
options:
color: true # enables colored output
# require ruby sass extension libraries
require:
- "compass"
- "serialy_sassy"
default location: test/true.yml
There is only one setting:
$true-terminal-output
toggles output to the terminal on or off.
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.2.0.2 (5/13/15)
FAQs
Unit testing for Sass.
The npm package sass-true receives a total of 10,066 weekly downloads. As such, sass-true popularity was classified as popular.
We found that sass-true demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.