1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Moving config during testing to tests asset folder #587

This commit is contained in:
Patrik J. Braun 2023-03-12 11:33:02 +01:00
parent a58d61f958
commit 6134a7d35e
3 changed files with 13 additions and 9 deletions

14
package-lock.json generated
View File

@ -27,7 +27,7 @@
"sharp": "0.31.3",
"ts-exif-parser": "0.2.2",
"ts-node-iptc": "1.0.11",
"typeconfig": "2.0.38",
"typeconfig": "2.0.39",
"typeorm": "0.3.12",
"xml2js": "0.4.23"
},
@ -21670,9 +21670,9 @@
}
},
"node_modules/typeconfig": {
"version": "2.0.38",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.38.tgz",
"integrity": "sha512-yN9rRqJQ21xAYdR/1vhv4DPurOA7DNCN7zqPDPD6ZA2fLKcNTRa2flG/z2FaQE4UuBfnQ1o96c50xeNozDMbZQ==",
"version": "2.0.39",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.39.tgz",
"integrity": "sha512-Wys54XBKXeUSfaqrPajTCi6lY3c1b/M/PotGWVL5KT6393IO317wq45F/5otFBuFVREIh+4gRG6c/y+SvSZXYw==",
"dependencies": {
"minimist": "1.2.8"
}
@ -39736,9 +39736,9 @@
}
},
"typeconfig": {
"version": "2.0.38",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.38.tgz",
"integrity": "sha512-yN9rRqJQ21xAYdR/1vhv4DPurOA7DNCN7zqPDPD6ZA2fLKcNTRa2flG/z2FaQE4UuBfnQ1o96c50xeNozDMbZQ==",
"version": "2.0.39",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.39.tgz",
"integrity": "sha512-Wys54XBKXeUSfaqrPajTCi6lY3c1b/M/PotGWVL5KT6393IO317wq45F/5otFBuFVREIh+4gRG6c/y+SvSZXYw==",
"requires": {
"minimist": "1.2.8"
}

View File

@ -50,7 +50,7 @@
"sharp": "0.31.3",
"ts-exif-parser": "0.2.2",
"ts-node-iptc": "1.0.11",
"typeconfig": "2.0.38",
"typeconfig": "2.0.39",
"xml2js": "0.4.23",
"typeorm": "0.3.12"
},

View File

@ -10,9 +10,13 @@ import {TAGS} from '../public/ClientConfig';
declare const process: any;
const upTime = new Date().toISOString();
// TODO: Refactor Config to be injectable globally.
// This is a bad habit to let the Config know if its in a testing env.
const isTesting = ['afterEach', 'after', 'beforeEach', 'before', 'describe', 'it']
.every((fn) => (global as any)[fn] instanceof Function);
@ConfigClass<IConfigClass<TAGS> & ServerConfig>({
configPath: path.join(__dirname, './../../../../config.json'),
configPath: path.join(__dirname, !isTesting ? './../../../../config.json' : './../../../../test/backend/assets/config.json'),
saveIfNotExist: true,
attachDescription: true,
enumsAsString: true,