mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
feat: add eslint mocha (#1922)
I committed an exclusive test, that shouldn’t happen.
This commit is contained in:
parent
74e8ad7894
commit
afbc4312fc
8 changed files with 14 additions and 24 deletions
11
.eslintrc
11
.eslintrc
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
"extends": [
|
||||
"plugin:node/recommended"
|
||||
"plugin:node/recommended",
|
||||
"plugin:mocha/recommended"
|
||||
],
|
||||
"plugins": [
|
||||
"prettier",
|
||||
"node"
|
||||
"node",
|
||||
"mocha"
|
||||
],
|
||||
"env": {
|
||||
"node": true,
|
||||
|
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ describe('BindingMock', () => {
|
|||
it('constructs', () => {
|
||||
new BindingMock({})
|
||||
})
|
||||
it('needs more testing')
|
||||
|
||||
describe('instance method', () => {
|
||||
beforeEach(function() {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable mocha/no-pending-tests */
|
||||
let platform
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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' })
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue