test: add bin CLI tests#1424
Conversation
|
This might be a really heavy breaking change, because some projects rely on a complete path to We have one example in the docs: So just FYI, please be aware of that we e.g. should have a compatibly layer or similar for this, so we don't break to many workflows out there. |
|
That makes sense yeah, I am aware, actually I have tried babel and a few other use cases, I'm still going to test more stuff ❯ pnpm run babel create example
> [email protected] babel /npgm
> babel-node node_modules/node-pg-migrate/bin/node-pg-migrate.js "create" "example"
Created migration -- /npgm/migrations/1748716088549_example.jsyet, while I was trying docs example: {
"scripts": {
// ..
"migrate": "ts-node node_modules/.bin/node-pg-migrate.js -j ts",
},
}
just to confirm, error: > ts-node node_modules/.bin/node-pg-migrate.js -j ts "create" "test"
node:internal/modules/cjs/loader:1252
throw err;
^
Error: Cannot find module './node-pg-migrate.js'
Require stack:if you remove > ts-node node_modules/node-pg-migrate/bin/node-pg-migrate.js -j ts "create" "test"
Created migration -- /npgm/migrations/1748717477579_test.tsI'll test other cases to see if anything breaks with this change to |
|
Closing this for now, will make something better with #1390 containers soon. |

This is still a work in progress and might be a good fit to go alongside #1390 or something similar.
I moved the
bincode intosrcto make it easier to test without relying onspawnSync,execa, or similar tools. This also helps Vitest show more accurate coverage.The most important part of this PR is probably the tests, I'm still planning to improve them further. The
cliRunnerhelper could use some cleanup or a full rewrite later on, and maybe separate some logic to make unit testing easier...