Skip to content

Commit

Permalink
feat: add eslint mocha (#1922)
Browse files Browse the repository at this point in the history
I committed an exclusive test, that shouldn’t happen.
  • Loading branch information
reconbot authored Aug 27, 2019
1 parent 74e8ad7 commit afbc431
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 24 deletions.
11 changes: 8 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"extends": [
"plugin:node/recommended"
"plugin:node/recommended",
"plugin:mocha/recommended"
],
"plugins": [
"prettier",
"node"
"node",
"mocha"
],
"env": {
"node": true,
Expand Down Expand Up @@ -62,6 +64,9 @@
],
"valid-jsdoc": [
0
]
],
"mocha/no-mocha-arrows": [0],
"mocha/no-setup-in-describe": [0],
"mocha/no-hooks-for-single-case": [0]
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-mocha": "^6.1.0",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.0.1",
Expand Down
1 change: 0 additions & 1 deletion packages/binding-mock/binding-mock.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe('BindingMock', () => {
it('constructs', () => {
new BindingMock({})
})
it('needs more testing')

describe('instance method', () => {
beforeEach(function() {
Expand Down
3 changes: 2 additions & 1 deletion packages/bindings/lib/bindings.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable mocha/no-pending-tests */
let platform
switch (process.platform) {
case 'win32':
Expand Down Expand Up @@ -323,7 +324,7 @@ function testBinding(bindingName, Binding, testPort) {
})
})

describe.only('#write', () => {
describe('#write', () => {
it('errors asynchronously when not open', done => {
const binding = new Binding({
disconnect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('InterByteTimeoutParser', () => {
parser.end()
assert(spy.calledOnce, 'expecting 1 data event')
})
it('emits all buffered data when stream ends', () => {
it('handles not having any buffered data when stream ends', () => {
const spy = sinon.spy()
const parser = new InterByteTimeoutParser({ interval: 15 })
parser.on('data', spy)
Expand Down
12 changes: 0 additions & 12 deletions packages/parser-readline/readline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ describe('ReadlineParser', () => {
})
})

it('allows setting of the delimiter with a string', () => {
new ReadlineParser({ delimiter: 'string' })
})

it('allows setting of the delimiter with a buffer', () => {
new ReadlineParser({ delimiter: Buffer.from([1]) })
})

it('allows setting of the delimiter with an array of bytes', () => {
new ReadlineParser({ delimiter: [1] })
})

it("doesn't emits empty data events", () => {
const spy = sinon.spy()
const parser = new ReadlineParser({ delimiter: 'a' })
Expand Down
6 changes: 1 addition & 5 deletions packages/serialport/test-arduino/stress.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ describe('the stress', () => {
const testPort = process.env.TEST_PORT

if (!testPort) {
// eslint-disable-next-line mocha/no-pending-tests
it('cannot be tested as we have no test ports')
return
}

describe('of 2 minutes of running 1k writes', () => {
if (process.version.match('v0.10.')) {
it('either leaks like a siv or memwatch is broken on v10')
return
}

it("doesn't leak memory", done => {
const data = Buffer.alloc(1024)
const hd = new memwatch.HeapDiff()
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/stream.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('SerialPort', () => {
})

it('allows optional options', function(done) {
this.port = new SerialPort('/dev/exists', done)
this.port = new SerialPort('/dev/exists', () => done())
})
})

Expand Down

0 comments on commit afbc431

Please sign in to comment.