Skip to content

TagSpaces is an offline, open source, document manager with tagging support

jest config

stanimir9b363cfe27a8
diff --git a/jest.config.js b/jest.config.js
index a81cf24e5..affd119f3 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,5 +1,18 @@
const sh = require('shelljs');
+
+const isWin = /^win/.test(process.platform);
+const isMac = /^darwin/.test(process.platform);
+const isLinux = /^linux/.test(process.platform);
+let os = '';
+if (isWin) {
+ os = '_win';
+} else if (isMac) {
+ os = '_macos';
+} else if (isLinux) {
+ os = '_linux';
+}
const web = process.env.NODE_JEST === 'test_web' ? '_web' : '';
+const minio = process.env.NODE_JEST === 'test_minio' ? '_minio' : '';
module.exports = async () => {
const BRANCH_NAME = await new Promise((resolve, reject) => {
@@ -39,7 +52,8 @@ module.exports = async () => {
'../node_modules/jest-html-reporter',
{
pageTitle: BRANCH_NAME + ' Test Report',
- outputPath: './test-reports/' + BRANCH_NAME + '.html'
+ outputPath:
+ './test-reports/' + BRANCH_NAME + os + web + minio + '.html'
}
]
],
diff --git a/package.json b/package.json
index be3dd61c7..447a5e047 100644
--- a/package.json
+++ b/package.json
@@ -111,41 +111,6 @@
"pre-commit": "yarn prettier-check && yarn type-check"
}
},
- "jest": {
- "setupFiles": [
- "./scripts/setup-tests.js"
- ],
- "moduleNameMapper": {
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js",
- "\\.(css|less|sass|scss)$": "identity-obj-proxy"
- },
- "moduleFileExtensions": [
- "js",
- "ts",
- "tsx"
- ],
- "moduleDirectories": [
- "node_modules",
- "app/node_modules"
- ],
- "testMatch": [
- "**/{unit,e2e,app,test,integration}/**/*.{test,e2e}.{js,tsx,ts,tsx}"
- ],
- "testPathIgnorePatterns": [
- "<rootDir>/extensions"
- ],
- "reporters": [
- "default",
- [
- "./node_modules/jest-html-reporter",
- {
- "pageTitle": "Test Report"
- }
- ]
- ],
- "collectCoverage": true,
- "maxWorkers": 1
- },
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.2.3",
diff --git a/tests/e2e/hook.js b/tests/e2e/hook.js
index aa10c99c8..258000416 100644
--- a/tests/e2e/hook.js
+++ b/tests/e2e/hook.js
@@ -34,6 +34,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 150000;
// global.msPause = 3000;
global.isWin = /^win/.test(process.platform);
+global.isMac = /^darwin/.test(process.platform);
global.isWeb = process.env.NODE_JEST === 'test_web';
global.isMinio = global.isWeb || process.env.NODE_JEST === 'test_minio';
diff --git a/tests/e2e/test-utils.spec.js b/tests/e2e/test-utils.spec.js
index da1aa5aa0..f19d39d31 100644
--- a/tests/e2e/test-utils.spec.js
+++ b/tests/e2e/test-utils.spec.js
@@ -73,7 +73,10 @@ export async function startWebServer() {
index: ['index.html']
})
);
- await app.use(serveStatic('../app'));
+ if (global.isMac) {
+ //todo copyfiles do not work for MacOS
+ await app.use(serveStatic('../app'));
+ }
await app.listen(port);
console.log('Webserver listining on http://127.0.0.1:' + port);
return app;