You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
WSL2 on Windows 10 "@openzeppelin/test-environment": "^0.1.4"
CLI 2.8.2
node v10.19.0
npm 6.14.5
Installing the dependency resolves the issue: npm i @truffle/debug-utils
run test
$ npm run test
> [email protected] test /home/abcoathup/projects/forum/box
> mocha --exit --recursive test
Error: Cannot find module '@truffle/debug-utils'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/abcoathup/projects/forum/box/node_modules/@truffle/contract/lib/promievent.js:2:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/abcoathup/projects/forum/box/node_modules/@truffle/contract/lib/execute.js:2:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/abcoathup/projects/forum/box/node_modules/@truffle/contract/lib/contract/index.js:4:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/abcoathup/projects/forum/box/node_modules/@truffle/contract/index.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.tryRequire [as default] (/home/abcoathup/projects/forum/box/node_modules/try-require/index.js:18:16)
at TruffleLoader.get [as truffleContract] (/home/abcoathup/projects/forum/box/node_modules/@openzeppelin/contract-loader/src/index.ts:139:29)
at TruffleLoader.fromABI (/home/abcoathup/projects/forum/box/node_modules/@openzeppelin/contract-loader/src/index.ts:125:30)
at TruffleLoader.BaseLoader.fromArtifact (/home/abcoathup/projects/forum/box/node_modules/@openzeppelin/contract-loader/src/index.ts:79:17)
at Object.<anonymous> (/home/abcoathup/projects/forum/box/test/Box.test.js:8:22)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /home/abcoathup/projects/forum/box/node_modules/mocha/lib/mocha.js:314:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/abcoathup/projects/forum/box/node_modules/mocha/lib/mocha.js:311:14)
at /home/abcoathup/projects/forum/box/node_modules/mocha/lib/mocha.js:347:12
at new Promise (<anonymous>)
at Mocha.loadFilesAsync (/home/abcoathup/projects/forum/box/node_modules/mocha/lib/mocha.js:346:12)
at singleRun (/home/abcoathup/projects/forum/box/node_modules/mocha/lib/cli/run-helpers.js:107:15)
at exports.runMocha (/home/abcoathup/projects/forum/box/node_modules/mocha/lib/cli/run-helpers.js:144:11)
at Object.exports.handler (/home/abcoathup/projects/forum/box/node_modules/mocha/lib/cli/run.js:306:11)
at Object.runCommand (/home/abcoathup/projects/forum/box/node_modules/yargs/lib/command.js:242:26)
at Object.parseArgs [as _parseArgs] (/home/abcoathup/projects/forum/box/node_modules/yargs/yargs.js:1096:28)
at Object.parse (/home/abcoathup/projects/forum/box/node_modules/yargs/yargs.js:575:25)
at Object.exports.main (/home/abcoathup/projects/forum/box/node_modules/mocha/lib/cli/cli.js:68:6)
at Object.<anonymous> (/home/abcoathup/projects/forum/box/node_modules/mocha/bin/mocha:133:29)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha --exit --recursive test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/abcoathup/.npm/_logs/2020-05-05T05_40_58_392Z-debug.log
Box.sol
// contracts/Box.sol
pragma solidity ^0.5.0;
contract Box {
uint256 private value;
// Emitted when the stored value changes
event ValueChanged(uint256 newValue);
// Stores a new value in the contract
function store(uint256 newValue) public {
value = newValue;
emit ValueChanged(newValue);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return value;
}
}
// test/Box.test.js
// Load dependencies
const { accounts, contract } = require('@openzeppelin/test-environment');
const { expect } = require('chai');
// Load compiled artifacts
const Box = contract.fromArtifact('Box');
// Start test block
describe('Box', function () {
const [ owner ] = accounts;
beforeEach(async function () {
// Deploy a new Box contract for each test
this.contract = await Box.new({ from: owner });
});
// Test case
it('retrieve returns a value previously stored', async function () {
// Store a value - recall that only the owner account can do this!
await this.contract.store(42, { from: owner });
// Test if the returned value is the same one
// Note that we need to use strings to compare the 256 bit integers
expect((await this.contract.retrieve()).toString()).to.equal('42');
});
});
The text was updated successfully, but these errors were encountered:
Running example test from Learn guides (https://docs.openzeppelin.com/learn/writing-automated-tests) errors with:
Error: Cannot find module '@truffle/debug-utils'
WSL2 on Windows 10
"@openzeppelin/test-environment": "^0.1.4"
CLI
2.8.2
node
v10.19.0
npm
6.14.5
Installing the dependency resolves the issue:
npm i @truffle/debug-utils
run test
Box.sol
Box.test.js
from https://docs.openzeppelin.com/learn/writing-automated-tests
The text was updated successfully, but these errors were encountered: