aboutsummaryrefslogtreecommitdiff
path: root/src/cli/test_command.zig (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-05-31Small improvements to `bun test` (#3071)Gravatar Ashcon Partovi 1-20/+58
* 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-26Fix crash in test.todo + remove JSC C API usages in bun:test (#3079)Gravatar Jarred Sumner 1-1/+1
* Fix crash in test.todo * remove usages of JSC C API in bun:test * Remove additional JSC-C API usages * fix `make headers` * URLSearchParams.length * FormData length * URLSearchParams length * Fix `make headers` * very fancy length * Fix bug with exceptions being ignored sometimes * Add tests for extension toHaveLength --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-24Load `.env.test`, set NODE_ENV=test in `bun test`, load ↵Gravatar Jarred Sumner 1-1/+3
`.env.{test,production,development}.local` (#3037) * Support `.env.test` & `.env.{test,production,development}.local` * Fix bug preventing inlining of process.env.NODE_ENV by default * Update env_loader.zig * add env tests --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: dave caruso <me@paperdave.net>
2023-05-23Implement `bun test --timeout` (#3040)Gravatar Ashcon Partovi 1-0/+1
You can change the default per-test timeout in `bun test`: > bun test --timeout 10 The default timeout is 5000.
2023-05-23[bun:test] Don't schedule the GC aggressively on every fileGravatar Jarred Sumner 1-1/+10
We already run the GC automatically whenever heap size grows, so this is mostly unnecessary In one benchmark, this is an 83% performance improvement at a cost of 9% more memory
2023-05-23Support setting a timezone with `process.env.TZ` and `Bun.env.TZ` (#3018)Gravatar Jarred Sumner 1-0/+13
* Support setting a timezone via `process.env.TZ` * Implement `setTimeZone` in `bun:jsc` module * [breaking] `bun:test` now defaults to `Etc/UTC` timezone --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-20[bun:test] `preload` now supports `beforeAll`, `beforeEach`, `afterAll`, ↵Gravatar Jarred Sumner 1-2/+11
`afterEach` hooks Towards #198
2023-05-20Implement `test.todo` (#2961)Gravatar Degreat 1-5/+44
* Implement `test.todo` * remove skip condition * Allow callbacks in .todo * Add descriptive comment * Log todos * Include tests in title * edit test.todo tests --------- Co-authored-by: dave caruso <me@paperdave.net>
2023-05-11[bun test] Add timings to successful testsGravatar Jarred Sumner 1-7/+16
2023-05-09Fix regression with `bun test` not recursively scanning the directory treeGravatar Jarred Sumner 1-2/+16
2023-05-08Fix bug in Bun.build() where it wouldn't pick up changes to directories on ↵Gravatar Jarred Sumner 1-2/+3
rebuilds (#2824) Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-19Fix broken autocompleteGravatar Jarred Sumner 1-6/+6
2023-03-28`bun --watch` and `bun test --watch` (#2500)Gravatar Jarred Sumner 1-0/+16
* --watch wip * Upgrade for latest zig * Implement `bun --watch` * Implement `bun test --watch` * Auto restart on crash in --watch * :clock1: :clock2: :clock3: :clock330: --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-19[bun test] Implement `--rerun-each` flag to run each test N timesGravatar Jarred Sumner 1-38/+54
2023-03-14Condense snapshot outputGravatar Jarred Sumner 1-20/+27
2023-03-14Implement `toMatchSnapshot()` (#2294)Gravatar Dylan Conway 1-0/+48
* 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-28Expose JSC::Options via `BUN_JSC_` prefixGravatar Jarred Sumner 1-1/+1
Example usage: BUN_JSC_logGC=1 bun file.js
2023-02-28Implement `preload` support (like `node -r ` except in a config file) (#2231)Gravatar Jarred Sumner 1-0/+1
* Update Makefile * Introduce `preload` * Add a test * Support entry points --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-02-23Upgrade Zig (#2151)Gravatar Dylan Conway 1-2/+2
* fixup * Upgrade Zig * Remove bad assertion * strings * bump * mode -> optimize * optimize * Linux build * Update bindgen.zig
2023-02-22wiptest -> test (#2131)Gravatar Dylan Conway 1-2/+7
* +/- for object diff, quote more strings * wiptest -> test * quote strings fix
2023-02-09[bun:test] Auto-import jest globals in test filesGravatar Jarred Sumner 1-0/+1
2023-01-30report invalid input file as test failure (#1938)Gravatar Alex Lam S.L 1-0/+1
fixes #1935
2023-01-16Make entire test line dimGravatar Jarred Sumner 1-2/+2
2023-01-16[bun:test] Fix dim, fix missing spaceGravatar Jarred Sumner 1-4/+2
2023-01-14fix bugs (#1795)Gravatar Alex Lam S.L 1-3/+8
- segfault reading stacktrace from `fs/promises` rejections - `Promise` rejection within `describe()` ends testing abruptly - `FSSink.write()` incorrectly handles `objectMode` - `FSSink.write()` throws wrong error codes
2023-01-13[bun:test] Always dim skipGravatar Jarred Sumner 1-1/+1
2023-01-13move more thingsGravatar Jarred SUmner 1-5/+5
2023-01-13Split some things into more files and use bun namespace instead of import moreGravatar Jarred SUmner 1-1/+1
2023-01-12fix(bun-test): test title in results (#1753)Gravatar Ethan Burrell 1-2/+6
* fix(bun-test): test title in results * missed case * clean up import * respond to reviews
2023-01-09Update test_command.zigGravatar Jarred Sumner 1-2/+2
2023-01-09fixupGravatar Jarred Sumner 1-5/+5
2023-01-09Update test_command.zigGravatar Jarred Sumner 1-3/+3
2023-01-09RenameGravatar Jarred Sumner 1-18/+21
2023-01-09Update test_command.zigGravatar Jarred Sumner 1-6/+8
2023-01-09[bun:test] Implement `test.skip`Gravatar Jarred Sumner 1-21/+84
2022-12-28Upgrade to latest Zig (#1610)Gravatar Jarred Sumner 1-4/+4
* @min and @max * builtins and some trivial ones * Most of them * more * more! * More Progress * wip * Update tagged_pointer.zig * Update http_client_async.zig * Most of the iterable dir changes * alright * Remove usages of deprecated formatters * :camera: * fmt * Update shimmer.zig * wip * wip * wip * progress * more * Latest * stuck on error * latest * workaround stage2 * wip * Update string_immutable.zig * wip * Migrate `Dirent` and `require("fs')` to use JSC<>Zig bindings * Fix build errors * Fixup most of the test failures * Fix `make headers` * Fix "outside package path" error * Fixup aligned alloc * Add missing file * linux * More linux fixes * use latest peechy * Fix transpiler test failure * Forgot about these * Fixup test failure * Update node-timers.test.ts * [node:htt] Fix `undefined is not an object` error Fixes https://github.com/oven-sh/bun/issues/1618 * Update http.exports.js * Make this test less flaky * fix hashes * Fix hex formatting and zls issues * Download zig version * Update Dockerfile * Update Dockerfile * Update uws * Update Dockerfile * Set llvm version * Update README.md * Update uws * Update Dockerfile * Update io_linux.zig * Update bun.zig * Log output * workaround strange @cInclude error * Make ffi tests better * Don't use cImport * Update c.zig * Update c-bindings.cpp * call setOutputDir * Update Dockerfile * Use a longer name * latest * Update serve.test.ts Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-12-01Fix crash in test runner with gc modeGravatar Jarred Sumner 1-1/+3
2022-11-29import everything from "bun" where possibleGravatar Jarred Sumner 1-7/+7
2022-11-27don't start NetworkThread unless necessaryGravatar Jarred Sumner 1-1/+0
2022-11-23Remove extra newlinesGravatar Jarred Sumner 1-1/+1
2022-11-20Make it yellowGravatar Jarred Sumner 1-1/+1
2022-11-20Print a countGravatar Jarred Sumner 1-20/+46
2022-11-19Introduce `BUN_GARBAGE_COLLECTOR_LEVEL` debug environment variableGravatar Jarred Sumner 1-6/+1
2022-11-14Bugfixes and perf improvements to child_processGravatar Jarred SUmner 1-3/+3
2022-11-07clean up some reliability issues with automatic installGravatar Jarred Sumner 1-0/+13
2022-11-07[bun:test] Implement `done` callback with support for async functionsGravatar Jarred Sumner 1-1/+4
2022-11-06Automatically install npm packages when running a script in Bun's runtime ↵Gravatar Jarred Sumner 1-0/+3
(#1459) * Update bundler.zig * WIP * Update README.md * Update README.md * wip * Support running scripts without package.json * Add `--no-auto-install` and `--prefer-offline` flags * WIP * wip * Update headers-handwritten.h * WIP * Build fixes * Fix UAF * Update install.zig * Must call .allocate() * Micro-optimization: only call .timestamp() once per tick when installing packages * Support progress bar * Extend the timestamp for package staleness checks to 1 day * Add `--prefer-latest`, `-i` CLI Flags * Fix crash * Support line text manually being set on an Error instance * Add a few more fields for error messages * Fix bug when counting 8 character strings in string builder * Implement error handling for automatic package installs! * Fix crash * Make it say module when there's a slash * Update module_loader.zig * Ban dependency versions in import specifiers when a package.json is present * Remove unused field * Update README.md * Update README.md * Update README.md * Update README.md Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-10-28Enable `BUN_OVERRIDE_MODULE_PATH` in `bun wiptest`Gravatar Jarred Sumner 1-0/+7
2022-10-18get args fix (#1346)Gravatar Dylan Conway 1-1/+1
* fix args.len < capacity check * tests for args * file name change * switch to stdout.writer, use JSON for parsing * bun-debug or bun * missing arg
2022-10-12[`bun wiptest`] Ignore `.` foldersGravatar Jarred Sumner 1-1/+1