-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(core): add initial tests (#195)
- Loading branch information
Showing
12 changed files
with
3,523 additions
and
1,800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@clack/core": patch | ||
--- | ||
|
||
Fixes a bug which kept the terminal cursor hidden after a prompt is cancelled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
|
||
# Automatically cancel in-progress actions on the same branch | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build Packages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
- if: ${{ steps.cache-node.outputs.cache-hit != 'true' }} | ||
run: pnpm install | ||
# TODO: is this manual build step actually needed? | ||
# `prepack` hook _should_ run but doesn't seem to. | ||
- run: pnpm run type-check | ||
- run: pnpm run build | ||
- uses: changesets/action@v1 | ||
if: ${{ github.event_name != 'pull_request' }} | ||
with: | ||
version: pnpm run ci:version | ||
publish: pnpm run ci:publish | ||
commit: "[ci] release" | ||
title: "[ci] release" | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,13 +50,15 @@ | |
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "unbuild", | ||
"prepack": "pnpm build" | ||
"prepack": "pnpm build", | ||
"test": "vitest run" | ||
}, | ||
"dependencies": { | ||
"picocolors": "^1.0.0", | ||
"sisteransi": "^1.0.5" | ||
}, | ||
"devDependencies": { | ||
"vitest": "^1.6.0", | ||
"wrap-ansi": "^8.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Readable } from 'node:stream'; | ||
|
||
export class MockReadable extends Readable { | ||
protected _buffer: unknown[] | null = []; | ||
|
||
_read() { | ||
if (this._buffer === null) { | ||
this.push(null); | ||
return; | ||
} | ||
|
||
for (const val of this._buffer) { | ||
this.push(val); | ||
} | ||
|
||
this._buffer = []; | ||
} | ||
|
||
pushValue(val: unknown): void { | ||
this._buffer?.push(val); | ||
} | ||
|
||
close(): void { | ||
this._buffer = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Writable } from 'node:stream'; | ||
|
||
export class MockWritable extends Writable { | ||
public buffer: string[] = []; | ||
|
||
// biome-ignore lint/suspicious/noExplicitAny: any is the official type | ||
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null | undefined) => void): void { | ||
this.buffer.push(chunk.toString()); | ||
callback(); | ||
} | ||
} |
Oops, something went wrong.