@ryanflorence/testing-123
v0.0.3
Published
The simplest typescript package template I can think of.
Downloads
119
Readme
package-name
The simplest typescript package template I can think of.
- Node built-in testing:
node:test
andnode:assert
- TypeScript with Node's
--experimental-strip-types
instead of compiling - Develop, test, debug directly in your code with VSCode's built-in features, no CLI + console.log shenanigans
- Publish with
npm version
and a GitHub action
Setting up
- Install Node Test Runner Extension
- Click the "Testing" tab in the VSCode Activity Bar
- Reload VSCode Window or restart vscode if you don't see any tests in the sidebar
Development
- Open a test file
- Click the testing buttons in the gutter to run a test
- Set breakpoints in the gutter and run the test in the debugger (click the play button in the error popup with the bug on it)
Keyboard shortcuts
- Run all tests in the current file with
Command + ; + f
- Run current test at the cursor with
Command + ; + c
Playing around
You can run any file in the debugger with F5. Or click the debug icon in the Activity Bar and click the play button up top.
CI Scripts
# run tests
pnpm test
# compile typescript to ./dist
pnpm build
Releasing
Setup
First add an NPM token to your GitHub repository secrets. Log into npm to get one.
Publishing a Release
Create a tag and update package.json with npm version
# npm version patch | minor | major
npm version patch
Then push to GitHub.
git push origin main --tags
The GitHub action will match the tag and release.