Skip to content

Commit

Permalink
Increase maxBuffer' to 10MB (1024*1024*10)
Browse files Browse the repository at this point in the history
  • Loading branch information
natterstefan authored Apr 8, 2019
2 parents 57b8336 + 5edc6ff commit be837cc
Show file tree
Hide file tree
Showing 6 changed files with 2,448 additions and 3,352 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented here. The format is based
on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project
adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixes

- increase `maxBuffer` of `cp.exec` to 10MB (1024*1024*10), fixes #10

## [2.0.0] - 2019-02-10

### Added
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Contributions of any kind are welcome!
[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
[all-contributors]: https://github.com/kentcdodds/all-contributors

[build-badge]: https://api.travis-ci.org/dylanpiercey/local-devices.svg?branch=master
[build]: https://travis-ci.org/dylanpiercey/local-devices
[coverage-badge]: https://coveralls.io/repos/github/dylanpiercey/local-devices/badge.svg?branch=master
[coverage]: https://coveralls.io/github/dylanpiercey/local-devices?branch=master
[build-badge]: https://travis-ci.org/DylanPiercey/local-devices.svg?branch=master
[build]: https://travis-ci.org/DylanPiercey/local-devices
[coverage-badge]: https://coveralls.io/repos/github/DylanPiercey/local-devices/badge.svg?branch=master
[coverage]: https://coveralls.io/github/DylanPiercey/local-devices?branch=master
13 changes: 13 additions & 0 deletions __tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const find = require('../src/index')
var cp = require('mz/child_process')

const TEN_MEGA_BYTE = 1024 * 1024 * 10

describe('local-devices', () => {
const platforms = [
Expand Down Expand Up @@ -58,6 +61,16 @@ describe('local-devices', () => {
const result = await find('192.168.0.243')
expect(result).toBeUndefined()
})

it('invokes cp.exec with maxBuffer of 10 MB, when invoking find without an ip', async () => {
await find()
expect(cp.exec).toHaveBeenCalledWith('arp -a', { 'maxBuffer': TEN_MEGA_BYTE })
})

it('invokes cp.exec with maxBuffer of 10 MB, when invoking find with a single ip', async () => {
await find('192.168.0.242')
expect(cp.exec).toHaveBeenCalledWith('arp -n 192.168.0.242', { 'maxBuffer': TEN_MEGA_BYTE })
})
})
})
})
Loading

0 comments on commit be837cc

Please sign in to comment.