aragon / aragon-apps

(Aragon 1) Aragon apps developed by Aragon Core Devs (smart contracts + webapps)
https://aragon.org/discover
GNU Affero General Public License v3.0
388 stars 212 forks source link

Can't run tests in dev environment #1422

Open Guitlle opened 2 years ago

Guitlle commented 2 years ago

I wanted to learn from this repo so I cloned it but I couldn't pass from running tests. It seems to work with node 14 ( I couldn't use version 12). I did

yarn
yarn test:finance

and I got this error:

    Contract: Finance App
    Solidity stack traces only work with Solidity version 0.5.1 or higher.
        ✓ initialized first accounting period and settings (95ms)
        ✓ sets the end of time correctly (2870ms)
    (node:491653) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1050)
    (node:491653) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
        1) fails on reinitialization
        2) "before each" hook for "cannot initialize base app"

    2 passing (34s)
    2 failing

..../aragon-apps/node_modules/hardhat/internal/hardhat-network/stack-traces/solidity-errors.js:108
    return new SolidityCallSite(sourceReference.file.sourceName, sourceReference.contract, sourceReference.function !== undefined
                                                ^

TypeError: Cannot read property 'file' of undefined
(Use `node --trace-uncaught ...` to show where the exception was thrown)
npm ERR! code ELIFECYCLE

Any thoughts? What am I doing wrong?

welcome[bot] commented 2 years ago

Thanks for opening your first issue in the Aragon apps repo! Someone will circle back soon ⚡

Guitlle commented 2 years ago

I went to ..../aragon-apps/node_modules/hardhat/internal/hardhat-network/stack-traces/solidity-errors.js:108 and modified this function to this:

function sourceReferenceToSolidityCallsite(sourceReference) {
    if (sourceReference === undefined) {
        console.trace("DEBUG undefined source ref");
    }
    return new SolidityCallSite(sourceReference.file.sourceName, sourceReference.contract, sourceReference.function !== undefined
        ? sourceReference.function
        : solidity_stack_trace_1.UNKNOWN_FUNCTION_NAME, sourceReference.line);
}

Got this trace repeated several times:

Trace: DEBUG undefined source ref
    at sourceReferenceToSolidityCallsite (.../aragon-apps/node_modules/hardhat/internal/hardhat-network/stack-traces/solidity-errors.js:112:17)
    at encodeStackTraceEntry (.../aragon-apps/node_modules/hardhat/internal/hardhat-network/stack-traces/solidity-errors.js:82:20)
    at Function.Error.prepareStackTrace (.../aragon-apps/node_modules/hardhat/internal/hardhat-network/stack-traces/solidity-errors.js:47:30)
    at maybeOverridePrepareStackTrace (internal/errors.js:127:29)
    at prepareStackTrace (internal/errors.js:106:5)
    at Object.get (.../aragon-apps/node_modules/@nomiclabs/buidler/internal/util/lazy.js:133:39)
    at Web3HTTPProviderAdapter._sendJsonRpcRequest (.../aragon-apps/node_modules/@nomiclabs/buidler-web3/dist/web3-provider-adapter.js:41:49)
    at .../aragon-apps/node_modules/@nomiclabs/buidler-web3/dist/web3-provider-adapter.js:17:51
    at Callbackified (util.js:293:5)
    at Web3HTTPProviderAdapter.send (.../aragon-apps/node_modules/@nomiclabs/buidler-web3/dist/web3-provider-adapter.js:17:80)
    at RequestManager.send (.../aragon-apps/node_modules/@nomiclabs/truffle-contract/node_modules/web3-core-requestmanager/lib/index.js:162:23)
    at sendRequest (.../aragon-apps/node_modules/@nomiclabs/truffle-contract/node_modules/web3-core-method/lib/index.js:615:42)
    at Object.send [as getBlockByNumber] (.../aragon-apps/node_modules/@nomiclabs/truffle-contract/node_modules/web3-core-method/lib/index.js:642:13)
    at .../aragon-apps/node_modules/@nomiclabs/truffle-contract/node_modules/web3-core-method/lib/index.js:265:63