const path = require('path');

function resolve(relativePath) {
  return path.join(__dirname, relativePath);
}

var babelOptions = {
  "presets": [
    ["es2015", {"modules": false}]
  ]
}

const config = {
  entry: resolve('./Main/Fable.Tests.fsproj'),
  output: {
    path: resolve('../build/tests'),
    filename: 'bundle.js'
  },
  resolve: {
    modules: [
      "node_modules", resolve("../node_modules/")
    ]
  },
  module: {
    rules: [
      {
        test: /\.fs(x|proj)?$/,
        use: {
            loader: "fable-loader",
            options: {
                fableCore: resolve("../build/fable-core"),
                define: "DOTNETCORE",
                plugins: resolve("../build/nunit/Fable.Plugins.NUnit.dll"),
                babel: babelOptions
            }
        }
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: babelOptions
        },
      }
    ]
  }
};

module.exports = config;
@@ -22,16 +22,59 @@
 'path');
+%0Aconst fableUtils = require('fable-utils');
 %0A%0Afuncti
@@ -167,16 +167,47 @@
 tions = 
+fableUtils.resolveBabelOptions(
 %7B%0A  %22pre
@@ -254,17 +254,19 @@
 e%7D%5D%0A  %5D%0A
-
 %7D
+);
 %0A%0Aconst 

Resolve Babel options in tests