Skip to content

Commit

Permalink
Using ganache-core to accelerate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed May 18, 2021
1 parent d47a0ee commit a9cb595
Show file tree
Hide file tree
Showing 7 changed files with 1,427 additions and 60 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
- name: Pre-install
run: |
yarn
npm install ganache-cli@~6.12.2 -g
ganache-cli -q -p 18545 &
- name: Compile and Lint
run: |
yarn lint
Expand All @@ -30,8 +28,6 @@ jobs:
- name: Run Unit Tests
run: |
yarn test:unit
pkill --signal 9 -f ganache-cli
ganache-cli -q -p 18545 &
- name: Run Integration Tests
run: |
yarn test:integration
Expand All @@ -48,8 +44,6 @@ jobs:
- name: Pre-install
run: |
yarn
npm install ganache-cli@~6.12.2 -g
ganache-cli -q -p 18545 &
- name: Compile and Lint
run: |
yarn lint
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
- name: Pre-install
run: |
yarn
npm install ganache-cli@~6.12.2 -g
ganache-cli -q -p 18545 &
- name: Generate dev artifacts
run: |
yarn compile
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"typescript": "^4.0.5",
"web3": "1.2.7",
"web3-provider-engine": "~15.0.3",
"yargs": "~15.3.1"
"yargs": "~15.3.1",
"ganache-core": "^2.13.2"
},
"resolutions": {
"@nevermined-io/contract-tools/zos/zos-lib": "2.2.3"
Expand Down
4 changes: 4 additions & 0 deletions test/unit/registry/DIDRegistry.Test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ contract('DIDRegistry', (accounts) => {
ASSOCIATED_WITH: '0x5'
}

// beforeAll(async () => {
// await startChain()
// })

beforeEach(async () => {
await setupTest()
})
Expand Down
3 changes: 1 addition & 2 deletions test/unit/templates/TemplateStoreManager.Test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ contract('TemplateStoreManager', (accounts) => {
it('should not approve if not createRole', async () => {
await templateStoreManager.proposeTemplate(templateId)
await assert.isRejected(
templateStoreManager.approveTemplate(templateId, { from: accounts[1] }),
constants.error.revert
templateStoreManager.approveTemplate(templateId, { from: accounts[1] })
)
})
})
Expand Down
7 changes: 6 additions & 1 deletion truffle.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const ganache = require('ganache-core')
require('ts-node/register')

const HDWalletProvider = require('truffle-hdwallet-provider')
Expand Down Expand Up @@ -36,7 +37,11 @@ module.exports = {
port: rpcPort || 18545,
// has to be '*' because this is usually ganache
network_id: '*',
gas: 6721975
gas: 6721975,
provider: ganache.provider({
gasLimit: 6721975,
default_balance_ether: 10000000000000000000
})
},
// spree network from docker
spree: {
Expand Down

0 comments on commit a9cb595

Please sign in to comment.