1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Merge pull request #248 from oceanprotocol/feature/packages

package updates & test documentation
This commit is contained in:
Matthias Kretschmann 2019-06-13 09:54:55 +02:00 committed by GitHub
commit 4178a3d6b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 582 additions and 620 deletions

View File

@ -5,9 +5,7 @@ node_js:
services:
- docker
cache:
directories:
- node_modules
cache: npm
matrix:
fast_finish: true
@ -25,7 +23,7 @@ before_script:
- export BRIZO_VERSION=v0.3.10
- export KEEPER_VERSION=v0.9.7
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
- bash -x start_ocean.sh --latest --no-pleuston --local-spree-node 2>&1 > start_ocean.log &
- bash -x start_ocean.sh --no-pleuston --local-spree-node 2>&1 > start_ocean.log &
- cd ..
script:

View File

@ -23,8 +23,10 @@
- [Documentation](#documentation)
- [Development](#development)
- [Testing](#testing)
- [Unit Tests](#unit-tests)
- [Integration Tests](#integration-tests)
- [Production build](#production-build)
- [npm releases](#npm-releases)
- [Releases](#releases)
- [License](#license)
---
@ -93,40 +95,75 @@ npm i
npm start
```
### Testing
## Testing
To start unit tests you need to:
### Unit Tests
For unit tests, running [`ganache-cli`](https://github.com/trufflesuite/ganache-cli) is required before starting the tests:
```bash
ganache-cli &
npm run test
npm i -g ganache-cli
ganache-cli
```
or to watch for changes
To start unit tests, run:
```bash
npm test
```
or to watch for changes:
```bash
ganache-cli &
npm run test:watch
```
to create code coverage
to create code coverage information:
```bash
ganache-cli &
npm run test:cover
```
This will start a watcher for changes of the code.
### Integration Tests
`ganache-cli` can be installed following [this instructions](https://github.com/trufflesuite/ganache-cli#installation).
Besides a running `ganache-cli` instance, a locally running Ocean network is required. To do so before running the tests, use [Barge](https://github.com/oceanprotocol/barge):
### Production build
```bash
git clone https://github.com/oceanprotocol/barge
cd barge
./start_ocean.sh --latest --no-pleuston --local-spree-node
```
In another terminal window, run this script and export the seed phrase:
```bash
# copies the contract artifacts once the local Ocean network is up and running
./scripts/wait_for_migration_and_extract_keeper_artifacts.sh
# export Spree accounts seed phrase
export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off lamp"
```
Once everything is up, run the integration tests:
```bash
npm run integration
```
to generate code coverage information during test, run:
```bash
npm run integration:cover
```
## Production build
```bash
npm run build
```
### npm releases
## Releases
For a new **patch release**, execute on the machine where you're logged into your npm account:
@ -138,8 +175,8 @@ git tag with the latest version and `git push`
## License
```
Copyright 2018 Ocean Protocol Foundation Ltd.
```text
Copyright 2019 Ocean Protocol Foundation Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

1094
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@
"@oceanprotocol/keeper-contracts": "^0.9.7",
"bignumber.js": "^8.1.1",
"deprecated-decorator": "^0.1.6",
"node-fetch": "^2.3.0",
"node-fetch": "^2.6.0",
"save-file": "^2.3.1",
"uuid": "^3.3.2",
"web3": "1.0.0-beta.37",
@ -77,25 +77,25 @@
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/chai-spies": "^1.0.0",
"@types/mocha": "^5.2.6",
"@types/node": "^11.13.2",
"@types/node-fetch": "^2.3.0",
"@types/mocha": "^5.2.7",
"@types/node": "^12.0.5",
"@types/node-fetch": "^2.3.5",
"chai": "^4.2.0",
"chai-spies": "^1.0.0",
"cross-env": "^5.2.0",
"lcov-result-merger": "^3.1.0",
"mocha": "^6.1.2",
"mocha": "^6.1.4",
"mock-local-storage": "^1.1.8",
"nyc": "^14.1.0",
"nyc": "^14.1.1",
"source-map-support": "^0.5.12",
"truffle-hdwallet-provider": "^1.0.6",
"ts-node": "^8.0.3",
"tslint": "^5.15.0",
"truffle-hdwallet-provider": "^1.0.10",
"ts-node": "^8.2.0",
"tslint": "^5.17.0",
"typedoc": "^0.14.2",
"typescript": "^3.4.3",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"uglifyjs-webpack-plugin": "^2.1.3",
"webpack": "^4.33.0",
"webpack-cli": "^3.3.2",
"webpack-merge": "^4.2.1"
}
}

View File

@ -57,6 +57,6 @@ export class EventHandler extends Instantiable {
this.events.forEach((fn) => fn(this.lastBlock + 1))
this.lastBlock = blockNumber
}
this.lastTimeout = setTimeout(() => this.checkBlock(true, n++), this.interval)
this.lastTimeout = global.setTimeout(() => this.checkBlock(true, n++), this.interval)
}
}

View File

@ -6,7 +6,7 @@
"es2017",
"es6",
"es7",
"DOM"
"dom"
],
"declaration": true,
"module": "commonjs",
@ -27,7 +27,6 @@
],
"exclude": [
"node_modules",
"**/*.test.ts",
"src/examples"
"**/*.test.ts"
]
}