diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-04 21:24:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 21:24:39 -0500 |
commit | 421b60db0f6f132cbc5993488041846055a76d11 (patch) | |
tree | b2b28efc8ed7651c63ca2e728096ab79c6e6ab06 /test/yomichan-test.js | |
parent | 6e47b4e241594d68384f62b1faa34c86f85addbf (diff) | |
parent | 7a51a0fbde445e346a83982dd6a16ce164521e26 (diff) |
Merge pull request #387 from toasted-nutbread/yomichan-vm
Abstract Yomichan extension script execution
Diffstat (limited to 'test/yomichan-test.js')
-rw-r--r-- | test/yomichan-test.js | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/test/yomichan-test.js b/test/yomichan-test.js index 78bfb9c6..0fc97b4b 100644 --- a/test/yomichan-test.js +++ b/test/yomichan-test.js @@ -22,18 +22,6 @@ const path = require('path'); let JSZip = null; -function requireScript(fileName, exportNames, variables) { - const absoluteFileName = path.join(__dirname, '..', fileName); - const source = fs.readFileSync(absoluteFileName, {encoding: 'utf8'}); - const exportNamesString = Array.isArray(exportNames) ? exportNames.join(',') : ''; - const variablesArgumentName = '__variables__'; - let variableString = ''; - if (typeof variables === 'object' && variables !== null) { - variableString = Object.keys(variables).join(','); - variableString = `const {${variableString}} = ${variablesArgumentName};`; - } - return Function(variablesArgumentName, `'use strict';${variableString}${source}\n;return {${exportNamesString}};`)(variables); -} function getJSZip() { if (JSZip === null) { @@ -64,7 +52,6 @@ function createTestDictionaryArchive(dictionary, dictionaryName) { module.exports = { - requireScript, createTestDictionaryArchive, get JSZip() { return getJSZip(); } }; |