github.com/readium/readium-lcp-server@v0.0.0-20240101192032-6e95190e99f1/frontend/manage/karma.conf.js (about)

     1  module.exports = function(config) {
     2  
     3    var appBase    = 'app/';      // transpiled app JS and map files
     4    var appSrcBase = 'app/';      // app source TS files
     5    var appAssets  = 'base/app/'; // component assets fetched by Angular's compiler
     6  
     7    // Testing helpers (optional) are conventionally in a folder called `testing`
     8    var testingBase    = 'testing/'; // transpiled test JS and map files
     9    var testingSrcBase = 'testing/'; // test source TS files
    10  
    11    config.set({
    12      basePath: '',
    13      frameworks: ['jasmine'],
    14  
    15      plugins: [
    16        require('karma-jasmine'),
    17        require('karma-chrome-launcher'),
    18        require('karma-jasmine-html-reporter')
    19      ],
    20  
    21      client: {
    22        builtPaths: [appSrcBase, testingBase], // add more spec base paths as needed
    23        clearContext: false // leave Jasmine Spec Runner output visible in browser
    24      },
    25  
    26      customLaunchers: {
    27        // From the CLI. Not used here but interesting
    28        // chrome setup for travis CI using chromium
    29        Chrome_travis_ci: {
    30          base: 'Chrome',
    31          flags: ['--no-sandbox']
    32        }
    33      },
    34  
    35      files: [
    36        // System.js for module loading
    37        'node_modules/systemjs/dist/system.src.js',
    38  
    39        // Polyfills
    40        'node_modules/core-js/client/shim.js',
    41        'node_modules/reflect-metadata/Reflect.js',
    42  
    43        // zone.js
    44        'node_modules/zone.js/dist/zone.js',
    45        'node_modules/zone.js/dist/long-stack-trace-zone.js',
    46        'node_modules/zone.js/dist/proxy.js',
    47        'node_modules/zone.js/dist/sync-test.js',
    48        'node_modules/zone.js/dist/jasmine-patch.js',
    49        'node_modules/zone.js/dist/async-test.js',
    50        'node_modules/zone.js/dist/fake-async-test.js',
    51  
    52        // RxJs
    53        { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
    54        { pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
    55  
    56        // Paths loaded via module imports:
    57        // Angular itself
    58        { pattern: 'node_modules/@angular/**/*.js', included: false, watched: false },
    59        { pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false },
    60  
    61        { pattern: 'systemjs.config.js', included: false, watched: false },
    62        { pattern: 'systemjs.config.extras.js', included: false, watched: false },
    63        'karma-test-shim.js', // optionally extend SystemJS mapping e.g., with barrels
    64  
    65        // transpiled application & spec code paths loaded via module imports
    66        { pattern: appBase + '**/*.js', included: false, watched: true },
    67        { pattern: testingBase + '**/*.js', included: false, watched: true },
    68  
    69  
    70        // Asset (HTML & CSS) paths loaded via Angular's component compiler
    71        // (these paths need to be rewritten, see proxies section)
    72        { pattern: appBase + '**/*.html', included: false, watched: true },
    73        { pattern: appBase + '**/*.css', included: false, watched: true },
    74  
    75        // Paths for debugging with source maps in dev tools
    76        { pattern: appSrcBase + '**/*.ts', included: false, watched: false },
    77        { pattern: appBase + '**/*.js.map', included: false, watched: false },
    78        { pattern: testingSrcBase + '**/*.ts', included: false, watched: false },
    79        { pattern: testingBase + '**/*.js.map', included: false, watched: false}
    80      ],
    81  
    82      // Proxied base paths for loading assets
    83      proxies: {
    84        // required for component assets fetched by Angular's compiler
    85        "/app/": appAssets
    86      },
    87  
    88      exclude: [],
    89      preprocessors: {},
    90      reporters: ['progress', 'kjhtml'],
    91  
    92      port: 9876,
    93      colors: true,
    94      logLevel: config.LOG_INFO,
    95      autoWatch: true,
    96      browsers: ['Chrome'],
    97      singleRun: false
    98    })
    99  }