mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
f2ad7ebfc3
Move jQuery and Angular dependencies to bundle GitOrigin-RevId: cee1507044438c8c435d934476f6ea6281215ccd
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
const webpackConfig = require('./webpack.config.test')
|
|
|
|
module.exports = function(config) {
|
|
config.set({
|
|
customLaunchers: {
|
|
ChromeCustom: {
|
|
base: 'ChromeHeadless',
|
|
// We must disable the Chrome sandbox when running Chrome inside Docker
|
|
// (Chrome's sandbox needs more permissions than Docker allows by
|
|
// default)
|
|
flags: ['--no-sandbox']
|
|
}
|
|
},
|
|
browsers: ['ChromeCustom'],
|
|
files: [
|
|
// Import all tests (see comment in the file for why this is necessary)
|
|
'test/frontend/import_tests.js'
|
|
],
|
|
middleware: ['fake-img'],
|
|
preprocessors: {
|
|
// Run files through webpack
|
|
'test/frontend/import_tests.js': ['webpack']
|
|
},
|
|
frameworks: ['mocha', 'chai-sinon'],
|
|
// Configure webpack in the tests
|
|
webpack: webpackConfig,
|
|
// Configure the webpack dev server used to serve test files
|
|
webpackMiddleware: {
|
|
// Disable noisy CLI output
|
|
stats: 'errors-only'
|
|
},
|
|
plugins: [
|
|
require('karma-chrome-launcher'),
|
|
require('karma-mocha'),
|
|
require('karma-chai-sinon'),
|
|
require('karma-webpack'),
|
|
require('karma-mocha-reporter'),
|
|
{ 'middleware:fake-img': ['factory', fakeImgMiddlewareFactory] }
|
|
],
|
|
reporters: ['mocha']
|
|
})
|
|
}
|
|
|
|
/**
|
|
* Handle fake images
|
|
*/
|
|
function fakeImgMiddlewareFactory() {
|
|
return function(req, res, next) {
|
|
if (req.originalUrl.startsWith('/fake/')) {
|
|
return res.end('fake img response')
|
|
}
|
|
next()
|
|
}
|
|
}
|