Skip to content

Commit afbc431

Browse files
authored
feat: add eslint mocha (#1922)
I committed an exclusive test, that shouldn’t happen.
1 parent 74e8ad7 commit afbc431

File tree

8 files changed

+14
-24
lines changed

8 files changed

+14
-24
lines changed

.eslintrc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"extends": [
3-
"plugin:node/recommended"
3+
"plugin:node/recommended",
4+
"plugin:mocha/recommended"
45
],
56
"plugins": [
67
"prettier",
7-
"node"
8+
"node",
9+
"mocha"
810
],
911
"env": {
1012
"node": true,
@@ -62,6 +64,9 @@
6264
],
6365
"valid-jsdoc": [
6466
0
65-
]
67+
],
68+
"mocha/no-mocha-arrows": [0],
69+
"mocha/no-setup-in-describe": [0],
70+
"mocha/no-hooks-for-single-case": [0]
6671
}
6772
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"eslint": "^6.1.0",
4141
"eslint-config-prettier": "^6.0.0",
4242
"eslint-plugin-import": "^2.16.0",
43+
"eslint-plugin-mocha": "^6.1.0",
4344
"eslint-plugin-node": "^9.0.1",
4445
"eslint-plugin-prettier": "^3.0.1",
4546
"eslint-plugin-promise": "^4.0.1",

packages/binding-mock/binding-mock.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ describe('BindingMock', () => {
1616
it('constructs', () => {
1717
new BindingMock({})
1818
})
19-
it('needs more testing')
2019

2120
describe('instance method', () => {
2221
beforeEach(function() {

packages/bindings/lib/bindings.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable mocha/no-pending-tests */
12
let platform
23
switch (process.platform) {
34
case 'win32':
@@ -323,7 +324,7 @@ function testBinding(bindingName, Binding, testPort) {
323324
})
324325
})
325326

326-
describe.only('#write', () => {
327+
describe('#write', () => {
327328
it('errors asynchronously when not open', done => {
328329
const binding = new Binding({
329330
disconnect,

packages/parser-inter-byte-timeout/inter-byte-timeout.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('InterByteTimeoutParser', () => {
7171
parser.end()
7272
assert(spy.calledOnce, 'expecting 1 data event')
7373
})
74-
it('emits all buffered data when stream ends', () => {
74+
it('handles not having any buffered data when stream ends', () => {
7575
const spy = sinon.spy()
7676
const parser = new InterByteTimeoutParser({ interval: 15 })
7777
parser.on('data', spy)

packages/parser-readline/readline.test.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,6 @@ describe('ReadlineParser', () => {
9090
})
9191
})
9292

93-
it('allows setting of the delimiter with a string', () => {
94-
new ReadlineParser({ delimiter: 'string' })
95-
})
96-
97-
it('allows setting of the delimiter with a buffer', () => {
98-
new ReadlineParser({ delimiter: Buffer.from([1]) })
99-
})
100-
101-
it('allows setting of the delimiter with an array of bytes', () => {
102-
new ReadlineParser({ delimiter: [1] })
103-
})
104-
10593
it("doesn't emits empty data events", () => {
10694
const spy = sinon.spy()
10795
const parser = new ReadlineParser({ delimiter: 'a' })

packages/serialport/test-arduino/stress.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@ describe('the stress', () => {
2121
const testPort = process.env.TEST_PORT
2222

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

2829
describe('of 2 minutes of running 1k writes', () => {
29-
if (process.version.match('v0.10.')) {
30-
it('either leaks like a siv or memwatch is broken on v10')
31-
return
32-
}
33-
3430
it("doesn't leak memory", done => {
3531
const data = Buffer.alloc(1024)
3632
const hd = new memwatch.HeapDiff()

packages/stream/stream.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe('SerialPort', () => {
164164
})
165165

166166
it('allows optional options', function(done) {
167-
this.port = new SerialPort('/dev/exists', done)
167+
this.port = new SerialPort('/dev/exists', () => done())
168168
})
169169
})
170170

0 commit comments

Comments
 (0)