2017-02-22 15:25:57 +00:00
|
|
|
/**
|
|
|
|
* Build test
|
|
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const fs = require('fs');
|
|
|
|
|
2017-04-06 17:11:26 +00:00
|
|
|
module.exports = (Helper, codeDir, testFile, TestHelper) => {
|
2017-02-22 15:25:57 +00:00
|
|
|
let code = fs.readFileSync(testFile, 'utf8'),
|
|
|
|
modules = [
|
2017-04-06 17:11:26 +00:00
|
|
|
// Core
|
|
|
|
TestHelper.fakeEvents(),
|
|
|
|
TestHelper.fakeInit(),
|
2017-02-22 15:25:57 +00:00
|
|
|
|
2017-04-06 17:11:26 +00:00
|
|
|
// Common files
|
|
|
|
TestHelper.getStorage(),
|
|
|
|
fs.readFileSync(codeDir + '/browser/storage.js', 'utf8'),
|
|
|
|
TestHelper.getSVG(),
|
2017-02-22 15:25:57 +00:00
|
|
|
|
2017-04-06 17:11:26 +00:00
|
|
|
// Files needed for test
|
2017-02-22 15:25:57 +00:00
|
|
|
fs.readFileSync(codeDir + '/browser/defaults.js', 'utf8'),
|
2017-03-15 23:09:16 +00:00
|
|
|
fs.readFileSync(codeDir + '/browser/with-cdn/defaults.js', 'utf8'),
|
2017-02-22 15:25:57 +00:00
|
|
|
fs.readFileSync(codeDir + '/browser/config.js', 'utf8'),
|
|
|
|
fs.readFileSync(codeDir + '/browser/image.js', 'utf8'),
|
|
|
|
fs.readFileSync(codeDir + '/browser/finder.js', 'utf8'),
|
2017-03-15 23:09:16 +00:00
|
|
|
fs.readFileSync(codeDir + '/browser/with-cdn/loader.js', 'utf8'),
|
2017-04-06 17:11:26 +00:00
|
|
|
|
|
|
|
// Main file
|
2017-02-22 15:25:57 +00:00
|
|
|
fs.readFileSync(codeDir + '/browser/renderer.js', 'utf8'),
|
|
|
|
];
|
|
|
|
|
|
|
|
// Replace code
|
2017-04-06 17:11:26 +00:00
|
|
|
modules = modules.join('');
|
2017-02-22 15:25:57 +00:00
|
|
|
|
|
|
|
// Merge modules and test
|
|
|
|
code = code.replace('/* Modules() */', modules);
|
|
|
|
|
|
|
|
return code;
|
|
|
|
};
|