diff --git a/package.json b/package.json index 2d006a4d..f25eaf73 100644 --- a/package.json +++ b/package.json @@ -165,6 +165,7 @@ "eslint-plugin-node": "^5.1.0", "extract-text-webpack-plugin": "^3.0.0", "file-loader": "^0.11.2", + "fresh-require": "^1.0.3", "gunzip-maybe": "^1.3.1", "html-looks-like": "^1.0.2", "html-webpack-exclude-assets-plugin": "^0.0.5", diff --git a/test/common/cloudfunc.js b/test/common/cloudfunc.js index ffcbb2ee..7751ead4 100644 --- a/test/common/cloudfunc.js +++ b/test/common/cloudfunc.js @@ -6,9 +6,15 @@ const TMPLDIR = DIR + 'tmpl/'; const Util = require(COMMONDIR + 'util'); const CloudFunc = require(COMMONDIR + 'cloudfunc'); + const files = require('files-io'); +const currify = require('currify'); + +const swap = currify((fn, a, b) => fn(b, a)); const test = require('tape'); +const fresh = swap(require('fresh-require'), require); + const htmlLooksLike = require('html-looks-like'); const FS_DIR = TMPLDIR + 'fs/'; @@ -145,6 +151,9 @@ test('cloudfunc: formatMsg', (t) => { }); test('cloudfunc: getTitle', (t) => { + const name = COMMONDIR + 'cloudfunc'; + + const CloudFunc = fresh(name); const result = CloudFunc.getTitle(); t.equal(result, 'Cloud Commander - /'); @@ -152,6 +161,9 @@ test('cloudfunc: getTitle', (t) => { }); test('cloudfunc: getTitle', (t) => { + const name = COMMONDIR + 'cloudfunc'; + + const CloudFunc = fresh(name); const result = CloudFunc.getTitle('/hello/world'); t.equal(result, 'Cloud Commander - /hello/world');