diff --git a/test/before.js b/test/before.js index 9ba59b50..48be7948 100644 --- a/test/before.js +++ b/test/before.js @@ -1,14 +1,25 @@ 'use strict'; const http = require('http'); +const fs = require('fs'); +const os = require('os'); const express = require('express'); +const writejson = require('writejson'); +const readjson = require('readjson'); + const cloudcmd = require('..'); -module.exports = (fn) => { +const pathConfig = os.homedir() + '/.cloudcmd.json'; +const currentConfig = readjson.sync.try(pathConfig); + +module.exports = (config, fn = config) => { const app = express(); const server = http.createServer(app); const after = () => { + if (currentConfig) + writejson.sync(pathConfig, currentConfig); + server.close(); };