Fix test mode
This commit is contained in:
parent
124ec078aa
commit
23d4eb77b2
|
@ -39,7 +39,7 @@ module.exports = {
|
|||
process: 'require("process")',
|
||||
net: 'require("net")',
|
||||
request: 'require(require("path").join(require("electron").remote.app.getAppPath(), "node_modules", "request"))',
|
||||
sparkplug: 'require("../core/sparkplug")',
|
||||
sparkplug: 'require("../../core/dist/sparkplug")',
|
||||
'node-crypto': 'require("crypto")'
|
||||
},
|
||||
resolve: {
|
||||
|
|
|
@ -8,7 +8,23 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const tests = typeof PRODUCTION === 'undefined';
|
||||
const TESTS = typeof PRODUCTION === 'undefined';
|
||||
const TEST_ARGS = () => {
|
||||
const _basePath = path.resolve(__dirname, '..', '..');
|
||||
const _baseDataPath = path.resolve(_basePath, 'tests');
|
||||
return {
|
||||
'options': {
|
||||
'autoInject': true,
|
||||
'commonCore': true,
|
||||
'commonData': true
|
||||
},
|
||||
'paths': {
|
||||
'client': path.resolve(_basePath, 'client', 'dist'),
|
||||
'core': path.resolve(_basePath, 'core', 'dist'),
|
||||
'data': path.resolve(_baseDataPath, 'data')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import path from 'path';
|
||||
import sass from 'node-sass';
|
||||
|
@ -135,6 +151,7 @@ export class BetterDiscord {
|
|||
get window() { return this.windowUtils ? this.windowUtils.window : undefined; }
|
||||
|
||||
constructor(args) {
|
||||
if (TESTS) args = TEST_ARGS();
|
||||
console.log('[BetterDiscord|args] ', JSON.stringify(args, null, 4));
|
||||
if (BetterDiscord.loaded) {
|
||||
console.log('[BetterDiscord] Creating two BetterDiscord objects???');
|
||||
|
@ -216,7 +233,9 @@ export class BetterDiscord {
|
|||
*/
|
||||
parseClientPackage() {
|
||||
const clientPath = this.config.getPath('client');
|
||||
const { version, main } = require(`${clientPath}/package.json`);
|
||||
const clientPkg = TESTS ? require(`${path.resolve(clientPath, '..')}/package.json`) :require(`${clientPath}/package.json`);
|
||||
const { version } = clientPkg;
|
||||
const main = TESTS ? 'betterdiscord.client.js' : clientPkg.main;
|
||||
this.config.addPath('client_script', `${clientPath}/${main}`);
|
||||
this.config.setClientVersion(version);
|
||||
console.log(`[BetterDiscord] Client v${this.config.clientVersion} - ${this.config.getPath('client_script')}`);
|
||||
|
|
|
@ -2828,6 +2828,9 @@
|
|||
"randomfill": "1.0.4"
|
||||
}
|
||||
},
|
||||
"csp-parse": {
|
||||
"version": "github:macropodhq/csp-parse#db7d5f954b420b527d7fb452a93bb6e2fa302c5a"
|
||||
},
|
||||
"css-color-names": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
|
||||
|
|
|
@ -93,6 +93,6 @@
|
|||
"release": "npm run lint && npm run build_release && gulp release && npm run package_release",
|
||||
"update_release": "npm run build_release && gulp build-release",
|
||||
"inject": "node scripts/inject.js",
|
||||
"tt": "npm run release --prefix client"
|
||||
"tt": "npm run build --prefix core"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue