From e632941c520e9346fc706bb12d0434974c3f5a98 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Wed, 31 May 2023 23:12:04 -0700 Subject: Small improvements to `bun test` (#3071) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change status icon for skipped tests from "-" to "ยป" * Show file path instead of filename in `bun test` * Emit collapsable logs when running `bun test` in Github Actions https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines * Add fallback for test icons when emojis are not available * Only check for GITHUB_ACTIONS when running `bun test` * Emit error annotations when running `bun test` in Github Actions https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message * Remove ANSI output from Github annotation, it doesn't work * Remove outdated code from internal test runner * Add GithubActionFormatter to handle cases where error name or message is already ANSI * Fix formatting of test * Fix #3070 * Implement `bun test --run-todo` By default, `test.todo()` is no longer run, unless `--run-todo` is specified. * Fix test that relies on test.todo() being run * Support vitest-style test options * Disable GITHUB_ACTION in test harness * Add types for TestOptions * Fix bug where test.skip() actually ran * Implement `test.skipIf()` and `describe.skipIf()` * Implement `test.runIf()` * Move DiffFormatter to its own file * Fix bug where Bun.inspect() would emit a Github annotation * Introduce `bun test --only`, rename `--run-todo` to `--todo` * Implement `test.if()`, `describe.if()`, and other test fixes * Remove unwanted files from last commit * Fix last reference to --run-todo * Fix memory issues with printing github actions text * Update bindings.zig * Fix bug with `test.only()` * Remove debug test * Make the github annotations better * Improve .vscode/launch.json * Implement `expect().toBeNil()` * Remove .only() from test * Implement toBeBoolean(), toBeTrue(), toBeFalse() * Add lots of matchers * toBeNil() * toBeBoolean() * toBeTrue() * toBeFalse() * toBeNumber() * toBeInteger() * toBeFinite() * toBePositive() * toBeNegative() * toBeWithin() * toBeSymbol() * toBeFunction() * toBeDate() * toBeString() * toInclude() * toStartWith() * toEndWith() * Fix #3135 * Reduce verbosity of test * Fix snapshot bug --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/bun.js/test/jest.classes.ts | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'src/bun.js/test/jest.classes.ts') diff --git a/src/bun.js/test/jest.classes.ts b/src/bun.js/test/jest.classes.ts index bc2dbb1a1..8ed291ef5 100644 --- a/src/bun.js/test/jest.classes.ts +++ b/src/bun.js/test/jest.classes.ts @@ -234,6 +234,74 @@ export default [ fn: "toBeOdd", length: 0, }, + toBeNil: { + fn: "toBeNil", + length: 0, + }, + toBeBoolean: { + fn: "toBeBoolean", + length: 0, + }, + toBeTrue: { + fn: "toBeTrue", + length: 0, + }, + toBeFalse: { + fn: "toBeFalse", + length: 0, + }, + toBeNumber: { + fn: "toBeNumber", + length: 0, + }, + toBeInteger: { + fn: "toBeInteger", + length: 0, + }, + toBeFinite: { + fn: "toBeFinite", + length: 0, + }, + toBePositive: { + fn: "toBePositive", + length: 0, + }, + toBeNegative: { + fn: "toBeNegative", + length: 0, + }, + toBeWithin: { + fn: "toBeWithin", + length: 2, + }, + toBeSymbol: { + fn: "toBeSymbol", + length: 0, + }, + toBeFunction: { + fn: "toBeFunction", + length: 0, + }, + toBeDate: { + fn: "toBeDate", + length: 0, + }, + toBeString: { + fn: "toBeString", + length: 0, + }, + toInclude: { + fn: "toInclude", + length: 1, + }, + toStartWith: { + fn: "toStartWith", + length: 1, + }, + toEndWith: { + fn: "toEndWith", + length: 1, + }, }, }), ]; -- cgit v1.2.3