aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/test/jest.classes.ts (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-09-18feat(test): Implement `arrayContaining` (#5572)Gravatar WingLim 1-0/+12
* feat(test): implement `arrayContaining` * feat: early return when expectedArray is empty * feat: add test for toEqual * chore: use `JSC::isArray` * chore: use getIndex for performance * fix: use deepEqual --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-08-08feat(bun/test): Implement "toSatisfy" & "toIncludeRepeated" (fwup) (#3651)Gravatar Tiramify (A.K. Daniel) 1-0/+8
* Fix merge issues * oop * make codegen * Fix build issues --------- Co-authored-by: dave caruso <me@paperdave.net>
2023-07-28feat(bun/test): Impl. expect().pass() & expect().fail() (#3843)Gravatar Tiramify (A.K. Daniel) 1-0/+8
* Impl. pass & fail * fix * fix 2 * smol
2023-06-19feat(bun/test): Impl. "toBeArray", "toBeArrayOfSize" & "toBeTypeOf" (#3316)Gravatar Tiramify (A.K. Daniel) 1-0/+12
* Implement toBeArray, toBeArrayOfSize, toBeTypeOf * fix typos/variable names * Add testcases for regex and dates * little fix * i didn't paste that...
2023-06-09`toMatchObject` and some asymmetric matchers (#3260)Gravatar Dylan Conway 1-0/+35
* `toMatchObject` progress * add `expect.stringContaining()` * add `expect.stringMatching()` * print asymmetric matchers * cleanup * return before printing if constructor value isn't there * move matcher logic to cpp * pretty format and tests * fix formatting for snapshots * format `stringContaining` and `stringMatching` like jest * better test * remove commented tests * remove old property matcher code * add types * make sure all props are matched in arrays * add `Bun.deepMatch`
2023-06-09Implement mocks in bun:test (#3252)Gravatar Jarred Sumner 1-0/+4
* wip * wip * most of the code for mocks in bun:test * finishing up * Implement `toHaveBeenCalled` and `toHaveBeenCalledTimes(1)` * Test * visit * results, not returnValues * exact * Update jest.zig * A couple more tests * Add jest.fn * support resetting mocks * Implement spyOn --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-31Small improvements to `bun test` (#3071)Gravatar Ashcon Partovi 1-0/+68
* 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>
2023-05-26Implement `expect().toBeEmpty()` (#3060)Gravatar Ashcon Partovi 1-8/+13
* Implement `expect().toBeEmpty()` * Fix formatting on test * Finish up expect().toBeEmpty() * Update expect.test.ts --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-30Bun Test matchers even/odd. Also, .toContains fix and truthy (#2754)Gravatar Will Richards 2 1-0/+8
* bun test matcher tests for even/odd, few more truthy tests, and fix for contains empty string * implementation of even/odd matchers * didn't add the codegen bindings * linted
2023-03-14Implement `toMatchSnapshot()` (#2294)Gravatar Dylan Conway 1-0/+12
* buggy snapshot * error output for failed snapshot * missing first * hints * open dir once, better cleanup * update flag * truncate on update * object and class snapshot formatting * array formatting * no function name, single item is empty array * string objects, maps, sets, promise * avoid using invalid memory * handle number objects * handle extending `Number` * boolean objects * snapshot tests and test updates * snapshot format for buffers * safer snapshot parsing * property matchers setup * strings and tests * generate classes with empty prototype * optional `propertyMatchers` parameter * new test folder structure * strings.eqlLong * globalObject.throwPretty() and expect.any tests * add updateSnapshot flag to help * move snapshot format out of `printErrorlikeObject` * empty object snapshot format * separate typed array, remove trailing comma * use `isCell`, object trailing commas * handle unicode * todo for primitive constructors * switch to `JSC.Node.Syscall.open` and `JSC.Maybe` * use js parser for snapshot files * deinit ast, log parse error * copy/paste most of `exports.ZigConsoleClient` * remove snapshot option * remove ordered properties option * remove snapshot format option from `exports.zig` * remove extra newlines * change mode * update test runner output * escape backticks faster * `bunx jest` in temp dir * remove buffered writer * add `toMatchSnapshot` to types * cleanup, switch to `pread` * cli `--update` flag * `--update-snapshots` * remove string object format
2023-02-06Mark some things as not configurableGravatar Jarred Sumner 1-0/+1
2022-11-28toHaveProperty and tests (#1558)Gravatar Dylan Conway 1-1/+1
* toHaveProperty and tests * emoji tests
2022-11-18bun test matchers and tests (#1526)Gravatar Dylan Conway 1-0/+24
* ignore webkit for cherry-pick * toContain and toBeTruthy * toBe null, undefined, falsy, toHaveProperty, .not * markBindings * remove toHaveProperty, undo ignore webkit, more tests * undo ignore webkit * remove bad tests * check if length property exists for toHaveLength() * fix call signature * handle argument that is not an integer * getLengthOfArray returns u64 * switch to truncate * toHaveLength() edge cases * add toBooleanSlow() * infinity, nan, negative
2022-11-15add generated getter/setter type with thisValue (#1513)Gravatar Dylan Conway 1-0/+3
2022-11-07[bun:test] Implement `expect` in faster Zig bindingsGravatar Jarred Sumner 1-0/+186