I had a small problem learning the MoCHA testing framework and the Ganache-CLI testing environment
Install the video in the test code to write the following rules
Install the video in the test code to write the following rules
const assert = require('assert'); const ganache = require('ganache-cli'); //If a variable begins with a capital letter, it is a constructor const Web3 = require('web3'); //Plug the ganache test network card into web3. const web3 = new Web3(ganache.provider()); describe('Testing Smart Contracts',()=>{ it('Testing the web3 version',()=>{ console.log(web3.version); }); });
Then enter NPM Run Test on the Terminal page
Cannot find module ‘./build/Release/scrypt’
Location is (F: \ MyEclipseWorkspace, Solidity, the Inbox, node_modules \ scrypt \ index js: 3:20)
Change the line code to
//var scryptNative = require(“./build/Release/scrypt”)
var scryptNative = require(“scrypt”)
Run the output test results again
Read More:
- Module build failed: error: cannot find module ‘node sass’ error
- Cannot find module ‘internal / util / types’ appears during gulp build
- Module build failed: error:couldn’t find preset “env” relative to directory
- Error: could not find a version that satisfies the requirement flake8 (from versions: none) (Fixed)
- Execution failed for task :Test:lintVitalRelease/Lint found fatal errors while assembling a release
- Can not start, can not find QT pligins “windows” problem after installing QT vs environment 2021-06-13
- Multithreading: when doing unit test, use thread pool to find that the specified code is not running and skip directly
- failed to find Build Tools revision 23.0.2 Install Build Tools 23.0.2 and sync project
- Webpack error module build failed: typeerror: fileSystem.statSync is not a function
- Android studio reported an error in the release package: Lint found fatal errors while assembling a release target
- Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit
- appear Error:java : javacTask: source release 1.7 requires target release 1.7
- javac Task Error source release 1.7 requires target release
- Error in react build packaging test environment
- Solution to electron error “cannot find module app”
- Module build failed Error Plugin/Preset files are not allowed to export objects, only functions (How to Fix)
- Java in idea: warning: source release 11 needs to be resolved by target release 11
- Error: Rule can only have one resource source (provided resource and test + include + exclude)
- NPM- Cannot find module ‘xxxxx’
- Error reported after moving or copying Vue items: cannot find module ‘xxx‘