From 1261fa53845481adbbbeff2aabe23d0409446017 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Fri, 3 Dec 2021 14:03:58 +0100 Subject: [PATCH] Adapt test to new dist file layout Signed-off-by: Louis Chemineau --- core/js/core.json | 11 ++++---- tests/karma.config.js | 59 +++++++++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/core/js/core.json b/core/js/core.json index 9ea17f2ac5e..40bb35dde9f 100644 --- a/core/js/core.json +++ b/core/js/core.json @@ -1,10 +1,11 @@ { "libraries": [ + "core-common.js" ], "modules": [ - "public/publicpage.js", - "setupchecks.js", - "mimetype.js", - "mimetypelist.js" + "../core/js/public/publicpage.js", + "../core/js/setupchecks.js", + "../core/js/mimetype.js", + "../core/js/mimetypelist.js" ] -} +} \ No newline at end of file diff --git a/tests/karma.config.js b/tests/karma.config.js index f64368daf95..b1cd35a52dd 100644 --- a/tests/karma.config.js +++ b/tests/karma.config.js @@ -48,18 +48,23 @@ module.exports = function(config) { // other apps tests don't run yet... needs further research / clean up return [ 'files', - 'files_trashbin', 'files_versions', - 'systemtags', + { + name: 'comments', + srcFiles: [ + 'dist/comments-comments.js' + ], + testFiles: ['apps/comments/tests/js/**/*.js'] + }, { name: 'files_sharing', srcFiles: [ // only test these files, others are not ready and mess // up with the global namespace/classes/state - 'apps/files_sharing/js/dist/additionalScripts.js', - 'apps/files_sharing/js/dist/files_sharing_tab.js', - 'apps/files_sharing/js/dist/files_sharing.js', - 'apps/files_sharing/js/dist/main.js', + 'dist/files_sharing-additionalScripts.js', + 'dist/files_sharing-files_sharing_tab.js', + 'dist/files_sharing-files_sharing.js', + 'dist/files_sharing-main.js', 'apps/files_sharing/js/files_drop.js', 'apps/files_sharing/js/public.js', 'apps/files_sharing/js/sharedfilelist.js', @@ -80,13 +85,8 @@ module.exports = function(config) { ], testFiles: ['apps/files_external/tests/js/*.js'] }, - { - name: 'comments', - srcFiles: [ - 'apps/comments/js/comments.js' - ], - testFiles: ['apps/comments/tests/js/**/*.js'] - } + 'systemtags', + 'files_trashbin', ]; } @@ -100,9 +100,9 @@ module.exports = function(config) { ); // default apps to test when none is specified (TODO: read from filesystem ?) - var appsToTest = process.env.KARMA_TESTSUITE; - if (appsToTest) { - appsToTest = appsToTest.split(' '); + let appsToTest = [] + if (process.env.KARMA_TESTSUITE) { + appsToTest = process.env.KARMA_TESTSUITE.split(' '); } else { appsToTest = ['core'].concat(findApps()); } @@ -113,8 +113,8 @@ module.exports = function(config) { // these are required by all apps so always need to be loaded // note that the loading order is important that's why they // are specified in a separate file - var corePath = 'core/js/'; - var coreModule = require('../' + corePath + 'core.json'); + var corePath = 'dist/'; + var coreModule = require('../core/js/core.json'); var testCore = false; var files = []; var index; @@ -127,14 +127,6 @@ module.exports = function(config) { testCore = true; } - files.push(corePath + 'tests/html-domparser.js'); - files.push('core/js/dist/main.js'); - files.push('core/js/dist/files_fileinfo.js'); - files.push('core/js/dist/files_client.js'); - files.push('core/js/dist/systemtags.js'); - // core mocks - files.push(corePath + 'tests/specHelper.js'); - var srcFile, i; // add core library files for (i = 0; i < coreModule.libraries.length; i++) { @@ -142,6 +134,15 @@ module.exports = function(config) { files.push(srcFile); } + files.push('core/js/tests/html-domparser.js'); + files.push('dist/core-main.js'); + files.push('dist/core-files_fileinfo.js'); + files.push('dist/core-files_client.js'); + files.push('dist/core-systemtags.js'); + + // core mocks + files.push('core/js/tests/specHelper.js'); + // add core modules files for (i = 0; i < coreModule.modules.length; i++) { srcFile = corePath + coreModule.modules[i]; @@ -156,14 +157,14 @@ module.exports = function(config) { // need to test the core app as well ? if (testCore) { // core tests - files.push(corePath + 'tests/specs/**/*.js'); + files.push('core/js/tests/specs/**/*.js'); } function addApp(app) { // if only a string was specified, expand to structure if (typeof app === 'string') { app = { - srcFiles: 'apps/' + app + '/js/**/*.js', + srcFiles: ['dist/' + app + '-*.js', 'apps/' + app + '/js/**/*.js'], testFiles: 'apps/' + app + '/tests/js/**/*.js' }; } @@ -215,6 +216,8 @@ module.exports = function(config) { served: true }); + console.log(files) + config.set({ // base path, that will be used to resolve files and exclude basePath: '..',