Migrate to Deno#32
Conversation
There was a problem hiding this comment.
I removed LinkGlob.test.ts, since import.meta.glob is a vite-specific API. I wasn't sure what to do instead.
| "@std/assert": "jsr:@std/assert@1", | ||
| "@std/expect": "jsr:@std/expect@1", | ||
| "@std/testing": "jsr:@std/testing@1", | ||
| "vitest": "./testlib/mod.ts", |
There was a problem hiding this comment.
I replaced vite with the Deno testing facilities, mostly to reduce our dependencies.
If vitest does have some nice advantages, we should switch back to it.
| "dev": "deno run --watch main.ts" | ||
| }, | ||
| "imports": { | ||
| "yargs": "https://deno.land/x/yargs@v17.7.2-deno/deno.ts" |
There was a problem hiding this comment.
I could simply import most dependencies from npm, but Deno usually has a nicer built-in alternative. So I figured I'd properly do the migration.
Yargs is a pretty good dependency though. The only alternative worth considering that I could find is https://cliffy.io/ .
| - `deno lint` for linting | ||
| - `deno fmt` for formatting | ||
| - `deno test --allow-read` to run the unit tests | ||
| - To update the snapshots, run `deno test --allow-all -- --update` No newline at end of file |
There was a problem hiding this comment.
It's all deno! 🦕
I guess that unified tooling aspect is reasonably nice. Hopefully the Node.js ecosystem will catch up and also get more unified tooling.
|
For the plugin test project, we can probably use https://www.npmjs.com/package/@deno/vite-plugin Actually nevermind,
|
After having tried out the mini-parse migration, I thought of a few more tricks to make the migration easier. This is my WIP attempt to migrate everything.
Tasks to do:
Mostly mechanical edits I did
.js"to.ts""mini-parseto"@wesl/mini-parsectx.task.nametoctx.nametest.skiptotest.ignoretoMatchSnapshot. There is an asyncassertSnapshotfunction in@std/testing/snapshotinstead. So I pulled out ast-grep to mostly mechanically do the editssg --pattern 'expect($MATCH1).toMatchInlineSnapshot($MATCH2)' --rewrite 'await assertSnapshot(ctx, $MATCH1)' --lang ts --interactiveandsg --pattern 'expect($MATCH1).toMatchSnapshot()' --rewrite 'await assertSnapshot(ctx, $MATCH1)' --lang ts --interactive