Conversation
|
Can you write some tests on it? |
|
I wrote tests for our public methods: I have no idea how to test promises with mocha and without callbacks, so I used Tests for |
There was a problem hiding this comment.
Тут странный индент. И у свойств тоже.
There was a problem hiding this comment.
@mishanga, I know.
The way beautifiers work with scss and less should be improved, but it should be done in another branch.
I'll open another PR once it's ready.
Let's focus on this one.
The only purpose of this branch is to fix syntax detecting, nothing else.
|
@anton-rudeshko can you help us with tests? |
|
@mishanga I'll look at this pr later this night. |
|
@tonyganch, could you please tell me what do you want to test here? I can't figure it out from sources. |
|
@anton-rudeshko, there is a Since all those methods are async, I added |
|
@tonyganch, okay it's clear. But your PR is about "Fixing syntax detection" and here you're trying to test the whole app end-to-end. This is slightly more than just syntax detection I think =) Why is that? |
|
For example: if csscomb.js eventually will start supporting SCSS and someone will change the way beautifiers work with it, your tests about "Syntax detection" will fail. |
|
@anton-rudeshko, ah, maybe I've overreacted :) I need to check if function can take a path like |
|
@anton-rudeshko, answering "Why is that": #99. |
|
I actually suggest you to extract your syntax check to method (private, I suppose) and test it synchronously. |
|
@anton-rudeshko, so you suggest that I move this line: if (_this.SUPPORTED_SYNTAXES.indexOf(syntax) < 0)to a private method?
Any links to documentation, please? @mishanga, I don't want to suggest skipping tests for this pr and make everything as @anton-rudeshko wants it to be in another branch, but it starts to look too complicated for a "small" fix to me. @anton-rudeshko, maybe you will be interested in those issues, too: #89, #90. P.S. BTW thank you. |
|
@tonyganch // TODO: Move extension check into `_shouldProcess` methodThat would be enough to write unit tests just for this check. I mean comb[method](tempDir + file).always(function() {
// check
done();
});After all I said @mishanga is still the owner of the project, so he is in charge to make decisions =) |
|
@anton-rudeshko, wow, that's more clear, thank you! The thing that makes me hesitate about So, after all, will the following changes satisfy anyone?
if (_this._shouldProcess(fullname)) {
return vfs.stat(fullname).then(function(stat) {
if (stat.isDirectory()) {
return _this.processDirectory(fullname);
} else if (fullname.match(/\.css$/)) {
return vow.when(_this.processFile(fullname)).then(function(errors) {
if (errors) return errors;
});
}
});
}with something like this: return vfs.stat(fullname).then(function(stat) {
if (stat.isDirectory()) {
return _this.shouldProcessDirectory(fullname) && _this.processDirectory(fullname);
} else {
return vow.when(_this.processFile(fullname)).then(function(errors) {
if (errors) return errors;
});
}
});And this ( if (this._shouldProcess(path) && path.match(/\.[css, scss]$/)) {with this: if (this._shouldProcessFile(path)) {
|
=) Thanks |
Get file's extension and check if it's present in a list of supported syntaxes. If not, ignore the file.
|
Done. @anton-rudeshko, thanks a lot! |
|
@tonyganch, looks much better and simpler now =) Thank you for your patience. |
|
@mishanga, ping |

Get file's extension and check if it's present in a list of supported syntaxes.
If not, print an error.