Skip to content

Commit

Permalink
Merge pull request #21 from stevelacy/master
Browse files Browse the repository at this point in the history
Close #17 & add test
  • Loading branch information
emgeee committed Aug 24, 2016
2 parents 2e226f4 + 03123df commit 8ff01a2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ $ npm install --save-dev gulp-standard

```javascript
// include the required packages.
var gulp = require('gulp'),
standard = require('gulp-standard')
var gulp = require('gulp')
var standard = require('gulp-standard')

gulp.task('standard', function () {
return gulp.src(['./app.js'])
Expand All @@ -62,13 +62,13 @@ External

You can also use some other custom made reporter
````javascript
var reporter = require(<SOME_REPORTER>);
var reporter = require(<SOME_REPORTER>)

stuff
.pipe(standard())
.pipe(standard.reporter(reporter, opts))
````
OR -
OR -
````javascript
stuff
.pipe(standard())
Expand Down
18 changes: 18 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var standard = require('../')
require('mocha')

var testFile1 = fs.readFileSync('test/fixtures/testFile1.js')
var testFile2 = fs.readFileSync('test/fixtures/testFile2.js')

describe('gulp-standard', function () {
it('should lint files', function (done) {
Expand All @@ -27,4 +28,21 @@ describe('gulp-standard', function () {
stream.write(fakeFile)
stream.end()
})

it('should catch broken syntax', function (done) {
var stream = standard()
var fakeFile = new gutil.File({
base: 'test/fixtures',
cwd: 'test/',
path: 'test/fixtures/testFile2.js',
contents: testFile2
})
stream.once('data', function (newFile) {
should(newFile.standard.results[0].messages[0].message)
.equal("Parsing error: Unexpected token }")
done()
})
stream.write(fakeFile)
stream.end()
})
})

0 comments on commit 8ff01a2

Please sign in to comment.