How to install the Flow command-line interface (CLI)
It's possible to install Flow Javacript Testing Framework manually and automatically, using generator.
Create new folder and move into it:
1mkdir test && cd ./test
Install @onflow/flow-js-testing
1npm install @onflow/flow-js-testing
Generate complete setup via init
call:
1npx flow-js-testing init
Create new test suit via make
call, specifying the name of the suit:
1npx flow-js-testing make basic-test
If, for some reason, you would want to do this manually here's what you need to do.
Create new folder and move into it:
1mkdir test && cd ./test
Initiate a project in that folder with:
1npm init
Then install all necessary packages by running following command:
1npm install @onflow/flow-js-testing jest @babel/core @babel/preset-env babel-jest
If your project is JavaScript based, then run the above command from the folder that contains your project's package.json
file.
You'll need to configure Jest in order for tests to work properly.
Add jest.config.json
file next to package.json
and populate it with:
1{2"testEnvironment": "node",3"verbose": true,4"coveragePathIgnorePatterns": ["/node_modules/"],5"testTimeout": 500006}
Similarly, create babel.config.json
then copy and paste the following configuration:
1{2"presets": [3[4"@babel/preset-env",5{6"targets": {7"node": "current"8}9}10]11]12}