siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
77 lines (55 loc) • 2.21 kB
JavaScript
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const paths = require('./paths');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const WebpackWatchedGlobEntries = require('webpack-watched-glob-entries-plugin');
const lodash = require('lodash');
/*-------------------------------------*/
/* Regular development webpack project */
const regularDev = require('./webpack.config.dev.js')
// patch to always output to "build" directory (works fine with "npm start")
regularDev.output.path = paths.appBuild
/* EOF Regular development webpack project */
/*-----------------------------*/
/* Siesta's web interface page */
const siestaWebInterface = lodash.cloneDeep(regularDev)
siestaWebInterface.entry = [
paths.siestaProject || (paths.appSrc + '/siesta.js')
]
siestaWebInterface.output.filename = 'static/siesta-web-interface/bundle.js'
lodash.remove(siestaWebInterface.plugins, plugin => plugin instanceof HtmlWebpackPlugin)
siestaWebInterface.plugins.push(
new HtmlWebpackPlugin({
inject : true,
filename : 'siesta.html',
template : paths.siestaHtml || 'public/siesta.html'
}),
new CopyWebpackPlugin([
{ from : 'node_modules/siesta-lite/resources', to : 'static/siesta-lite/resources' }
])
)
/* EOF Siesta's web interface page */
/*-----------------------------------*/
/* Transpilation of individual tests */
const testsTranspilation = lodash.cloneDeep(regularDev)
testsTranspilation.entry = WebpackWatchedGlobEntries.getEntries(
[
path.resolve(__dirname, '../src/tests/**/*.t.js'),
],
{
// // Optional glob options that are passed to glob.sync()
// ignore: '**/*.test.js'
}
)
testsTranspilation.output.filename = 'TRANSPILED/src/tests/[name].js'
lodash.remove(testsTranspilation.plugins, plugin => plugin instanceof HtmlWebpackPlugin)
testsTranspilation.plugins.push(
new WebpackWatchedGlobEntries()
)
/* EOF Transpilation of individual tests */
module.exports = [
regularDev,
siestaWebInterface,
testsTranspilation
];
;