nuxt / scripts

Plug-and-play script optimization for Nuxt applications. (Public Preview)
https://scripts.nuxt.com
MIT License
126 stars 8 forks source link

refactor(tpc): move tests to AST instead of code snapshots #99

Closed huang-julien closed 6 days ago

huang-julien commented 1 week ago

This PR Refactor TPC tests. Snapshots slows way too much the develomement of TPC. It uses now AST to test the generation of TPC composables

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
scripts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2024 5:51pm
scripts-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2024 5:51pm
harlan-zw commented 6 days ago

I admire the code and effort gone into this, but personally, I think a human-readable snapshot is more useful for something that shouldn't be changing that frequently. It also looks like substantially more effort to maintain.

Given you're looking after this though, I am happy to merge, can you just fix the conflict.

huang-julien commented 6 days ago

Thanks ! I'll regen the lockfile then merge it.

The reason behind removing snapshots is that any modification will force to update the snapshot. Moving it to AST allows more flexibility in the code generation without having to update for change. I admit this is a bit more complex to read but we can remove it later if it is too complex for future contributors.