test-walkontable.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. 'use strict';
  2. /**
  3. * Config responsible for building Walkontable test files (bundled into `src/3rdparty/walkontable/test/dist/`):
  4. * - specs.entry.js
  5. * - helpers.entry.js
  6. */
  7. const path = require('path');
  8. const webpack = require('webpack');
  9. const JasmineHtml = require('./plugin/jasmine-html');
  10. const wotPath = path.resolve(__dirname, '../src/3rdparty/walkontable');
  11. module.exports.create = function create(envArgs) {
  12. const config = {
  13. target: 'web',
  14. devtool: 'cheap-module-source-map',
  15. output: {
  16. libraryTarget: 'var',
  17. filename: '[name].entry.js',
  18. path: path.resolve(wotPath, 'test/dist'),
  19. },
  20. module: {
  21. rules: [
  22. {
  23. test: /\.js$/,
  24. loader: 'babel-loader',
  25. exclude: [
  26. /node_modules/,
  27. ],
  28. options: {
  29. cacheDirectory: true,
  30. },
  31. }
  32. ]
  33. },
  34. externals: [
  35. {
  36. window: 'window',
  37. },
  38. ],
  39. plugins: [
  40. // This helps ensure the builds are consistent if source code hasn't changed
  41. new webpack.optimize.OccurrenceOrderPlugin(),
  42. new JasmineHtml({
  43. filename: path.resolve(wotPath, 'test/SpecRunner.html'),
  44. baseJasminePath: '../../../../',
  45. externalCssFiles: [
  46. '../css/walkontable.css',
  47. ],
  48. externalJsFiles: [
  49. 'helpers/jasmine-bridge-reporter.js',
  50. 'lib/jquery.min.js',
  51. 'lib/jquery.simulate.js',
  52. '../dist/walkontable.js',
  53. ],
  54. })
  55. ],
  56. };
  57. return [].concat(config);
  58. }