Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

sol-cover: TypeError: this.removeListener is not a function #1886

Open
mo-h8 opened this issue Jun 23, 2019 · 1 comment
Open

sol-cover: TypeError: this.removeListener is not a function #1886

mo-h8 opened this issue Jun 23, 2019 · 1 comment

Comments

@mo-h8
Copy link

mo-h8 commented Jun 23, 2019

I'm attempting to use @0x/sol-coverage and I'm running into issues with tests not completing. These tests listen for events. I have added added a websocketSubProvider to provider used in truffle-config.js

Here is the terminal output:

Contract: Example (End to End tests)
    ✓ Test 1) (46ms)
    1) Test 2
TypeError: this.removeListener is not a function
    at Object.receipt (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/handlers.js:134:1)
    at Function.start (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/override.js:56:1)
    at <anonymous>
TypeError: this.removeListener is not a function
    at Object.receipt (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/handlers.js:134:1)
    at Function.start (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/override.js:56:1)
    at <anonymous>
/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:707
  err.uncaught = true;
               ^
TypeError: Cannot create property 'uncaught' on string 'abort({}). Build with -s ASSERTIONS=1 for more info.'
    at Runner.uncaught (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:707:16)
    at process.uncaught (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:821:10)
    at emitOne (events.js:116:13)
    at process.emit (events.js:211:7)
    at process.emit (/usr/local/lib/node_modules/truffle/build/webpack:/~/source-map-support/source-map-support.js:461:1)
    at processEmit [as emit] (/usr/local/lib/node_modules/truffle/build/webpack:/~/signal-exit/index.js:155:1)
    at process._fatalException (bootstrap_node.js:375:26)`

truffle-config.js:

const ProviderEngine = require("web3-provider-engine");
const RpcSubProvider = require("web3-provider-engine/subproviders/rpc.js");
const WebsocketSubprovider = require("web3-provider-engine/subproviders/websocket.js");
const { TruffleArtifactAdapter } = require('@0x/sol-trace');
const projectRoot = '.';
const solcVersion = '0.5.9';
const artifactAdapter = new TruffleArtifactAdapter(projectRoot, solcVersion);

const { CoverageSubprovider } = require("@0x/sol-coverage");
const defaultFromAddress = "0x5409ed021d9299bf6814279a6a1411a7e866a631"; // Some ethereum address with test funds
const coverageSubprovider = new CoverageSubprovider(artifactAdapter, defaultFromAddress);

const provider = new ProviderEngine();
provider.addProvider(new RpcSubProvider({rpcUrl: 'http://localhost:7545'}));
provider.addProvider(coverageSubprovider);
provider.addProvider(new WebsocketSubprovider({rpcUrl: 'ws://localhost:7545/ws'}));

provider.start(err => {
  if (err !== undefined) {
    console.log(err);
    process.exit(1);
  }
});

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  networks: {
    development: {
      provider: function() {
        return provider;
      },
      network_id: "*", // Match any network id
      // websockets: true
    }
  },
  compilers: {
    solc: {
      version: "^0.5.9", 
    }
  }
};
@fabioberger fabioberger changed the title [sol-cover] TypeError: this.removeListener is not a function sol-cover: TypeError: this.removeListener is not a function Jun 26, 2019
@stale
Copy link

stale bot commented Jul 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 26, 2019
@fabioberger fabioberger added pinned and removed stale labels Jul 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants