Use rewire to import non-module files, and use nyc for test coverage.
This commit is contained in:
parent
1c3b795ae8
commit
6bc1b33e8a
@ -8,10 +8,13 @@
|
|||||||
"google-closure-compiler": "^20210302.0.0",
|
"google-closure-compiler": "^20210302.0.0",
|
||||||
"jshint": "^2.12.0",
|
"jshint": "^2.12.0",
|
||||||
"mocha": "^8.3.2",
|
"mocha": "^8.3.2",
|
||||||
"svgo": "^2.2.2"
|
"rewire": "^5.0.0",
|
||||||
|
"svgo": "^2.2.2",
|
||||||
|
"nyc": "^15.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha test",
|
"test": "mocha test",
|
||||||
|
"coverage": "nyc mocha test",
|
||||||
"build": "python tools/create_package.py",
|
"build": "python tools/create_package.py",
|
||||||
"update": "python tools/update_includes.py",
|
"update": "python tools/update_includes.py",
|
||||||
"svg": "python tools/optimize_svg_files.py"
|
"svg": "python tools/optimize_svg_files.py"
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
module.exports =
|
|
||||||
{
|
|
||||||
AddNativeSourceFile : function (fileName)
|
|
||||||
{
|
|
||||||
var path = require ('path');
|
|
||||||
var rootDir = path.join (__dirname, '..');
|
|
||||||
var fullPath = path.resolve (rootDir, fileName);
|
|
||||||
|
|
||||||
var fs = require ('fs');
|
|
||||||
var content = fs.readFileSync (fullPath).toString ();
|
|
||||||
|
|
||||||
eval.apply (global, [content]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,10 +1,10 @@
|
|||||||
var path = require ('path');
|
var path = require ('path');
|
||||||
var nativeImport = require ('../framework/native_import.js');
|
var rewire = require ('rewire');
|
||||||
|
|
||||||
var config = require ('../../tools/config.json')
|
var config = require ('../../tools/config.json')
|
||||||
var importerFiles = config['importer_files'];
|
var importerFiles = config['importer_files'];
|
||||||
var fileIndex, filePath;
|
var fileIndex, filePath;
|
||||||
for (fileIndex = 0; fileIndex < importerFiles.length; fileIndex++) {
|
for (fileIndex = 0; fileIndex < importerFiles.length; fileIndex++) {
|
||||||
filePath = importerFiles[fileIndex];
|
filePath = importerFiles[fileIndex];
|
||||||
nativeImport.AddNativeSourceFile (path.join ('..', filePath));
|
rewire (path.join ('..', '..', filePath));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user