Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 857ad91

Browse files
jacobheunAlan Shaw
authored and
Alan Shaw
committed
test: merge util factory spawn options (#2380)
Previously the spawnOptions defaults were not being included if a test specified them. This would result in some tests dialing out to the Bootstrap nodes, or using mdns when not desired. This resolves that by using 'merge-options' to include defaults.
1 parent ff44f89 commit 857ad91

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/utils/interface-common-factory.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ const each = require('async/each')
55
const IPFSFactory = require('ipfsd-ctl')
66
const ipfsClient = require('ipfs-http-client')
77
const IPFS = require('../../src')
8+
const mergeOptions = require('merge-options')
89

910
function createFactory (options) {
1011
options = options || {}
1112

1213
options.factoryOptions = options.factoryOptions || { type: 'proc', exec: IPFS }
13-
options.spawnOptions = options.spawnOptions || {
14+
options.spawnOptions = mergeOptions({
1415
initOptions: { bits: 512 },
1516
config: {
1617
Bootstrap: [],
@@ -24,7 +25,7 @@ function createFactory (options) {
2425
}
2526
},
2627
preload: { enabled: false }
27-
}
28+
}, options.spawnOptions)
2829

2930
if (options.factoryOptions.type !== 'proc') {
3031
options.factoryOptions.IpfsClient = options.factoryOptions.IpfsClient || ipfsClient

0 commit comments

Comments
 (0)