色々と考えた結果、もう少しちゃんとdAppsを勉強していこうとbuildspaceの「Build an Ethereum dApp」をやり始めています
buildspace
https://buildspace.so/p/build-solidity-web3-app
そしてやり始めた矢先、一番最初のhardhat test が何故かエラーになる始末。。。
c:\Dev\buildspace\ethreum-dapp\my-wave-portal>npx hardhat test
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Compiled 1 Solidity file successfully
Lock
Deployment
1) Should set the right unlockTime
√ Should set the right owner
2) Should receive and store the funds to lock
3) Should fail if the unlockTime is not in the future
Withdrawals
Validations
4) Should revert with the right error if called too soon
5) Should revert with the right error if called from another account
6) Shouldn't fail if the unlockTime has arrived and the owner calls it
Events
7) Should emit an event on withdrawals
Transfers
8) Should transfer the funds to the owner
1 passing (2s)
8 failing
1) Lock
Deployment
Should set the right unlockTime:
AssertionError: expected BigNumber { value: "1705326131" } to equal 1705326131
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:32:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
2) Lock
Deployment
Should receive and store the funds to lock:
AssertionError: expected BigNumber { value: "1000000000" } to equal 1000000000
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:46:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
3) Lock
Deployment
Should fail if the unlockTime is not in the future:
Error: Invalid Chai property: revertedWith
at Object.proxyGetter [as get] (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\node_modules\chai\lib\chai\utils\proxify.js:78:17)
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:55:64)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
4) Lock
Withdrawals
Validations
Should revert with the right error if called too soon:
Error: Invalid Chai property: revertedWith
at Object.proxyGetter [as get] (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\node_modules\chai\lib\chai\utils\proxify.js:78:17)
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:66:44)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
5) Lock
Withdrawals
Validations
Should revert with the right error if called from another account:
Error: Invalid Chai property: revertedWith
at Object.proxyGetter [as get] (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\node_modules\chai\lib\chai\utils\proxify.js:78:17)
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:80:66)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
6) Lock
Withdrawals
Validations
Shouldn't fail if the unlockTime has arrived and the owner calls it:
Error: Invalid Chai property: reverted
at Object.proxyGetter [as get] (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\node_modules\chai\lib\chai\utils\proxify.js:78:17)
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:93:48)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
7) Lock
Withdrawals
Events
Should emit an event on withdrawals:
Error: Invalid Chai property: emit. Did you mean "exist"?
at Object.proxyGetter [as get] (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\node_modules\chai\lib\chai\utils\proxify.js:75:17)
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:106:14)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
8) Lock
Withdrawals
Transfers
Should transfer the funds to the owner:
Error: Invalid Chai property: changeEtherBalances
at Object.proxyGetter [as get] (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\node_modules\chai\lib\chai\utils\proxify.js:78:17)
at Context.<anonymous> (C:\Dev\buildspace\ethreum-dapp\my-wave-portal\test\Lock.js:119:41)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
いや、まだロクに何もしていないのでこんなところでエラーが出るはずもないと思っているんだけど。。。という領域。
なんか、最近こういう、チュートリアルがそのまま動かずにやる気なくすというパターンが続くような気がする。
ただ、Discord見ているとできている人もいるので、なんだろう?
環境要因??
Powershellで試してみた
うーん、なんでだろう??と思って、ダメ元でPowershellでやってみたら。。。
PS C:\dev\buildspace\ethreum-dapp\my-wave-portal> npx hardhat test
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Lock
Deployment
√ Should set the right unlockTime (1301ms)
√ Should set the right owner
√ Should receive and store the funds to lock
√ Should fail if the unlockTime is not in the future
Withdrawals
Validations
√ Should revert with the right error if called too soon (66ms)
√ Should revert with the right error if called from another account
√ Shouldn't fail if the unlockTime has arrived and the owner calls it
Events
√ Should emit an event on withdrawals
Transfers
√ Should transfer the funds to the owner
9 passing (2s)
いや、おかしいだろ。
なんで コマンドプロンプトとPowershellで結果が違うんだよ。。。
かなりこれで時間つぶしてしまったぞ。。。畜生