diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index 140ac2d224..da226e77c3 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -31,7 +31,7 @@ module.exports = { }) .option('enable-preload', { type: 'boolean', - default: true + default: process.env.NODE_ENV !== 'test' // preload by default, unless in test env }) }, diff --git a/src/core/config.js b/src/core/config.js index 1d40e862c5..20270e6c97 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -31,7 +31,10 @@ const configSchema = s({ enabled: 'boolean?', addresses: optional(s(['multiaddr'])), interval: 'number?' - }, { enabled: true, interval: 30 * 1000 }), + }, { // defaults if missing: + enabled: process.env.NODE_ENV !== 'test', // preload by default, unless in test env + interval: 30 * 1000 + }), init: optional(union(['boolean', s({ bits: 'number?', emptyRepo: 'boolean?', diff --git a/src/core/index.js b/src/core/index.js index 9ab064a607..4c6a8f2f06 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -45,7 +45,7 @@ class IPFS extends EventEmitter { start: true, EXPERIMENTAL: {}, preload: { - enabled: true, + enabled: process.env.NODE_ENV !== 'test', // preload by default, unless in test env addresses: [ '/dnsaddr/node0.preload.ipfs.io/https', '/dnsaddr/node1.preload.ipfs.io/https'