Tests: Use a tmp data dir to avoid conflicts/overwriting existing data

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-08-11 16:05:28 +01:00
parent 53b2b54b23
commit 511bb05cb9

View File

@ -15,6 +15,11 @@
* limitations under the License.
*/
import * as tmp from 'tmp';
tmp.setGracefulCleanup();
// Use a temporary dir for tests data
process.env.BALENARC_DATA_DIRECTORY = tmp.dirSync().name;
import { EventEmitter } from 'events';
EventEmitter.defaultMaxListeners = 35; // it appears that 'nock' adds a bunch of listeners - bug?
// SL: Looks like it's not nock causing this, as have seen the problem triggered from help.spec,