Hardhat test failed (offcial example) - testing

I am doing Hardhat offcial example to test smart contract.
I did it step by step, but step 5 (testing contract) is wrong for me.
enter image description here
It shows something like the img.
Thanks for your help.
I also meet the problem when I deploy the contract.
They are similar the same problem about package -> #nomiclabs/hardhat-ethers.

Related

Why can I not deploy this BEP20 token with Remix?

I am trying to deploy this contract
https://github.com/juustesout/EtherRanger/blob/main/EtherRanger.sol
to BSC Testnet, and I get this error in return :
"revert
The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
Debug the transaction to get more information. "
this is an example of a failed transaction on BSC Testnet
https://testnet.bscscan.com/tx/0x5cbe0adcf6a522d89c974cadf70358dd9d79476988b4fb829fc1cc86c88aff0c
I tried forking multiple contracts from BSC, working tokens, but I always get the same error. I tried adding 'payable' to the constructor function, as other StackOverflow posts suggest, but no go. I have been reading any number of posts through Google Search, but I am getting nowhere.
The contracts compile flawless, no errors, no warnings, but they just won't deploy.
Could someone check if they can deploy this contract on BSC Testnet ? It may be a setting on my Remix or something, I am at a loss, I cannot tell where the error comes from.
I don’t know anything about this contract but I guess the hardcoded addresses for the IBEP20 and others are the problem. You need to deploy these contracts too and then pass their addresses to the interface addresses in your constructor.
But to connect to the BSC test network, you need to find the drop-down menu with a list of networks at the top of the MetaMask
https://domhtml.ru/en/sozdanie-sobstvennyh-tokenov-standarta-bep-20-v-seti-binance-smart-chain-bsc-pri-pomoshhi-remix-ide/

How to find ARA-M sample APDUs?

I am trying to interface an applet in my USIM and an Android application.
I know that I have to install ARA-M applet on USIM in order to check access controls and submit my application-AID as a rule to communicate.
I checked this link and installed it on my sim, but I cannot communicate with this applet, all samples are using GlobalPlatformPro. when I run a commands like gp.exe --list, it returns 0x57 from ScardTransmit function which means ERROR_INVALID_PARAMETER and I don't know how to fix it.
Now I have 2 questions:
1) How can I fix GlobalPlatformPro error in order to run ARA-M samples?
2) How can I find standard commands for this applet (some sample APDUs to communicate and add access control rules)?
Thank you for helping.
I found the answer.
There is a paper on the matter here. It is a good place to get started. Global Platform has a repository here where you can find ARA applet and four test applets to get started.
The Global Platform Secure Element Access Control can also be a useful reference for those who are at the start point, like me.

Can testcafe afterEach() fixture calls know whether the test passed or not?

My Fixture looks like this:
fixture`Admitted: Happy Path`
.page(environment.admitted)
.requestHooks(logger)
.afterEach(logErrors);
logErrors logs all the API errors from that test, however I would only like to log them if the test failed. Is there a way to tell if the test that just finished succeeded in fixture.afterEach()?
I've provided several approaches to solve this issue in the following question.
Please refer to it.

How do I see the contract log events in Ethereum?

I finished the https://www.ethereum.org/crowdsale tutorial in Ethereum and intentionally left the crowdsale having failed its funding goal (sample code at the start of the page). I fired the "safeWithdrawal" function from within Ethereum-Wallet and it adds the transaction on to the blockchain. But at this point I do not know how to listen to the response. The ether I sent was not returned.
I would like the ether to be returned.
I would like to know how to listen to the event that should have fired. Or any feedback mechanism to know that the why / how the event fired.
Screenshot: http://i.stack.imgur.com/2lsVo.png
Currently, the Ethereum-Wallet has no debugger built-in for smart contracts.
I suggest, you code up your example using the browser-solidity. It allows you not only to code and test the deployment but got most recently a debugger built in. Click the little bug.
The debugger used in browser solidity is remix which is both a javascript IDE but also a library which can be attached to your own javascript projects. It is possible that future releases of Ethereum-Wallet will also include remix, this would simplify your task pretty much.
But for now, the mentioned browser tool seems like perfectly suited for your needs.

Sonarqube API single class test coverage

I am trying to retrieve the unit test code coverage for individual classes through the SonarQube API (Sonar version 4.1.2). Everything is working fine, and I can see the metrics okay when I go directly to the sonar dashboard and go to the coverage tab for a class:
93.9% by unit tests Line coverage: 97.9% (285/291) Branch coverage: 85.0% (113/133)
Can anyone tell me the correct call to retrieve this same/similar information through the sonar API interface please? I've already had a look at the documentation at http://docs.sonarqube.org/display/SONAR/Metric+definitions and can get test coverage metrics back at project level but I can't see how to construct a query for individual classes.
I think this is what you are after
[hostname]/api/resources?resource=[com.test]:[module-name]:[fully qualified class]&metrics=coverage,branch_coverage
I have added an example below.
http://sonar-server/api/resources?resource=com.test:module:com.test.service.impl.CheckServiceImpl&metrics=coverage,branch_coverage
I looked at the page you shared and used this also :
http://docs.codehaus.org/pages/viewpage.action?pageId=229743280
api/measures/component_tree is your friend
result = session.get(
SONAR_BASE + "api/measures/component_tree",
params={"baseComponentId": COMPONENT, "metricKeys": "coverage" )
)
gets you coverage down to the file level. You should be able to only get the files with the "leaves" strategy.