Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TS test running when project is first initialized with japa #7

Merged
merged 5 commits into from
Jan 14, 2025

Conversation

Barabasbalazs
Copy link
Contributor

πŸ”— Linked issue

#6

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

When using this script with the TS options for initializing a project for example with the following method:

npm init japa@latest .

the npm run test command will throw some errors because:

  1. It's using ts-node which has some old esm flags enabled
  2. It does not initialize a proper tsconfig.json so the ts compiler does not know how to run the test command

So to fix this, the PR has the following changes:

  1. Changed ts-node for ts-node-maintained, and updated the test command accordingly
  2. Added @swc/core devDependency so the ts compiler can transpile the code
  3. If the project is using TypeScript, the cli will create a basic tsconfig.json file with the following minimal settings:
{
   "compilerOptions": {
     "module": "NodeNext",
    }
}

this way the test command will run properly.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@Barabasbalazs
Copy link
Contributor Author

@thetutlage I checked out why the pipeline failed and it seems that some of the dependencies like poppins/exception release-it don't support node v18.16.0 anymore, and that causes the pipeline to fail.

I updated the workflow files and the package.json accordingly, so it better reflects what version of node this project supports.

@thetutlage
Copy link
Contributor

@Barabasbalazs Thanks for the PR. I think I missed it because I wasn't watching this repo notifications

@thetutlage thetutlage merged commit 2702d09 into japa:2.x Jan 14, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants