mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-08 07:06:37 +00:00
Fix browser tests
This commit is contained in:
parent
9892d57d67
commit
13f79e6a65
1
Makefile
1
Makefile
@ -5,7 +5,6 @@ deps:
|
|||||||
|
|
||||||
test: deps
|
test: deps
|
||||||
npm run test:all -- --exit
|
npm run test:all -- --exit
|
||||||
npx validate-maintainers orbit-db --match --ci
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
mkdir -p examples/browser/lib/
|
mkdir -p examples/browser/lib/
|
||||||
|
@ -1,31 +1,39 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
import { createRequire } from 'module'
|
||||||
|
|
||||||
export default (env, argv) => {
|
export default (env, argv) => {
|
||||||
|
const require = createRequire(import.meta.url)
|
||||||
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
|
const __dirname = path.dirname(__filename)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
mode: 'production',
|
||||||
entry: './src/OrbitDB.js',
|
entry: './src/OrbitDB.js',
|
||||||
output: {
|
output: {
|
||||||
libraryTarget: 'var',
|
filename: '../dist/orbitdb.min.js',
|
||||||
library: 'OrbitDB',
|
library: {
|
||||||
filename: '../dist/orbitdb.min.js'
|
name: 'OrbitDB',
|
||||||
|
type: 'var',
|
||||||
|
export: 'default'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mode: 'development',
|
|
||||||
target: 'web',
|
target: 'web',
|
||||||
devtool: 'none',
|
|
||||||
externals: {
|
externals: {
|
||||||
fs: '{}',
|
fs: '{ existsSync: () => true }',
|
||||||
|
'fs-shim': '{ existsSync: () => true }',
|
||||||
mkdirp: '{}'
|
mkdirp: '{}'
|
||||||
},
|
},
|
||||||
node: {
|
|
||||||
console: false,
|
|
||||||
Buffer: true,
|
|
||||||
mkdirp: 'empty'
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
|
new webpack.ProvidePlugin({
|
||||||
|
process: 'process/browser',
|
||||||
|
Buffer: ['buffer', 'Buffer']
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -33,8 +41,12 @@ export default (env, argv) => {
|
|||||||
'node_modules',
|
'node_modules',
|
||||||
path.resolve(__dirname, '../node_modules')
|
path.resolve(__dirname, '../node_modules')
|
||||||
],
|
],
|
||||||
alias: {
|
fallback: {
|
||||||
leveldown: 'level-js'
|
path: require.resolve('path-browserify'),
|
||||||
|
os: false,
|
||||||
|
fs: false,
|
||||||
|
constants: false,
|
||||||
|
stream: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
@ -42,7 +54,8 @@ export default (env, argv) => {
|
|||||||
'node_modules',
|
'node_modules',
|
||||||
path.resolve(__dirname, '../node_modules')
|
path.resolve(__dirname, '../node_modules')
|
||||||
],
|
],
|
||||||
moduleExtensions: ['-loader']
|
extensions: ['.js', '.json'],
|
||||||
|
mainFields: ['loader', 'main']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
package-lock.json
generated
24
package-lock.json
generated
@ -18597,18 +18597,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/orbit-db-identity-provider": {
|
"node_modules/orbit-db-identity-provider": {
|
||||||
"version": "0.4.1-699a573.0",
|
"version": "0.4.1-1f5a165.0",
|
||||||
"resolved": "https://registry.npmjs.org/orbit-db-identity-provider/-/orbit-db-identity-provider-0.4.1-699a573.0.tgz",
|
"resolved": "https://registry.npmjs.org/orbit-db-identity-provider/-/orbit-db-identity-provider-0.4.1-1f5a165.0.tgz",
|
||||||
"integrity": "sha512-zfYgJWIRsxJyUO+NRn6dTslGENWmotJN/JkzT/kSO7lPW9CqAOv+H71Eeg1frJ5/3qnhUn1nCEi2vyw5oEb0bA==",
|
"integrity": "sha512-8JnFS5Oz07Yg7sj+RsyuCBe6Rw2uKWZvPAajVBRJG0GOAdrb5DXle9xxs1SVL+hnu9ku007RgRmy4xtCpKo59Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ethersproject/wallet": "^5.0.10",
|
"@ethersproject/wallet": "^5.7.0",
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
"dids": "^3.4.0",
|
"dids": "^3.4.0",
|
||||||
"lru": "^3.1.0",
|
"lru": "^3.1.0",
|
||||||
"orbit-db-keystore": "^1.0.1-ae215fb.0",
|
"orbit-db-keystore": "next",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"stream-browserify": "^3.0.0",
|
"stream-browserify": "^3.0.0",
|
||||||
"uint8arrays": "^4.0.2"
|
"uint8arrays": "^4.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/orbit-db-identity-provider/node_modules/multiformats": {
|
"node_modules/orbit-db-identity-provider/node_modules/multiformats": {
|
||||||
@ -41829,18 +41829,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"orbit-db-identity-provider": {
|
"orbit-db-identity-provider": {
|
||||||
"version": "0.4.1-699a573.0",
|
"version": "0.4.1-1f5a165.0",
|
||||||
"resolved": "https://registry.npmjs.org/orbit-db-identity-provider/-/orbit-db-identity-provider-0.4.1-699a573.0.tgz",
|
"resolved": "https://registry.npmjs.org/orbit-db-identity-provider/-/orbit-db-identity-provider-0.4.1-1f5a165.0.tgz",
|
||||||
"integrity": "sha512-zfYgJWIRsxJyUO+NRn6dTslGENWmotJN/JkzT/kSO7lPW9CqAOv+H71Eeg1frJ5/3qnhUn1nCEi2vyw5oEb0bA==",
|
"integrity": "sha512-8JnFS5Oz07Yg7sj+RsyuCBe6Rw2uKWZvPAajVBRJG0GOAdrb5DXle9xxs1SVL+hnu9ku007RgRmy4xtCpKo59Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ethersproject/wallet": "^5.0.10",
|
"@ethersproject/wallet": "^5.7.0",
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
"dids": "^3.4.0",
|
"dids": "^3.4.0",
|
||||||
"lru": "^3.1.0",
|
"lru": "^3.1.0",
|
||||||
"orbit-db-keystore": "^1.0.1-ae215fb.0",
|
"orbit-db-keystore": "next",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"stream-browserify": "^3.0.0",
|
"stream-browserify": "^3.0.0",
|
||||||
"uint8arrays": "^4.0.2"
|
"uint8arrays": "^4.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"multiformats": {
|
"multiformats": {
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
"lint:docs": "remark -qf -u validate-links .",
|
"lint:docs": "remark -qf -u validate-links .",
|
||||||
"test:all": "npm run test:browser-multiple-tabs && npm run test",
|
"test:all": "npm run test:browser-multiple-tabs && npm run test",
|
||||||
"test": "cross-env TEST=all mocha --config test/.mocharc.json",
|
"test": "cross-env TEST=all mocha --config test/.mocharc.json",
|
||||||
"test:browser-multiple-tabs": "npm run build:dist && cpy dist/orbitdb.min.js ./test/browser/ --rename=orbitdb.js --flat && cpy node_modules/ipfs/index.min.js ./test/browser --rename=ipfs.js --flat && cpy node_modules/orbit-db-identity-provider/dist/index-browser.min.js ./test/browser --rename=identities.js --flat && cpy node_modules/ipfs-log/dist/ipfslog.min.js ./test/browser --flat && mocha ./test/browser/concurrent.spec.js",
|
"test:browser-multiple-tabs": "npm run build:dist && cpy dist/orbitdb.min.js ./test/browser/ --rename=orbitdb.js --flat && cpy node_modules/ipfs/index.min.js ./test/browser --rename=ipfs.js --flat && cpy node_modules/orbit-db-identity-provider/dist/orbit-db-identity-provider.min.js ./test/browser --rename=identities.js --flat && cpy node_modules/ipfs-log/dist/ipfslog.min.js ./test/browser --flat && mocha ./test/browser/concurrent.spec.js",
|
||||||
"build": "npm run build:es5 && npm run build:debug && npm run build:dist && npm run build:examples && npm run build:docs/toc",
|
"build": "npm run build:es5 && npm run build:debug && npm run build:dist && npm run build:examples && npm run build:docs/toc",
|
||||||
"build:examples": "webpack --config conf/webpack.example.config.js",
|
"build:examples": "webpack --config conf/webpack.example.config.js",
|
||||||
"build:dist": "webpack --config conf/webpack.config.js",
|
"build:dist": "webpack --config conf/webpack.config.js",
|
||||||
|
@ -23,6 +23,7 @@ describe(`orbit-db - browser concurrent writes`, function () {
|
|||||||
let browser
|
let browser
|
||||||
const options = {
|
const options = {
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
|
dumpio: true,
|
||||||
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
||||||
executablePath: chromium.path
|
executablePath: chromium.path
|
||||||
}
|
}
|
||||||
@ -43,6 +44,7 @@ describe(`orbit-db - browser concurrent writes`, function () {
|
|||||||
await page.goto(`file://${path.resolve('test/browser/index.html')}`)
|
await page.goto(`file://${path.resolve('test/browser/index.html')}`)
|
||||||
page.on('dialog', dialog => dialog.dismiss())
|
page.on('dialog', dialog => dialog.dismiss())
|
||||||
page.on('pageerror', err => console.error(err))
|
page.on('pageerror', err => console.error(err))
|
||||||
|
page.on('console', message => console.log(message))
|
||||||
await wait(1000)
|
await wait(1000)
|
||||||
return page
|
return page
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user