123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- if (!process.env.CHROMIUM_BIN) {
- process.env.CHROMIUM_BIN = require('puppeteer').executablePath()
- }
- module.exports = function(config) {
- function findApps() {
-
-
- return [
- 'files',
- 'files_versions',
- {
- name: 'files_sharing',
- srcFiles: [
-
-
- 'dist/files_sharing-additionalScripts.js',
- 'dist/files_sharing-files_sharing_tab.js',
- 'dist/files_sharing-main.js',
- ],
- },
- 'files_trashbin',
- ];
- }
-
-
-
- var enableCoverage = !parseInt(process.env.NOCOVERAGE, 10);
- console.log(
- 'Coverage preprocessor: ',
- enableCoverage ? 'enabled' : 'disabled'
- );
-
- let appsToTest = []
- if (process.env.KARMA_TESTSUITE) {
- appsToTest = process.env.KARMA_TESTSUITE.split(' ');
- } else {
- appsToTest = ['core'].concat(findApps());
- }
- console.log('Apps to test: ', appsToTest);
-
-
-
-
- var corePath = 'dist/';
- var coreModule = require('../core/js/core.json');
- var testCore = false;
- var files = [];
- var index;
- var preprocessors = {};
-
- index = appsToTest.indexOf('core');
- if (index > -1) {
- appsToTest.splice(index, 1);
- testCore = true;
- }
- var srcFile, i;
-
- 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');
-
- files.push('core/js/tests/specHelper.js');
-
- for (i = 0; i < coreModule.modules.length; i++) {
- srcFile = corePath + coreModule.modules[i];
- files.push(srcFile);
- if (enableCoverage) {
- preprocessors[srcFile] = 'coverage';
- }
- }
-
-
- if (testCore) {
-
- files.push('core/js/tests/specs/**/*.js');
- }
- function addApp(app) {
-
- if (typeof app === 'string') {
- app = {
- srcFiles: ['dist/' + app + '-*.js', 'apps/' + app + '/js/**/*.js'],
- testFiles: 'apps/' + app + '/tests/js/**/*.js'
- };
- }
-
- files = files.concat(app.srcFiles || []);
-
- files = files.concat(app.testFiles || []);
- if (enableCoverage) {
-
- for (var i = 0; i < app.srcFiles.length; i++) {
- preprocessors[app.srcFiles[i]] = 'coverage';
- }
- }
- }
-
- for (i = 0; i < appsToTest.length; i++) {
- addApp(appsToTest[i]);
- }
-
- files.push({
- pattern: 'core/img/**/*',
- watched: false,
- included: false,
- served: true
- });
-
- files.push({
- pattern: 'core/css/*.css',
- watched: true,
- included: true,
- served: true
- });
-
- files.push({
- pattern: 'core/fonts/*',
- watched: false,
- included: false,
- served: true
- });
- console.log(files)
- config.set({
-
- basePath: '..',
-
- frameworks: ['jasmine', 'jasmine-sinon', 'viewport'],
-
- files: files,
-
- exclude: [],
- proxies: {
-
- '/base/tests/img/': 'http://localhost:9876/base/core/img/',
- '/base/tests/css/': 'http://localhost:9876/base/core/css/',
- '/base/core/css/images/': 'http://localhost:9876/base/core/css/images/',
- '/actions/': 'http://localhost:9876/base/core/img/actions/',
- '/base/core/fonts/': 'http://localhost:9876/base/core/fonts/',
- '/svg/': '../core/img/'
- },
-
-
- reporters: ['spec'],
- specReporter: {
- maxLogLines: 5,
- suppressErrorSummary: false,
- suppressFailed: false,
- suppressPassed: true,
- suppressSkipped: true,
- showSpecTiming: false,
- },
- junitReporter: {
- outputFile: 'tests/autotest-results-js.xml'
- },
-
- port: 9876,
- preprocessors: preprocessors,
- coverageReporter: {
- dir: 'tests/karma-coverage',
- reporters: [
- { type: 'html' },
- { type: 'cobertura' },
- { type: 'lcovonly' }
- ]
- },
-
- colors: true,
-
-
- logLevel: config.LOG_INFO,
-
- autoWatch: true,
-
-
-
-
-
-
-
-
-
- browsers: ['ChromiumHeadless'],
-
- customLaunchers: {
- PhantomJS_debug: {
- base: 'PhantomJS',
- debug: true
- }
- },
-
- captureTimeout: 60000,
-
-
- singleRun: false
- });
- };
|