mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-01 19:56:37 +00:00

* Get browsers tests running * Clean up replication test * Setup fixtures for browser tests * Fix import paths for webpack * Fix webpack * Add mocha-headless-chrome to run browser tests * Add webrtc swarm endpoints for browser test IPFS node configs * Remove adding pubkey to storage in KeyStore * Runs browser tests in CI * Fix import paths again * Fix failing browser tests * Fixes
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
import glob from 'glob'
|
|
import path from 'path'
|
|
import webpack from 'webpack'
|
|
import { fileURLToPath } from 'url'
|
|
import { createRequire } from 'module'
|
|
|
|
export default (env, argv) => {
|
|
const require = createRequire(import.meta.url)
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
|
|
return {
|
|
entry: glob.sync('./test/**/*.js', { ignore: [] }),
|
|
output: {
|
|
filename: '../test/browser/bundle.js'
|
|
},
|
|
target: 'web',
|
|
mode: 'development',
|
|
devtool: 'source-map',
|
|
experiments: {
|
|
topLevelAwait: true
|
|
},
|
|
externals: {
|
|
fs: '{ existsSync: () => true }',
|
|
'fs-extra': '{ copy: () => {} }',
|
|
rimraf: '() => {}'
|
|
},
|
|
plugins: [
|
|
new webpack.ProvidePlugin({
|
|
process: 'process/browser',
|
|
Buffer: ['buffer', 'Buffer']
|
|
})
|
|
],
|
|
resolve: {
|
|
modules: [
|
|
'node_modules',
|
|
path.resolve(__dirname, '../node_modules')
|
|
],
|
|
fallback: {
|
|
path: require.resolve('path-browserify'),
|
|
os: false,
|
|
fs: false,
|
|
constants: false,
|
|
stream: false
|
|
}
|
|
},
|
|
resolveLoader: {
|
|
modules: [
|
|
'node_modules',
|
|
path.resolve(__dirname, '../node_modules')
|
|
],
|
|
extensions: ['.js', '.json'],
|
|
mainFields: ['loader', 'main']
|
|
}
|
|
}
|
|
}
|