Skip to content

Commit

Permalink
Add new test for sourcemap
Browse files Browse the repository at this point in the history
  • Loading branch information
tavriaforever committed Jul 14, 2015
1 parent 3621b96 commit 6175f03
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion test/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"bitwise": true,
"curly": true,
"eqeqeq": true,
"es3": true,
"forin": true,
"freeze": true,
"immed": true,
Expand Down
2 changes: 1 addition & 1 deletion test/lib/mock-fs-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = {
readFile: function (filename) {
var ext = path.extname(filename);

if (~['.gif', '.png', '.jpg', '.jpeg', '.svg'].indexOf(ext)) {
if (['.gif', '.png', '.jpg', '.jpeg', '.svg'].indexOf(ext) !== -1) {
return fs.readFileSync(filename);
}

Expand Down
13 changes: 7 additions & 6 deletions test/stylus-native-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ addSuite('cases', readDir(stylusDir + '/cases', '.styl'), function (test, done)
node.runTechAndGetContent(
StylusTech, {
includes: ['./images', './cases/import.basic'],
compress: ~test.indexOf('compress'),
prefix: ~test.indexOf('prefix.') && 'prefix-',
hoist: ~test.indexOf('hoist.') || ~test.indexOf('rule.charset'),
compress: test.indexOf('compress') !== -1,
prefix: test.indexOf('prefix.') !== -1 && 'prefix-',
hoist: test.indexOf('hoist.') !== -1 || test.indexOf('rule.charset') !== -1,

// non stylus option
comments: false,
imports: (~test.indexOf('include') || ~test.indexOf('import.include.resolver.css-file')) && 'include',
url: (~test.indexOf('resolver') && 'rebase') || ~test.indexOf('functions.url') && 'inline'
imports: (test.indexOf('include') !== -1 || test.indexOf('import.include.resolver.css-file') !== -1) &&
'include',
url: (test.indexOf('resolver') !== -1 && 'rebase') || test.indexOf('functions.url') !== -1 && 'inline'
}
)
.spread(function (source) {
Expand Down Expand Up @@ -133,7 +134,7 @@ function readDir(dir, ext) {

return fs.readdirSync(dir)
.filter(function (file) {
return ~file.indexOf(ext);
return file.indexOf(ext) !== -1;
})
.map(function (file) {
return file.replace(ext, '');
Expand Down
2 changes: 1 addition & 1 deletion test/stylus-tech.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ describe('stylus-tech', function () {
return build(scheme, { sourcemap: true }).then(function (actual) {
var isMapExists = fs.existsSync('./bundle/bundle.css.map');

actual.must.equal('body{color:#000;}/*#sourceMappingURL=bundle.css.map*/');
isMapExists.must.be.true();
actual.must.equal('body{color:#000;}/*#sourceMappingURL=bundle.css.map*/');
});
});

Expand Down

0 comments on commit 6175f03

Please sign in to comment.