diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..e853acf31 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,44 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Mocha Current Spec File", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/node_modules/.bin/mochapack", + "args": [ + "--webpack-config", "config/webpack/test.js", + "--require", "spec/javascript/setup.js", + "--timeout", "999999", + "--colors", + "${file}" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Mocha All JS Specs", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/node_modules/.bin/mochapack", + "args": [ + "--webpack-config", "config/webpack/test.js", + "--require", "spec/javascript/setup.js", + "--timeout", "999999", + "--colors", + "spec/javascript/**/*.spec.js" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + ] +} \ No newline at end of file diff --git a/config/webpack/test.js b/config/webpack/test.js index 321927ccf..824bef674 100644 --- a/config/webpack/test.js +++ b/config/webpack/test.js @@ -12,8 +12,16 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'test' process.env.RAILS_ENV = process.env.RAILS_ENV || 'test' const environment = require('./environment') +const nodeExternals = require('webpack-node-externals'); -const babelLoader = environment.loaders.get('babel') -babelLoader.include.push(babelLoader.include[0].concat('../../test')) +environment.config.merge({ + output: { + devtoolModuleFilenameTemplate: '[absolute-resource-path]', + devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]' + }, + mode: 'development', + externals: [nodeExternals()], + devtool: 'inline-cheap-module-source-map' +}) module.exports = environment.toWebpackConfig() diff --git a/package.json b/package.json index e40d24416..125d30ad9 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,10 @@ "mocha-junit-reporter": "^1.23.3", "mochapack": "^1.1.15", "webpack-cli": "^3.3.11", - "webpack-dev-server": "^3.10.3" + "webpack-dev-server": "^3.10.3", + "webpack-node-externals": "^1.7.2" }, "scripts": { - "test": "mochapack --webpack-config config/webpack/test.js --require test/setup.js test/**/*.spec.js" + "test": "mochapack --webpack-config config/webpack/test.js --require spec/javascript/setup.js --colors 'spec/javascript/**/*.spec.js'" } } diff --git a/test/setup.js b/spec/javascript/setup.js similarity index 100% rename from test/setup.js rename to spec/javascript/setup.js diff --git a/yarn.lock b/yarn.lock index a53662438..fe6d9fe16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8089,6 +8089,11 @@ webpack-log@^2.0.0: ansi-colors "^3.0.0" uuid "^3.3.2" +webpack-node-externals@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-1.7.2.tgz#6e1ee79ac67c070402ba700ef033a9b8d52ac4e3" + integrity sha512-ajerHZ+BJKeCLviLUUmnyd5B4RavLF76uv3cs6KNuO8W+HuQaEs0y0L7o40NQxdPy5w0pcv8Ew7yPUAQG0UdCg== + webpack-sources@^1.0.0, webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"