Truffle Test - How To Show Errors Only - solidity

How does one suppress all compilation warnings (not errors) when running truffle test? Using the --quiet parameter does not seem to work.
Truffle v5.0.0 (core: 5.0.0)
Node v10.15.3

You can't suppress warnings, no such functionality yet in Truffle.
However, you can filter the output. I'm going to show an example using grep.
~/your_project_dir$ truffle test | grep 'Error'
This will show only the lines which contain the word "Error".

Related

ESLint command in terminal returning error

Does anyone else get the same error message when running the command eslint filename.js on the Terminal (bash in VS Code).
I have just installed ESlint and have done npm install etc.
Here's the error message I get: error message screenshot:
I have opened the files under 'require stack' and tried to find 'mkdirp' there to change it to 'mkdir' instead. Any idea if this would help?
I believe there are multiple errors but I am new to this and don't know how to correct them. I have also tried the command after running npm update but got the same error message.

Truffle init not creating Migration.sol file

Output for truffle version command:
"Truffle v5.5.27 (core: 5.5.27)
Ganache v7.4.0
Solidity - 0.8.16 (solc-js)
Node v16.16.0
Web3.js v1.7.4"
truffle init does give a success message as below
"Init successful, sweet!
Try our scaffold commands to get started:
$ truffle create contract YourContractName # scaffold a contract
$ truffle create test YourTestName # scaffold a test"
and creates folders and truffle-config.js(refer screenshot) but does NOT create Migration.sol file.
I did try to run the command with sudo but to no avail.
I am using a mac m1.
Please advise.
At last I have got the solution of it. In this case, no need to use truffle init command. You just simply need to go through the command:
truffle unbox
or, you can also set more specific path with the same command:
truffle unbox metacoin [PATH/TO/DIRECTORY]
100% working...
According this thread, Truffle has removed the inclusion of Migration.sol on npx truffle init command since v5.5.27. Now when you run npx truffle init, it includes the following -
an empty contracts folder.\
an empty migrations folder.\
an empty test folder.\
a .gitignore file. \
a truffle-config.js file.\

Issues running truffle: command not found

I'm trying to deploy a Smart Contract, before that I need to run truffle compile but I get the error
bash: truffle: command not found
I've installed truffle with npm globally and locally, I tried these commands (worked for someone else in my course)
npm init
npm i truffle
./node_modules/.bin/truffle init
but when I run
npm i truffle
I get "unsupported architecture" amongst tons of other errors. all of these fixes are not working, how can I fix this problem from the root of it?
Also trying sudo:
sudo npm install -g truffle
does install it i guess but also gives the error:
truffle#5.4.14 postinstall /Users/khalidhamid/.npm-
global/lib/node_modules/truffle
> node ./scripts/postinstall.js
Error: EACCES: permission denied, open
'/Users/khalidhamid/Library/Preferences/truffle-
nodejs/config.json'
regardless, it still gives truffle: command not found
Is there any specific reason to install truffle using npm i truffle in your project? I mean, just install it globally and cd into your new directory and use truffle init to craft a new project. This way you can use truffle architecture to write your contracts and also use all available truffle commands. Also using truffle config file you can change the solidity compiler version according to your needs.

What executes on 'npm test' when script doesn't specified?

In my project there is no script for test, there is no also Jest or mocha, but result of npm run test is
> myproject#0.1.0 test /path/to/project
> echo 'Error: no test specified'
Error: no test specified
and return code 0, but for logic it should be code 1.
I know about config flag ignore-scripts with false value, but as I understood its about pre- and post- scripts. Also I read about Jest that is npm 'smart' and can detected, but as wrote previous there is no jest package.
npm -v
6.14.13
node -v
v12.22.3
Does it only for npm v6 and is this fixed in v7 that returns code 1?
Please explain this or give some links because I couldn't find any helpful
Behaviour changed in npm#7, now it occurs an error
https://github.com/npm/cli/blob/latest/CHANGELOG.md#npm-test

run sample test case of uiveri5 show error "Reference Error: describe is not defined"

I installed the #ui5/uiveri5 globally correctly. I download the ui-uiveri5 repository, then I go to directory of sample\apiTesting, and run the command
uiveri5 APITesting.spec
it report following error:
C:\src\open\ui5-uiveri5\sample\apiTesting\APITesting.spec.js:2
describe('APITesting', function() {
^
ReferenceError: describe is not defined
Please guide me on how to solve this issue. ( It report the same issue after I install the jasmine-node, mocha globally).
No need to install jasmine or mocha, just install uiveri5 globally with npm install #ui5/uiveri5 -g. Can you please try again, I merged a fix for another small issue. And with it, this sample starts fine.