Skip to content

Commit

Permalink
Adapt test to new dist file layout
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Dec 3, 2021
1 parent 9af3389 commit 60dc882
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
11 changes: 6 additions & 5 deletions core/js/core.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
59 changes: 31 additions & 28 deletions tests/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
];
}

Expand All @@ -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());
}
Expand All @@ -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;
Expand All @@ -127,21 +127,22 @@ 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++) {
srcFile = corePath + coreModule.libraries[i];
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];
Expand All @@ -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'
};
}
Expand Down Expand Up @@ -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: '..',
Expand Down

0 comments on commit 60dc882

Please sign in to comment.