Skip to content

Commit 9479465

Browse files
committed
v2.0.2
2 parents cac347b + 1ca36ae commit 9479465

File tree

215 files changed

+1180
-1741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+1180
-1741
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
lib-cov
12
node_modules
3+
test/test-coverage.html
24

35
.idea
46
*.iml

.jscs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"excludeFiles": [
3-
"node_modules/**"
3+
"node_modules/**",
4+
"lib-cov/**"
45
],
56
"requireCurlyBraces": [
67
"else",

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 2.0.2 - 2014-01-09
4+
- Added test coverage (#138)
5+
- Added test helpers (#147)
6+
- Fixed config file recursive searching (#151)
7+
- Fixed `block-indent` detecting (#148)
8+
- Fixed `quote` value setter (#149)
9+
- Fixed detection integral tests (#150)
10+
311
## 2.0.1 - 2013-12-23
412
- Fix for `remove-empty-rulesets` option (#133)
513

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,14 @@ a
721721
722722
Run `npm test` for tests.
723723
724+
To check test coverage, you need `jscoverage` tool.
725+
Once it is installed ([see instructions here](https://github.com/visionmedia/node-jscoverage#installation)), run:
726+
727+
```
728+
npm run-script test-cov
729+
open ./test/test-coverage.html
730+
```
731+
724732
## Contributing
725733
726734
Anyone and everyone is welcome to contribute. Please take a moment to

lib/cli.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,26 @@ function getConfigPath(configPath) {
3434
var HOME = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
3535
// Since `process.cwd()` can be absolutely anything, build default path
3636
// relative to current directory:
37-
var defaultConfigPath = __dirname + '/../config/csscomb.json';
37+
var defaultConfigPath = path.join(__dirname, '../config/csscomb.json');
3838

39-
configPath = configPath || process.cwd() + '/.csscomb.json';
39+
configPath = configPath || path.join(process.cwd(), '.csscomb.json');
4040

4141
// If we've finally found a config, return its path:
4242
if (fs.existsSync(configPath)) return configPath;
4343

4444
// If we are in HOME dir already and yet no config file, return a default
45-
// one from our package:
46-
if (path.dirname(configPath) === HOME) return defaultConfigPath;
45+
// one from our package.
46+
// If project is located not under HOME, compare to root instead.
47+
// Since there appears to be no good way to get root path in
48+
// Windows, assume that if current dir has no parent dir, we're in
49+
// root.
50+
var dirname = path.dirname(configPath);
51+
var parentDirname = path.dirname(dirname);
52+
if (dirname === HOME || dirname === parentDirname) return defaultConfigPath;
4753

4854
// If there is no config in this directory, go one level up and look for
4955
// a config there:
50-
configPath = path.dirname(path.dirname(configPath)) + '/.csscomb.json';
56+
configPath = path.join(parentDirname, '.csscomb.json');
5157
return getConfigPath(configPath);
5258
}
5359

lib/options/block-indent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = {
8383
detect: function(nodeType, node, level) {
8484
var result = null;
8585
if (nodeType === 'atrulers' || nodeType === 'block') {
86-
if (node[node.length - 1][0] === 's' && level > 0) {
86+
if (node.length && node[node.length - 1][0] === 's' && level > 0) {
8787
result = node[node.length - 1][1].replace(/\s*\n/g, '');
8888

8989
if (this._prev !== undefined && this._prev[0] < level) {

lib/options/quotes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module.exports = {
77
* @returns {Object|undefined}
88
*/
99
setValue: function(value) {
10+
delete this._value;
11+
1012
if (value === 'single' || value === 'double' ) {
1113
this._value = value;
1214
}

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "csscomb",
33
"description": "CSS coding style formatter",
4-
"version": "2.0.1",
4+
"version": "2.0.2",
55
"homepage": "http://csscomb.com/",
66
"author": "Mikhail Troshev <mishanga@yandex-team.ru>",
77
"repository": "https://github.com/csscomb/csscomb.js",
@@ -45,7 +45,7 @@
4545
},
4646
"dependencies": {
4747
"commander": "2.0.0",
48-
"gonzales-pe": "2.0.1",
48+
"gonzales-pe": "2.0.x",
4949
"minimatch": "0.2.12",
5050
"vow": "0.3.11",
5151
"vow-fs": "0.2.3"
@@ -61,6 +61,7 @@
6161
"csscomb": "./bin/csscomb"
6262
},
6363
"scripts": {
64-
"test": "./node_modules/.bin/jshint-groups && ./node_modules/.bin/jscs . && ./node_modules/.bin/mocha -u bdd -R dot"
64+
"test": "./node_modules/.bin/jshint-groups && ./node_modules/.bin/jscs . && node test/mocha",
65+
"test-cov": "rm -rf lib-cov && jscoverage lib lib-cov && TEST_COV=true node test/mocha > ./test/test-coverage.html"
6566
}
6667
}

test/always-semicolon-less.js

Lines changed: 0 additions & 100 deletions
This file was deleted.

test/always-semicolon-scss.js

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)