Commit 6ea847cb authored by Linshizhi's avatar Linshizhi

backup

parent 09e3099b
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
// Generated on Tue Apr 19 2022 21:54:47 GMT+0800 (China Standard Time) // Generated on Tue Apr 19 2022 21:54:47 GMT+0800 (China Standard Time)
const path = require('path'); const path = require('path');
const os = require('os');
const webpack_path = path.resolve(__dirname, 'dist');
module.exports = function(config) { module.exports = function(config) {
config.set({ config.set({
// base path that will be used to resolve all patterns (eg. files, exclude) // base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '/home/linshizhi/Codebase/ParaEncode', basePath: '',
// frameworks to use // frameworks to use
// available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter // available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter
...@@ -18,10 +16,8 @@ module.exports = function(config) { ...@@ -18,10 +16,8 @@ module.exports = function(config) {
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
{ pattern: webpack_path + '/*.js', included: true, served: true }, { pattern: 'tmp/spec_bundle.js', included: true },
{ pattern: 'src/**/*.js', included: true }, { pattern: 'src/**/*.js', included: false, served: true },
{ pattern: 'tests/**/*.spec.js', included: true },
{ pattern: 'tests/**/*.js', included: true }
], ],
// list of files / patterns to exclude // list of files / patterns to exclude
...@@ -35,18 +31,14 @@ module.exports = function(config) { ...@@ -35,18 +31,14 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser // preprocess matching files before serving them to the browser
// available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor // available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor
preprocessors: { preprocessors: {},
"resources/**/*.js": ["webpack"],
"src/**/*.js": ["webpack"],
"tests/**/*.spec.js": ["webpack"],
"tests/**/*.js": ["webpack"]
},
webpack: { webpack: {
entry: './specs.js',
mode: 'development', mode: 'development',
output: { output: {
filename: '[name].js', filename: 'spec_bundle.js',
path: webpack_path, path: path.resolve(__dirname, 'tmp'),
}, },
}, },
......
const testsContext = require.context('./tests', true, /.spec.js$/);
testsContext.keys().forEach(testsContext);
const path = require('path'); const path = require('path');
const webpack = require("webpack");
module.exports = { module.exports = {
entry: './index.js', entry: './specs.js',
mode: 'development', mode: 'development',
output: { output: {
publicPath: 'dist/', filename: 'spec_bundle.js',
filename: 'bundle.js', path: path.resolve(__dirname, 'tmp'),
path: path.resolve(__dirname, 'dist'),
}, },
mode: 'development',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
})
]
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment