solana-developers / create-solana-dapp

CLI for creating Solana dApps on the fly
https://npmjs.com/package/create-solana-dapp
MIT License
363 stars 108 forks source link

Add back the jest config file or fix the issue with importing jest inside the tests #91

Closed Reblixt closed 1 month ago

Reblixt commented 1 month ago

2024-10-12-232321_hyprshot

This happends now when i create a new npx create-solana-dapp

and do these commands in the followoing order:

cd ./new-dapp/anchor
anchor build
anchor test

if i do as the complier suggested. remove import @types/jest and add import 'jest'; then the test works but... my editor looks like this instead. a wall of syntax error on every ( describe, it, expect)

2024-10-12-232725_hyprshot

I have tried to have both import "@types/jest"; import "jest";

Imported but the test fails anyway because of the import.

My setup

Arch linux

node version 
v20.17.0 LTS

Solana version
solana-cli 1.18.25 (src:92ddaa20; feat:3241752014, client:Agave)

anchor version 
anchor-cli 0.30.1

avm version   
avm 0.30.1

rust version
rustup 1.27.1 (2024-05-07)
beeman commented 1 month ago

Thanks for creating the issue, I will get this fixed after the weekend!

beeman commented 1 month ago

Just started digging into this.

I got the tests running by:

image

With these changes, the tests run. I do still see similar errors when I open the project in nvim, strangely enough WebStorm and VS Code don't show them.

I'll keep digging into this, but the above 2 steps might unblock you.

beeman commented 1 month ago

I've made the above changes (and a bunch more) in the relevant template and set up a GitHub Actions workflow to make sure the tests run on CI.

I hope this fixes the issues with newly created projects. If it doesn't, don't hesitate to ping me here and I'll re-open the issue investigate further.