This updates ESLint and our shared eslint-config-openlayers to use Prettier. Most formatting changes were automatically applied with this:
npm run lint -- --fix
A few manual changes were required:
* In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
* In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason. While editing this, I reworked `ExampleBuilder` to be a class.
* In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
129 lines
3.0 KiB
JavaScript
129 lines
3.0 KiB
JavaScript
const path = require('path');
|
|
|
|
module.exports = function (karma) {
|
|
karma.set({
|
|
browsers: ['Chrome'],
|
|
browserDisconnectTolerance: 2,
|
|
frameworks: ['mocha'],
|
|
client: {
|
|
runInParent: true,
|
|
mocha: {
|
|
timeout: 2500,
|
|
},
|
|
},
|
|
files: [
|
|
{
|
|
pattern: path.resolve(
|
|
__dirname,
|
|
require.resolve('url-polyfill/url-polyfill.js')
|
|
),
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: 'module-global.js',
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: path.resolve(
|
|
__dirname,
|
|
require.resolve('jquery/dist/jquery.js')
|
|
),
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: path.resolve(__dirname, require.resolve('expect.js/index.js')),
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: path.resolve(__dirname, require.resolve('sinon/pkg/sinon.js')),
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: path.resolve(
|
|
__dirname,
|
|
require.resolve('proj4/dist/proj4.js')
|
|
),
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: path.resolve(
|
|
__dirname,
|
|
require.resolve('pixelmatch/index.js')
|
|
),
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: path.resolve(__dirname, './test-extensions.js'),
|
|
},
|
|
{
|
|
pattern: path.resolve(__dirname, './index_test.js'),
|
|
watched: false,
|
|
},
|
|
{
|
|
pattern: '**/*',
|
|
included: false,
|
|
watched: false,
|
|
},
|
|
],
|
|
exclude: ['**/*.test.js'],
|
|
proxies: {
|
|
'/rendering/': '/base/rendering/',
|
|
'/spec/': '/base/spec/',
|
|
},
|
|
preprocessors: {
|
|
'**/*.js': ['webpack', 'sourcemap'],
|
|
},
|
|
reporters: ['dots', 'coverage-istanbul'],
|
|
coverageIstanbulReporter: {
|
|
reports: ['text-summary', 'html'],
|
|
dir: path.resolve(__dirname, '../coverage/'),
|
|
fixWebpackSourcePaths: true,
|
|
},
|
|
webpack: {
|
|
devtool: 'inline-source-map',
|
|
mode: 'development',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env'],
|
|
},
|
|
},
|
|
include: path.resolve('src/ol/'),
|
|
exclude: path.resolve('node_modules/'),
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
use: {
|
|
loader: 'istanbul-instrumenter-loader',
|
|
options: {
|
|
esModules: true,
|
|
},
|
|
},
|
|
include: path.resolve('src/ol/'),
|
|
exclude: path.resolve('node_modules/'),
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
use: {
|
|
loader: path.join(
|
|
__dirname,
|
|
'../examples/webpack/worker-loader.js'
|
|
),
|
|
},
|
|
include: [path.join(__dirname, '../src/ol/worker')],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
webpackMiddleware: {
|
|
noInfo: true,
|
|
},
|
|
});
|
|
|
|
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
|
};
|