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: services:
- docker - docker
cache: cache: npm
directories:
- node_modules
matrix: matrix:
fast_finish: true fast_finish: true
@ -25,7 +23,7 @@ before_script:
- export BRIZO_VERSION=v0.3.10 - export BRIZO_VERSION=v0.3.10
- export KEEPER_VERSION=v0.9.7 - export KEEPER_VERSION=v0.9.7
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260" - 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 .. - cd ..
script: script:

View File

@ -22,9 +22,11 @@
- [Examples](#examples) - [Examples](#examples)
- [Documentation](#documentation) - [Documentation](#documentation)
- [Development](#development) - [Development](#development)
- [Testing](#testing) - [Testing](#testing)
- [Production build](#production-build) - [Unit Tests](#unit-tests)
- [npm releases](#npm-releases) - [Integration Tests](#integration-tests)
- [Production build](#production-build)
- [Releases](#releases)
- [License](#license) - [License](#license)
--- ---
@ -93,40 +95,75 @@ npm i
npm start 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 ```bash
ganache-cli & npm i -g ganache-cli
npm run test ganache-cli
``` ```
or to watch for changes To start unit tests, run:
```bash
npm test
```
or to watch for changes:
```bash ```bash
ganache-cli &
npm run test:watch npm run test:watch
``` ```
to create code coverage to create code coverage information:
```bash ```bash
ganache-cli &
npm run test:cover 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 ```bash
npm run build npm run build
``` ```
### npm releases ## Releases
For a new **patch release**, execute on the machine where you're logged into your npm account: 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 ## License
``` ```text
Copyright 2018 Ocean Protocol Foundation Ltd. Copyright 2019 Ocean Protocol Foundation Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with 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", "@oceanprotocol/keeper-contracts": "^0.9.7",
"bignumber.js": "^8.1.1", "bignumber.js": "^8.1.1",
"deprecated-decorator": "^0.1.6", "deprecated-decorator": "^0.1.6",
"node-fetch": "^2.3.0", "node-fetch": "^2.6.0",
"save-file": "^2.3.1", "save-file": "^2.3.1",
"uuid": "^3.3.2", "uuid": "^3.3.2",
"web3": "1.0.0-beta.37", "web3": "1.0.0-beta.37",
@ -77,25 +77,25 @@
"devDependencies": { "devDependencies": {
"@types/chai": "^4.1.7", "@types/chai": "^4.1.7",
"@types/chai-spies": "^1.0.0", "@types/chai-spies": "^1.0.0",
"@types/mocha": "^5.2.6", "@types/mocha": "^5.2.7",
"@types/node": "^11.13.2", "@types/node": "^12.0.5",
"@types/node-fetch": "^2.3.0", "@types/node-fetch": "^2.3.5",
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-spies": "^1.0.0", "chai-spies": "^1.0.0",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"lcov-result-merger": "^3.1.0", "lcov-result-merger": "^3.1.0",
"mocha": "^6.1.2", "mocha": "^6.1.4",
"mock-local-storage": "^1.1.8", "mock-local-storage": "^1.1.8",
"nyc": "^14.1.0", "nyc": "^14.1.1",
"source-map-support": "^0.5.12", "source-map-support": "^0.5.12",
"truffle-hdwallet-provider": "^1.0.6", "truffle-hdwallet-provider": "^1.0.10",
"ts-node": "^8.0.3", "ts-node": "^8.2.0",
"tslint": "^5.15.0", "tslint": "^5.17.0",
"typedoc": "^0.14.2", "typedoc": "^0.14.2",
"typescript": "^3.4.3", "typescript": "^3.4.3",
"uglifyjs-webpack-plugin": "^2.1.2", "uglifyjs-webpack-plugin": "^2.1.3",
"webpack": "^4.29.6", "webpack": "^4.33.0",
"webpack-cli": "^3.3.0", "webpack-cli": "^3.3.2",
"webpack-merge": "^4.2.1" "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.events.forEach((fn) => fn(this.lastBlock + 1))
this.lastBlock = blockNumber 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", "es2017",
"es6", "es6",
"es7", "es7",
"DOM" "dom"
], ],
"declaration": true, "declaration": true,
"module": "commonjs", "module": "commonjs",
@ -27,7 +27,6 @@
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"**/*.test.ts", "**/*.test.ts"
"src/examples"
] ]
} }