tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 194 forks source link

Lack of support for files #176

Closed maboiteaspam closed 9 years ago

maboiteaspam commented 10 years ago

Hello,

I m wondering if there s a nicer way to handle file existence tests.

As of today, i do things like this

grunt.file.exists('some/file').should.be.eql(true,'description');

Do you have better way ? I did not find.

So I was thinking some helpers might be missing

('some/file').should.be.a_file;
('some/path/').should.be.a_directory;

We could also extends it to check for mime types, in the same manner of res.should.be.json

('some/file').should.be.json_file;
('some/file').should.be.html_file;

Maybe i could write some extensions ? I did not yet read the sources and documentation is not epensive about extending that s great lib.

Any suggestions ?

Thanks

btd commented 10 years ago

No, currently in should.js there is no anything specific for fs assertions (so, PR are welcome). But you should know that it is a bit harder than looks from first look: async/sync assertions, good names etc.

maboiteaspam commented 10 years ago

Hm. Yes i would not doubt about naming convention. Maybe you could just give some thaughts when you have some times and wishes to do so. Thus i could maybe provide a workable PR.

However, I did not clearly get you concerns regarding async operations.