mediawiki-extensions-Popups/tests/node-qunit/run.js
Stephen Niedzielski 4eb9c0efa8 Hygiene: move SVG string to file
- Add SVG Inline Loader for Webpack. This allows SVG files to be
  imported.

- Update the Webpack and test configurations to use the new loader.

- Scope the ESLint rules down to just JavaScript files so that linting
  isn't attempted on the SVG.

Bug: T165036
Change-Id: I00bccff4c3167975c19d577be6343dcaca7ddb2d
2018-03-14 12:04:28 -07:00

22 lines
459 B
JavaScript

#!/usr/bin/env node
const fs = require( 'fs' ),
svgInlineLoader = require( 'svg-inline-loader' );
require( 'babel-register' )( {
presets: [
[ 'env', {
targets: {
node: 6
}
} ]
]
} );
require.extensions[ '.svg' ] = ( module, filename ) => {
const svg = fs.readFileSync( filename, { encoding: 'utf8' } );
// eslint-disable-next-line no-underscore-dangle
module._compile( svgInlineLoader( svg ), filename );
};
require( 'mw-node-qunit' );