Comparing version 0.19.1 to 0.20.0
const fs = require('fs'); | ||
const path = require('path'); | ||
const mkdirp = require('mkdirp'); | ||
const relativeRoot = require('../lib/relativeRoot'); | ||
const { | ||
@@ -17,3 +18,3 @@ resolveFilePath, | ||
const { recordToFixtures, recordToFixturesMode } = app.config; | ||
const { recordToFixtures, recordToFixturesMode, formatScript } = app.config; | ||
@@ -74,2 +75,18 @@ const { | ||
if (formatScript) { | ||
let formatFunction; | ||
if (typeof formatScript === 'string') { | ||
const formatScriptModulePath = path.resolve(relativeRoot, formatScript); | ||
// eslint-disable-next-line global-require, import/no-dynamic-require | ||
formatFunction = require(formatScriptModulePath); | ||
} else { | ||
formatFunction = formatScript; | ||
} | ||
if (formatFunction) { | ||
js = formatFunction(js); | ||
} | ||
} | ||
const jsModule = `module.exports = ${js};`; | ||
@@ -76,0 +93,0 @@ |
@@ -22,3 +22,4 @@ 'use strict'; | ||
recordToFixtures: true, | ||
recordToFixturesMode: 'path' | ||
recordToFixturesMode: 'path', | ||
formatScript: undefined | ||
}; | ||
@@ -25,0 +26,0 @@ |
{ | ||
"name": "mockyeah", | ||
"version": "0.19.1", | ||
"version": "0.20.0", | ||
"description": "A powerful service mocking, recording, and playback utility.", | ||
@@ -86,3 +86,3 @@ "main": "index.js", | ||
"private": false, | ||
"gitHead": "a4f7660dd9117ee330652b1820e1e74c89cf934e" | ||
"gitHead": "295eac5ad4816fa10b6f18f6a0ae2e92ce334cf7" | ||
} |
@@ -43,3 +43,4 @@ 'use strict'; | ||
recordToFixtures: true, | ||
recordToFixturesMode: 'path' | ||
recordToFixturesMode: 'path', | ||
formatScript: undefined | ||
}); | ||
@@ -68,5 +69,6 @@ }); | ||
recordToFixtures: true, | ||
recordToFixturesMode: 'path' | ||
recordToFixturesMode: 'path', | ||
formatScript: undefined | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
540857
5083
125
17