├── .c8rc.json ├── .editorconfig ├── .gitattributes ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── config.yml │ └── feature.md └── workflows │ └── ci.yml ├── .gitignore ├── .npmrc ├── .taprc ├── .xo-config.cjs ├── ava.config.js ├── docs ├── 01-writing-tests.md ├── 02-execution-context.md ├── 03-assertions.md ├── 04-snapshot-testing.md ├── 05-command-line.md ├── 06-configuration.md ├── 07-test-timeouts.md ├── 08-common-pitfalls.md ├── recipes │ ├── babel.md │ ├── browser-testing.md │ ├── code-coverage.md │ ├── debugging-with-chrome-devtools.md │ ├── debugging-with-vscode.md │ ├── debugging-with-webstorm.md │ ├── endpoint-testing-with-mongoose.md │ ├── endpoint-testing.md │ ├── isolated-mongodb-integration-tests.md │ ├── passing-arguments-to-your-test-files.md │ ├── puppeteer.md │ ├── shared-workers.md │ ├── splitting-tests-ci.md │ ├── test-setup.md │ ├── testing-with-selenium-webdriverjs.md │ ├── typescript.md │ ├── vue.md │ ├── watch-mode.md │ └── when-to-use-plan.md └── support-statement.md ├── entrypoints ├── cli.mjs ├── eslint-plugin-helper.cjs ├── internal.d.mts ├── main.cjs ├── main.d.cts ├── main.d.mts ├── main.mjs ├── plugin.cjs ├── plugin.d.cts ├── plugin.d.mts └── plugin.mjs ├── examples ├── endpoint-testing │ ├── app.js │ ├── package.json │ ├── readme.md │ └── test.js ├── macros │ ├── index.js │ ├── package.json │ ├── readme.md │ └── test.js ├── matching-titles │ ├── package.json │ ├── readme.md │ └── test.js ├── specific-line-numbers │ ├── package.json │ ├── readme.md │ └── test.js ├── tap-reporter │ ├── package.json │ ├── readme.md │ └── test.js ├── timeouts │ ├── index.js │ ├── package.json │ ├── readme.md │ └── test.js ├── typescript-basic │ ├── package.json │ ├── readme.md │ ├── source │ │ ├── index.ts │ │ └── test.ts │ └── tsconfig.json └── typescript-context │ ├── package.json │ ├── readme.md │ ├── source │ ├── index.ts │ └── test.ts │ └── tsconfig.json ├── index.d.ts ├── lib ├── api-event-iterator.js ├── api.js ├── assert.js ├── chalk.js ├── cli.js ├── code-excerpt.js ├── concordance-options.js ├── context-ref.js ├── create-chain.js ├── environment-variables.js ├── eslint-plugin-helper-worker.js ├── extensions.js ├── fork.js ├── glob-helpers.cjs ├── globs.js ├── ipc-flow-control.cjs ├── is-ci.js ├── like-selector.js ├── line-numbers.js ├── load-config.js ├── module-types.js ├── node-arguments.js ├── now-and-timers.cjs ├── parse-test-args.js ├── pkg.cjs ├── plugin-support │ ├── shared-worker-loader.js │ └── shared-workers.js ├── provider-manager.js ├── reporters │ ├── beautify-stack.js │ ├── colors.js │ ├── default.js │ ├── format-serialized-error.js │ ├── improper-usage-messages.js │ ├── prefix-title.js │ └── tap.js ├── run-status.js ├── runner.js ├── scheduler.js ├── serialize-error.js ├── slash.cjs ├── snapshot-manager.js ├── test.js ├── watcher.js └── worker │ ├── base.js │ ├── channel.cjs │ ├── completion-handlers.js │ ├── guard-environment.cjs │ ├── line-numbers.js │ ├── main.cjs │ ├── options.cjs │ ├── plugin.cjs │ ├── state.cjs │ └── utils.cjs ├── license ├── maintaining.md ├── media ├── header.png ├── header.psd ├── logo.ai ├── logo.png ├── logo.svg ├── magic-assert-combined.png ├── pronunciation.m4a ├── screenshot-fixtures │ ├── magic-assert-buffers.js │ ├── magic-assert-exceptions.js │ ├── magic-assert-objects.js │ ├── magic-assert-strings.js │ ├── mini-reporter.md │ ├── package.json │ ├── snapshot-testing.md │ ├── tap-reporter.js │ └── verbose-reporter.js ├── snapshot-testing.png ├── tap-reporter.png └── verbose-reporter.png ├── package-lock.json ├── package.json ├── plugin.d.ts ├── readme.md ├── scripts ├── ci.sh └── test.sh ├── test-tap ├── api.js ├── assert.js ├── chalk.js ├── code-excerpt.js ├── eslint-plugin-helper.js ├── fixture │ ├── .fake-root │ ├── assert.cjs.md │ ├── assert.cjs.snap │ ├── ava-paths │ │ ├── cwd │ │ │ └── .gitkeep │ │ └── target │ │ │ └── test.cjs │ ├── caching │ │ ├── package.json │ │ └── test.cjs │ ├── cjs.cjs │ ├── error-in-anonymous-function.cjs │ ├── es2015.cjs │ ├── eslint-plugin-helper │ │ ├── ava.config.mjs │ │ ├── for-overriding │ │ │ ├── ava.config.mjs │ │ │ └── package.json │ │ └── package.json │ ├── esm │ │ └── package.json │ ├── extensions │ │ ├── package.json │ │ └── test.foo.bar │ ├── fail-fast │ │ ├── crash │ │ │ ├── crashes.cjs │ │ │ └── passes.cjs │ │ ├── multiple-files │ │ │ ├── fails.cjs │ │ │ ├── passes-slow.cjs │ │ │ └── passes.cjs │ │ ├── single-file │ │ │ └── test.cjs │ │ ├── timeout │ │ │ ├── fails.cjs │ │ │ ├── passes-slow.cjs │ │ │ └── passes.cjs │ │ └── without-error │ │ │ ├── a.cjs │ │ │ └── b.cjs │ ├── formatting-color.cjs │ ├── globs │ │ ├── custom-extension │ │ │ └── test │ │ │ │ ├── do-not-compile.cjs │ │ │ │ ├── foo.jsx │ │ │ │ ├── helpers │ │ │ │ ├── a.jsx │ │ │ │ └── b.cjs │ │ │ │ └── sub │ │ │ │ ├── _helper.jsx │ │ │ │ └── bar.jsx │ │ ├── cwd │ │ │ ├── dir-a │ │ │ │ └── test │ │ │ │ │ ├── bar.cjs │ │ │ │ │ └── foo.cjs │ │ │ └── dir-b │ │ │ │ └── test │ │ │ │ └── baz.cjs │ │ ├── default-patterns │ │ │ ├── sub │ │ │ │ └── directory │ │ │ │ │ ├── __tests__ │ │ │ │ │ ├── _foo.cjs │ │ │ │ │ ├── fixtures │ │ │ │ │ │ └── foo.cjs │ │ │ │ │ ├── foo.cjs │ │ │ │ │ └── helpers │ │ │ │ │ │ ├── foo.cjs │ │ │ │ │ │ └── foo.ts │ │ │ │ │ ├── bar.spec.cjs │ │ │ │ │ └── bar.test.cjs │ │ │ ├── test-foo.cjs │ │ │ ├── test-foo.ts │ │ │ ├── test.cjs │ │ │ ├── test │ │ │ │ ├── _foo-help.cjs │ │ │ │ ├── baz.cjs │ │ │ │ ├── deep │ │ │ │ │ └── deep.cjs │ │ │ │ ├── fixtures │ │ │ │ │ └── foo-fixt.cjs │ │ │ │ └── helpers │ │ │ │ │ └── test.cjs │ │ │ └── tests │ │ │ │ ├── _foo-help.cjs │ │ │ │ ├── baz.cjs │ │ │ │ ├── deep │ │ │ │ └── deep.cjs │ │ │ │ ├── fixtures │ │ │ │ └── foo-fixt.cjs │ │ │ │ └── helpers │ │ │ │ └── test.cjs │ │ └── no-files │ │ │ └── package.json │ ├── hooks-skipped.cjs │ ├── ignored-dirs │ │ ├── helpers │ │ │ └── test.cjs │ │ └── test.cjs │ ├── infinity-stack-trace.cjs │ ├── load-config │ │ ├── cjs │ │ │ ├── ava.config.cjs │ │ │ └── package.json │ │ ├── contains-ava-property │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── explicit-bad-extension │ │ │ ├── explicit.txt │ │ │ └── package.json │ │ ├── factory-no-plain-return │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── file-yes-cjs-yes │ │ │ ├── ava.config.cjs │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── no-default-export │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── no-plain-config │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── non-function │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── non-object-experiments │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── package-no-file-yes-factory │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── package-no-file-yes │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── package-only │ │ │ └── package.json │ │ ├── package-yes-explicit-yes │ │ │ ├── explicit.js │ │ │ ├── nested │ │ │ │ └── explicit.js │ │ │ └── package.json │ │ ├── package-yes-file-yes │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── require │ │ │ ├── ava.config.js │ │ │ ├── cjs.cjs │ │ │ └── package.json │ │ ├── throws │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ └── unsupported-experiments │ │ │ ├── ava.config.js │ │ │ └── package.json │ ├── long-running.cjs │ ├── match-no-match-2.cjs │ ├── match-no-match.cjs │ ├── matcher-skip.cjs │ ├── mjs.mjs │ ├── no-tests.cjs │ ├── node-env-foo.cjs │ ├── node-env-test.cjs │ ├── package-config │ │ └── fail-without-assertions │ │ │ ├── package.json │ │ │ └── test.cjs │ ├── package.json │ ├── parallel-runs │ │ ├── custom-comparator │ │ │ ├── 0-1.cjs │ │ │ ├── 0-2.cjs │ │ │ ├── 0-3.cjs │ │ │ ├── 1-1.cjs │ │ │ ├── 1-2.cjs │ │ │ ├── 1-3.cjs │ │ │ ├── 2-1.cjs │ │ │ ├── 2-2.cjs │ │ │ ├── 2-3.cjs │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── less-files-than-ci-total │ │ │ ├── 2.cjs │ │ │ ├── 9.cjs │ │ │ └── package.json │ │ ├── more-files-than-ci-total │ │ │ ├── 10.cjs │ │ │ ├── 2.cjs │ │ │ ├── 2a.cjs │ │ │ ├── 9.cjs │ │ │ ├── Ab.cjs │ │ │ ├── a.cjs │ │ │ ├── b.cjs │ │ │ ├── c.cjs │ │ │ └── package.json │ │ └── no-files │ │ │ └── package.json │ ├── pkg-type-module │ │ ├── package.json │ │ └── test.js │ ├── process-cwd-default.cjs │ ├── process-cwd-pkgdir.cjs │ ├── report │ │ ├── README.md │ │ ├── edgecases │ │ │ ├── ast-syntax-error.cjs │ │ │ ├── ava-import-no-test-declaration.cjs │ │ │ ├── import-and-use-test-member.cjs │ │ │ ├── no-ava-import.cjs │ │ │ ├── test.cjs │ │ │ └── throws.cjs │ │ ├── failfast │ │ │ ├── a.cjs │ │ │ ├── b.cjs │ │ │ └── package.json │ │ ├── failfast2 │ │ │ ├── a.cjs │ │ │ ├── b.cjs │ │ │ └── package.json │ │ ├── only │ │ │ ├── a.cjs │ │ │ ├── b.cjs │ │ │ └── package.json │ │ ├── regular │ │ │ ├── bad-test-chain.cjs │ │ │ ├── nested-objects.cjs │ │ │ ├── output-in-hook.cjs │ │ │ ├── package.json │ │ │ ├── test.cjs │ │ │ ├── traces-in-t-throws.cjs │ │ │ ├── uncaught-exception.cjs │ │ │ └── unhandled-rejection.cjs │ │ ├── timeoutcontextlogs │ │ │ ├── a.cjs │ │ │ ├── b.cjs │ │ │ └── package.json │ │ ├── timeoutinmultiplefiles │ │ │ ├── a.cjs │ │ │ ├── b.cjs │ │ │ └── package.json │ │ ├── timeoutinsinglefile │ │ │ ├── a.cjs │ │ │ └── package.json │ │ ├── timeoutwithmatch │ │ │ ├── a.cjs │ │ │ └── package.json │ │ └── watch │ │ │ ├── package.json │ │ │ └── test.cjs │ ├── reset-cache │ │ ├── package.json │ │ └── test.cjs │ ├── serial.cjs │ ├── skip-only.cjs │ ├── snapshots │ │ ├── .gitignore │ │ ├── __tests__-dir │ │ │ ├── __tests__ │ │ │ │ └── test.cjs │ │ │ └── package.json │ │ ├── package.json │ │ ├── test-content │ │ │ ├── package.json │ │ │ ├── test.cjs.md.expected │ │ │ ├── test.cjs.snap.expected │ │ │ └── tests │ │ │ │ └── test.cjs │ │ ├── test-dir │ │ │ ├── package.json │ │ │ └── test │ │ │ │ └── test.cjs │ │ ├── test-snapshot-location │ │ │ ├── package.json │ │ │ └── src │ │ │ │ ├── feature │ │ │ │ ├── nested-feature │ │ │ │ │ └── test.cjs │ │ │ │ └── test.cjs │ │ │ │ └── test.cjs │ │ ├── test-sourcemaps │ │ │ ├── build │ │ │ │ ├── feature │ │ │ │ │ └── __tests__ │ │ │ │ │ │ ├── test.cjs │ │ │ │ │ │ └── test.cjs.map │ │ │ │ ├── test.cjs │ │ │ │ ├── test.cjs.map │ │ │ │ └── test │ │ │ │ │ ├── test.cjs │ │ │ │ │ └── test.cjs.map │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── feature │ │ │ │ │ └── __tests__ │ │ │ │ │ │ └── test.ts │ │ │ │ ├── test.ts │ │ │ │ └── test │ │ │ │ │ └── test.ts │ │ │ └── tsconfig.json │ │ ├── test.cjs │ │ ├── tests-dir │ │ │ ├── package.json │ │ │ └── tests │ │ │ │ └── test.cjs │ │ ├── watcher-rerun-unlink │ │ │ ├── package.json │ │ │ └── test.cjs │ │ └── watcher-rerun │ │ │ ├── package.json │ │ │ └── test.cjs │ ├── sort-tests │ │ ├── 0.cjs │ │ ├── 1.cjs │ │ ├── 2.cjs │ │ ├── ava.config.js │ │ └── package.json │ ├── stalled-tests │ │ ├── observable.cjs │ │ └── promise.cjs │ ├── symlink │ ├── symlinkdir │ │ └── symlink.cjs │ ├── symlinkfile.cjs │ ├── tap │ │ ├── package.json │ │ └── test.cjs │ ├── target-symlink.cjs │ ├── test-count-2.cjs │ ├── test-count-3.cjs │ ├── test-count.cjs │ ├── try-snapshot.cjs.md │ ├── try-snapshot.cjs.snap │ ├── with-dependencies │ │ ├── dep-1.js │ │ ├── dep-2.js │ │ ├── dep-3.custom │ │ ├── no-tests.cjs │ │ ├── require-custom.cjs │ │ ├── test-failure.cjs │ │ ├── test-uncaught-exception.cjs │ │ └── test.cjs │ └── worker-argv.cjs ├── globs.js ├── helper │ ├── ava-test.js │ ├── chalk0.js │ ├── cli.js │ ├── fix-reporter-env.js │ ├── replay-report.js │ ├── report-worker.js │ ├── report.js │ └── tty-stream.js ├── hooks.js ├── integration │ ├── assorted.js │ ├── debug.js │ ├── parallel-runs.js │ ├── repl.js │ ├── snapshots.js │ ├── stack-traces.js │ └── stalled.js ├── line-numbers.js ├── node-arguments.js ├── promise.js ├── reporters │ ├── default.edgecases.v18.log │ ├── default.edgecases.v20.log │ ├── default.edgecases.v22.log │ ├── default.edgecases.v23.log │ ├── default.failfast.v18.log │ ├── default.failfast.v20.log │ ├── default.failfast.v22.log │ ├── default.failfast.v23.log │ ├── default.failfast2.v18.log │ ├── default.failfast2.v20.log │ ├── default.failfast2.v22.log │ ├── default.failfast2.v23.log │ ├── default.js │ ├── default.only.v18.log │ ├── default.only.v20.log │ ├── default.only.v22.log │ ├── default.only.v23.log │ ├── default.regular.v18.log │ ├── default.regular.v20.log │ ├── default.regular.v22.log │ ├── default.regular.v23.log │ ├── default.timeoutcontextlogs.v18.log │ ├── default.timeoutcontextlogs.v20.log │ ├── default.timeoutcontextlogs.v22.log │ ├── default.timeoutcontextlogs.v23.log │ ├── default.timeoutinmultiplefiles.v18.log │ ├── default.timeoutinmultiplefiles.v20.log │ ├── default.timeoutinmultiplefiles.v22.log │ ├── default.timeoutinmultiplefiles.v23.log │ ├── default.timeoutinsinglefile.v18.log │ ├── default.timeoutinsinglefile.v20.log │ ├── default.timeoutinsinglefile.v22.log │ ├── default.timeoutinsinglefile.v23.log │ ├── default.timeoutwithmatch.v18.log │ ├── default.timeoutwithmatch.v20.log │ ├── default.timeoutwithmatch.v22.log │ ├── default.timeoutwithmatch.v23.log │ ├── default.watch.v18.log │ ├── default.watch.v20.log │ ├── default.watch.v22.log │ ├── default.watch.v23.log │ ├── improper-usage-messages.js │ ├── prefix-title.js │ ├── readme.md │ ├── tap.edgecases.v18.log │ ├── tap.edgecases.v20.log │ ├── tap.edgecases.v22.log │ ├── tap.edgecases.v23.log │ ├── tap.failfast.v18.log │ ├── tap.failfast.v20.log │ ├── tap.failfast.v22.log │ ├── tap.failfast.v23.log │ ├── tap.failfast2.v18.log │ ├── tap.failfast2.v20.log │ ├── tap.failfast2.v22.log │ ├── tap.failfast2.v23.log │ ├── tap.js │ ├── tap.only.v18.log │ ├── tap.only.v20.log │ ├── tap.only.v22.log │ ├── tap.only.v23.log │ ├── tap.regular.v18.log │ ├── tap.regular.v20.log │ ├── tap.regular.v22.log │ └── tap.regular.v23.log ├── runner.js ├── test-try-commit.js ├── test.js ├── try-snapshot.js └── tsconfig.json ├── test-types ├── .gitignore ├── import-in-cts │ ├── assertions-as-type-guards.cts │ ├── context.cts │ ├── deep-equal.cts │ ├── implementation-result.cts │ ├── like.cts │ ├── macros.cts │ ├── plugin.cts │ ├── snapshot.cts │ ├── teardown.cts │ ├── throws.cts │ ├── timeout.cts │ └── try-commit.cts └── module │ ├── assertions-as-type-guards.ts │ ├── context.ts │ ├── deep-equal.ts │ ├── implementation-result.ts │ ├── like.ts │ ├── macros.ts │ ├── plugin.ts │ ├── snapshot.ts │ ├── teardown.ts │ ├── throws.ts │ ├── timeout.ts │ └── try-commit.ts ├── test ├── .fake-root ├── README.md ├── assertions │ ├── fixtures │ │ ├── happy-path.js │ │ ├── happy-path.js.md │ │ ├── happy-path.js.snap │ │ ├── package.json │ │ ├── throws-async.js │ │ └── throws.js │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── builtin-nodejs-assert │ ├── fixtures │ │ ├── assert-failure.js │ │ └── package.json │ └── test.js ├── cjs-default │ ├── fixtures │ │ ├── package.json │ │ └── test.cjs │ └── test.js ├── completion-handlers │ ├── fixtures │ │ ├── exit0.js │ │ ├── one.js │ │ ├── package.json │ │ └── two.js │ └── test.js ├── concurrency │ ├── fixtures │ │ ├── concurrency.js │ │ └── package.json │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── config-require │ ├── fixtures │ │ ├── exports-default │ │ │ ├── package.json │ │ │ ├── required.cjs │ │ │ └── test.js │ │ ├── failed-import │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── non-json │ │ │ ├── ava.config.js │ │ │ ├── package.json │ │ │ ├── required.mjs │ │ │ └── test.js │ │ ├── require-dependency │ │ │ ├── .gitignore │ │ │ ├── node_modules │ │ │ │ └── @ava │ │ │ │ │ └── stub │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── single-argument │ │ │ ├── package.json │ │ │ ├── required.js │ │ │ └── test.js │ │ └── with-arguments │ │ │ ├── ava.config.js │ │ │ ├── package.json │ │ │ ├── required.cjs │ │ │ ├── required.mjs │ │ │ ├── side-effect.js │ │ │ └── test.js │ └── test.js ├── config │ ├── fixtures │ │ ├── config-errors │ │ │ ├── ava.config.js │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── factory-promise-return │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── file-yes-cjs-yes-mjs-yes │ │ │ ├── ava.config.cjs │ │ │ ├── ava.config.js │ │ │ ├── ava.config.mjs │ │ │ └── package.json │ │ ├── js-as-cjs │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ ├── js-as-esm │ │ │ ├── ava.config.js │ │ │ ├── error.js │ │ │ ├── no-default-export.js │ │ │ └── package.json │ │ ├── mjs-with-tests │ │ │ ├── ava.config.mjs │ │ │ ├── dir-a-wrapper │ │ │ │ └── dir-a │ │ │ │ │ ├── dir-a-wrapper-3.js │ │ │ │ │ └── dir-a-wrapper-4.js │ │ │ ├── dir-a │ │ │ │ ├── dir-a-base-1.js │ │ │ │ └── dir-a-base-2.js │ │ │ └── package.json │ │ ├── mjs │ │ │ ├── ava.config.mjs │ │ │ ├── error.mjs │ │ │ ├── no-default-export.mjs │ │ │ └── package.json │ │ ├── monorepo │ │ │ ├── ava.config.mjs │ │ │ └── package │ │ │ │ ├── foo.js │ │ │ │ └── package.json │ │ ├── pkg-with-tests │ │ │ ├── dir-a-wrapper │ │ │ │ └── dir-a │ │ │ │ │ ├── dir-a-wrapper-3.js │ │ │ │ │ └── dir-a-wrapper-4.js │ │ │ ├── dir-a │ │ │ │ ├── dir-a-base-1.js │ │ │ │ └── dir-a-base-2.js │ │ │ └── package.json │ │ ├── promise-config │ │ │ ├── ava.config.js │ │ │ └── package.json │ │ └── unsupported-configs │ │ │ ├── ava.config.js │ │ │ ├── ava.config.json │ │ │ └── package.json │ ├── integration.js │ ├── loader.js │ ├── next-gen.js │ └── snapshots │ │ ├── integration.js.md │ │ ├── integration.js.snap │ │ ├── loader.js.md │ │ ├── loader.js.snap │ │ ├── next-gen.js.md │ │ └── next-gen.js.snap ├── configurable-module-format │ ├── commonjs.js │ ├── custom.js │ ├── fixtures │ │ ├── array-custom.config.js │ │ ├── array-extensions.config.js │ │ ├── bad-custom-type.config.js │ │ ├── change-cjs-loading.config.js │ │ ├── change-js-loading.config.js │ │ ├── change-mjs-loading.config.js │ │ ├── object-custom.config.js │ │ ├── object-extensions.config.js │ │ ├── package.json │ │ ├── test.cjs │ │ ├── test.cts │ │ ├── test.js │ │ └── test.mjs │ ├── invalid-configurations.js │ ├── module.js │ └── snapshots │ │ ├── invalid-configurations.js.md │ │ └── invalid-configurations.js.snap ├── environment-variables │ ├── fixtures │ │ ├── environment-variables │ │ │ ├── ava.config.js │ │ │ ├── environment-variables.js │ │ │ └── package.json │ │ └── invalid-environment-variables │ │ │ └── package.json │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── extensions │ ├── fixtures │ │ ├── shared-duplicates │ │ │ └── package.json │ │ ├── top-level-duplicates │ │ │ └── package.json │ │ └── top-level │ │ │ └── package.json │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── external-assertions │ ├── fixtures │ │ ├── assert-failure.js │ │ ├── expect-failure.js │ │ └── package.json │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── globs │ ├── fixtures │ │ ├── files │ │ │ └── package.json │ │ ├── filter-by-directory │ │ │ ├── directory │ │ │ │ └── test.js │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── ignored-by-watcher │ │ │ └── package.json │ │ └── treat-patterns-as-files │ │ │ ├── _helper.js │ │ │ ├── foo.js │ │ │ ├── foo.ts │ │ │ ├── node_modules │ │ │ └── test.js │ │ │ ├── package.json │ │ │ └── test.js │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── helpers │ ├── exec.js │ ├── simulate-tty.cjs │ └── with-temporary-fixture.js ├── hook-restrictions │ ├── fixtures │ │ ├── invalid-snapshots-in-hooks.js │ │ ├── invalid-t-try-in-hooks.js │ │ └── package.json │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── idle-timeouts │ ├── fixtures │ │ ├── console-output.js │ │ └── package.json │ └── test.js ├── internal-events │ ├── fixtures │ │ ├── .gitignore │ │ ├── ava.config.js │ │ ├── package.json │ │ └── test.js │ └── test.js ├── line-numbers │ ├── fixtures │ │ ├── README.md │ │ ├── line-numbers.js │ │ ├── line-numbers.js.map │ │ ├── line-numbers.ts │ │ └── package.json │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── macros │ ├── fixtures │ │ ├── macros.js │ │ └── package.json │ └── test.js ├── meta │ ├── fixtures │ │ ├── meta.cjs │ │ ├── meta.mjs │ │ └── package.json │ └── test.js ├── multiple-implementations │ ├── fixtures │ │ ├── package.json │ │ ├── test.js │ │ └── try.js │ └── test.js ├── node-arguments │ ├── fixtures │ │ ├── node-arguments-from-config │ │ │ ├── node-arguments-from-config.js │ │ │ ├── package.json │ │ │ └── setup.cjs │ │ ├── node-arguments │ │ │ ├── node-arguments.js │ │ │ └── package.json │ │ └── thread-arguments-filter │ │ │ ├── package.json │ │ │ ├── process.js │ │ │ ├── thread-arguments-filter.config.mjs │ │ │ └── thread.js │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── node_modules │ └── ava ├── scheduler │ ├── fixtures │ │ ├── 1pass.js │ │ ├── 2fail.js │ │ ├── disabled-cache.cjs │ │ └── package.json │ └── test.js ├── shared-workers │ ├── cannot-publish-before-available │ │ ├── fixtures │ │ │ ├── _worker.js │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── snapshots │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ └── test.js │ ├── lifecycle │ │ ├── fixtures │ │ │ ├── _worker.js │ │ │ ├── available.js │ │ │ ├── package.json │ │ │ └── teardown.js │ │ └── test.js │ ├── multiple-workers-are-loaded │ │ ├── fixtures │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ └── worker.mjs │ │ └── test.js │ ├── restricted-to-worker-threads │ │ ├── fixtures │ │ │ ├── _worker.js │ │ │ ├── package.json │ │ │ └── test.js │ │ └── test.js │ ├── timeout │ │ ├── fixtures │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ └── worker.mjs │ │ └── test.js │ ├── unsupported-protocol │ │ ├── fixtures │ │ │ ├── _worker.js │ │ │ ├── in-shared-worker.js │ │ │ ├── in-test-worker.js │ │ │ └── package.json │ │ ├── snapshots │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ └── test.js │ ├── worker-execution-crash │ │ ├── fixtures │ │ │ ├── _plugin.js │ │ │ ├── _worker.js │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── snapshots │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ └── test.js │ ├── worker-protocol │ │ ├── fixtures │ │ │ ├── _declare.js │ │ │ ├── _plugin.js │ │ │ ├── _worker.js │ │ │ ├── other.test.js │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── snapshots │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ └── test.js │ ├── worker-startup-crashes │ │ ├── fixtures │ │ │ ├── _factory-function.js │ │ │ ├── _module.js │ │ │ ├── _no-factory-function.js │ │ │ ├── factory-function.js │ │ │ ├── module.js │ │ │ ├── no-factory-function.js │ │ │ └── package.json │ │ ├── snapshots │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ └── test.js │ └── workers-are-loaded-once │ │ ├── fixtures │ │ ├── _plugin.js │ │ ├── _worker.js │ │ ├── package.json │ │ ├── test-1.js │ │ └── test-2.js │ │ └── test.js ├── snapshot-order │ ├── fixtures │ │ ├── intertest-order │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── randomness │ │ │ ├── .gitignore │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ └── test.js.md │ │ └── report-declaration-order │ │ │ ├── package.json │ │ │ └── test.js │ ├── helpers │ │ └── get-snapshot-ids.js │ ├── intertest-order.js │ ├── randomness.js │ ├── report-declaration-order.js │ └── snapshots │ │ ├── randomness.js.md │ │ └── randomness.js.snap ├── snapshot-regenerate-report │ ├── fixtures │ │ ├── package.json │ │ └── test.js │ └── test.js ├── snapshot-removal │ ├── fixtures │ │ ├── fixed-snapshot-dir │ │ │ ├── fixedSnapshotDir │ │ │ │ ├── test.js.md │ │ │ │ └── test.js.snap │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── no-snapshots │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── only-test │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── removal │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── skipped-snapshots-in-try │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── skipped-snapshots │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── skipped-tests │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── snapshot-dir │ │ │ ├── package.json │ │ │ └── test │ │ │ │ ├── snapshots │ │ │ │ ├── test.js.md │ │ │ │ └── test.js.snap │ │ │ │ └── test.js │ │ └── try │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ ├── helpers │ │ └── macros.js │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── snapshot-tests │ ├── corrupt.js │ ├── fixtures │ │ ├── corrupt │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── large │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── multiline-snapshot-label │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── normalized-title-in-snapshots │ │ │ ├── package.json │ │ │ └── test.js │ │ └── normalized-title-in-stdout │ │ │ ├── package.json │ │ │ └── test.js │ ├── formatting.js │ ├── large.js │ └── snapshots │ │ ├── corrupt.js.md │ │ ├── corrupt.js.snap │ │ ├── formatting.js.md │ │ └── formatting.js.snap ├── snapshot-workflow │ ├── README.md │ ├── adding.js │ ├── changing-label.js │ ├── fixtures │ │ ├── adding-skipped-snapshots │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── adding-snapshots │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── adding-test │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── changing-label │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── changing-title │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── commit-skip │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── discard-skip │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── filling-in-blanks │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── first-run │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── invalid-snapfile │ │ │ ├── package.json │ │ │ └── test.js │ │ ├── removing-all-snapshots │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── removing-snapshots │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── removing-test │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── reorder │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── select-test-update │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── skipping-snapshot-update │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── skipping-snapshot │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ ├── skipping-test-update │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ │ └── skipping-test │ │ │ ├── package.json │ │ │ ├── test.js │ │ │ ├── test.js.md │ │ │ └── test.js.snap │ ├── helpers │ │ └── macros.js │ ├── invalid-snapfile.js │ ├── removing-all-snapshots.js │ ├── removing-snapshots.js │ ├── removing-test.js │ ├── reorder.js │ ├── selection.js │ ├── snapshots │ │ ├── adding.js.md │ │ ├── adding.js.snap │ │ ├── changing-label.js.md │ │ ├── changing-label.js.snap │ │ ├── invalid-snapfile.js.md │ │ ├── invalid-snapfile.js.snap │ │ ├── removing-all-snapshots.js.md │ │ ├── removing-all-snapshots.js.snap │ │ ├── removing-snapshots.js.md │ │ ├── removing-snapshots.js.snap │ │ ├── removing-test.js.md │ │ ├── removing-test.js.snap │ │ ├── reorder.js.md │ │ ├── reorder.js.snap │ │ ├── selection.js.md │ │ ├── selection.js.snap │ │ ├── try-skip.js.md │ │ └── try-skip.js.snap │ └── try-skip.js ├── test-process-exit │ ├── fixtures │ │ ├── ava.config.js │ │ ├── package.json │ │ └── process-exit.js │ └── test.js ├── test-timeouts │ ├── fixtures │ │ ├── custom-message.js │ │ ├── invalid-message.js │ │ └── package.json │ ├── snapshots │ │ ├── test.js.md │ │ └── test.js.snap │ └── test.js ├── watch-mode │ ├── availability.js │ ├── basic-functionality.js │ ├── fixtures │ │ ├── basic │ │ │ ├── ava.config.js │ │ │ ├── ignored-by-watcher.js │ │ │ ├── not-depended-on.js │ │ │ ├── package.json │ │ │ ├── source.js │ │ │ ├── source.test.js │ │ │ └── test.js │ │ ├── exclusive │ │ │ ├── a.test.js │ │ │ ├── ava.config.js │ │ │ ├── b.test.js │ │ │ ├── c.test.js │ │ │ └── package.json │ │ ├── typescript-inline │ │ │ ├── .gitignore │ │ │ ├── ava.config.js │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ └── test.ts │ │ │ └── tsconfig.json │ │ └── typescript-precompiled │ │ │ ├── ava.config.js │ │ │ ├── build │ │ │ └── test.js │ │ │ ├── package.json │ │ │ ├── src │ │ │ └── test.ts │ │ │ └── tsconfig.json │ ├── helpers │ │ └── watch.js │ ├── scenarios.js │ └── typescript.js └── worker-threads │ ├── fixtures │ ├── child-process.config.mjs │ ├── package.json │ └── test.js │ └── test.js ├── tsconfig.json └── types ├── assertions.d.cts ├── shared-worker.d.cts ├── state-change-events.d.cts ├── subscribable.d.cts ├── test-fn.d.cts └── try-fn.d.cts /.c8rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "exclude": [ 4 | "{coverage,examples,media,test,test-types,test-tap,types}/**", 5 | "entrypoints/**", 6 | "!entrypoints/eslint-plugin-helper.cjs", 7 | "ava.config.js", 8 | ".xo-config.cjs", 9 | "*.d.*(c|m)ts" 10 | ], 11 | "reporter": [ 12 | "html", 13 | "lcov" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.yml] 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.ai binary 3 | *.psd binary 4 | *.png binary 5 | *.snap binary 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Discussions 4 | url: https://github.com/avajs/ava/discussions 5 | about: Questions? Ideas? Something to share? 6 | - name: TypeScript compilation 7 | url: https://github.com/avajs/typescript/issues 8 | about: Report a bug with AVA's TypeScript integration 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggestions for new or different behavior 4 | labels: question 5 | --- 6 | 7 | Please provide details about: 8 | 9 | * What you're trying to do 10 | * Why you can't use AVA for this 11 | * And maybe how you think AVA could handle this 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.tap 2 | /coverage 3 | /media/**/node_modules/ 4 | /node_modules/ 5 | /test-tap/**/node_modules/ 6 | /test/**/fixtures/**/node_modules/*/ 7 | /examples/**/node_modules/ 8 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | lockfile-version=3 2 | -------------------------------------------------------------------------------- /.taprc: -------------------------------------------------------------------------------- 1 | disable-coverage: true 2 | allow-empty-coverage: true 3 | include: 4 | - test-tap/*.js 5 | - test-tap/reporters/*.js 6 | - test-tap/integration/*.js 7 | timeout: 300 8 | tsconfig: test-tap/tsconfig.json 9 | -------------------------------------------------------------------------------- /entrypoints/cli.mjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import run from '../lib/cli.js'; 3 | 4 | run(); 5 | -------------------------------------------------------------------------------- /entrypoints/internal.d.mts: -------------------------------------------------------------------------------- 1 | import type {StateChangeEvent} from '../types/state-change-events.d.cts'; 2 | 3 | export type Event = StateChangeEvent; 4 | 5 | export type ObservedRun = { 6 | events: AsyncIterableIterator; 7 | }; 8 | -------------------------------------------------------------------------------- /entrypoints/main.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = require('../lib/worker/main.cjs'); 3 | -------------------------------------------------------------------------------- /entrypoints/main.mjs: -------------------------------------------------------------------------------- 1 | export {default} from '../lib/worker/main.cjs'; 2 | export {registerCompletionHandler} from '../lib/worker/completion-handlers.js'; 3 | -------------------------------------------------------------------------------- /entrypoints/plugin.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = require('../lib/worker/plugin.cjs'); 3 | -------------------------------------------------------------------------------- /entrypoints/plugin.d.cts: -------------------------------------------------------------------------------- 1 | import type {SharedWorker} from '../types/shared-worker.cjs'; 2 | 3 | export function registerSharedWorker(options: SharedWorker.Plugin.RegistrationOptions<'ava-4', Data>): SharedWorker.Plugin.Protocol; 4 | // Add overloads for additional protocols. 5 | 6 | export type {SharedWorker} from '../types/shared-worker.cjs'; 7 | -------------------------------------------------------------------------------- /entrypoints/plugin.d.mts: -------------------------------------------------------------------------------- 1 | import type {SharedWorker} from '../types/shared-worker.cjs'; 2 | 3 | export function registerSharedWorker(options: SharedWorker.Plugin.RegistrationOptions<'ava-4', Data>): SharedWorker.Plugin.Protocol; 4 | // Add overloads for additional protocols. 5 | 6 | export type {SharedWorker} from '../types/shared-worker.cjs'; 7 | -------------------------------------------------------------------------------- /entrypoints/plugin.mjs: -------------------------------------------------------------------------------- 1 | import * as plugin from '../lib/worker/plugin.cjs'; 2 | 3 | const {registerSharedWorker} = plugin; 4 | export {registerSharedWorker}; 5 | -------------------------------------------------------------------------------- /examples/endpoint-testing/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const app = (request, response) => { 4 | if (request.url === '/user') { 5 | response.setHeader('Content-Type', 'application/json'); 6 | response.end(JSON.stringify({email: 'ava@rocks.com'})); 7 | } else { 8 | response.writeHead('404'); 9 | response.end(); 10 | } 11 | }; 12 | 13 | module.exports = app; 14 | -------------------------------------------------------------------------------- /examples/endpoint-testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ava-endpoint-testing", 3 | "description": "Example for endpoint testing", 4 | "scripts": { 5 | "test": "ava" 6 | }, 7 | "devDependencies": { 8 | "ava": "^3.15.0", 9 | "got": "^11.8.2", 10 | "test-listen": "^1.1.0" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/endpoint-testing/readme.md: -------------------------------------------------------------------------------- 1 | # Endpoint testing 2 | 3 | > Example for [endpoint testing](https://github.com/avajs/ava/blob/main/docs/recipes/endpoint-testing.md) 4 | 5 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/avajs/ava/tree/main/examples/endpoint-testing?file=test.js&terminal=test&view=editor) 6 | -------------------------------------------------------------------------------- /examples/macros/index.js: -------------------------------------------------------------------------------- 1 | exports.sum = (a, b) => a + b; 2 | -------------------------------------------------------------------------------- /examples/macros/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ava-macros", 3 | "description": "Example for reusing test logic through macros", 4 | "scripts": { 5 | "test": "ava" 6 | }, 7 | "devDependencies": { 8 | "ava": "^3.15.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/macros/readme.md: -------------------------------------------------------------------------------- 1 | # Macros 2 | 3 | > Example for [reusing test logic through macros](https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#reusing-test-logic-through-macros) 4 | 5 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/avajs/ava/tree/main/examples/macros?file=test.js&terminal=test&view=editor) 6 | -------------------------------------------------------------------------------- /examples/macros/test.js: -------------------------------------------------------------------------------- 1 | const test = require('ava'); 2 | 3 | const {sum} = require('./index.js'); 4 | 5 | function macro(t, a, b, expected) { 6 | t.is(sum(a, b), expected); 7 | } 8 | 9 | macro.title = (providedTitle, a, b, expected) => `${providedTitle ?? ''} ${a}+${b} = ${expected}`.trim(); 10 | 11 | test(macro, 2, 2, 4); 12 | test(macro, 3, 3, 6); 13 | test('providedTitle', macro, 4, 4, 8); 14 | -------------------------------------------------------------------------------- /examples/matching-titles/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ava-matching-titles", 3 | "description": "Example for running tests with matching titles", 4 | "scripts": { 5 | "test": "ava --match='*oo*'" 6 | }, 7 | "devDependencies": { 8 | "ava": "^3.15.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/matching-titles/readme.md: -------------------------------------------------------------------------------- 1 | # Running tests with matching titles 2 | 3 | > Example for [running tests with matching titles](https://github.com/avajs/ava/blob/main/docs/05-command-line.md#running-tests-with-matching-titles) 4 | 5 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/avajs/ava/tree/main/examples/matching-titles?file=test.js&terminal=test&view=editor) 6 | -------------------------------------------------------------------------------- /examples/matching-titles/test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const test = require('ava'); 3 | 4 | test('foo will run', t => { 5 | t.pass(); 6 | }); 7 | 8 | test('moo will also run', t => { 9 | t.pass(); 10 | }); 11 | 12 | test.only('boo will run but not exclusively', t => { 13 | t.pass(); 14 | }); 15 | -------------------------------------------------------------------------------- /examples/specific-line-numbers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ava-specific-line-numbers", 3 | "description": "Example for running tests at specific line numbers", 4 | "scripts": { 5 | "test": "ava test.js:5" 6 | }, 7 | "devDependencies": { 8 | "ava": "^3.15.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/specific-line-numbers/test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const test = require('ava'); 3 | 4 | test('unicorn', t => { 5 | t.pass(); 6 | }); 7 | 8 | test('rainbow', t => { 9 | t.fail(); 10 | }); 11 | -------------------------------------------------------------------------------- /examples/tap-reporter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ava-tap-reporter", 3 | "description": "Example for a custom TAP reporter", 4 | "scripts": { 5 | "test": "ava --tap | tap-nyan" 6 | }, 7 | "devDependencies": { 8 | "ava": "^3.15.0", 9 | "tap-nyan": "^1.1.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /examples/tap-reporter/readme.md: -------------------------------------------------------------------------------- 1 | # Running tests at specific line numbers 2 | 3 | > Example for a [custom TAP reporter](https://github.com/avajs/ava/blob/main/docs/05-command-line.md#running-tests-at-specific-line-numbers) 4 | 5 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/avajs/ava/tree/main/examples/tap-reporter?file=test.js&terminal=test&view=editor) 6 | -------------------------------------------------------------------------------- /examples/tap-reporter/test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const test = require('ava'); 3 | 4 | test('unicorn', t => { 5 | t.pass(); 6 | }); 7 | 8 | test('rainbow', t => { 9 | t.fail(); 10 | }); 11 | 12 | test('foo', t => { 13 | t.pass(); 14 | }); 15 | 16 | test('bar', t => { 17 | t.pass(); 18 | }); 19 | 20 | test('baz', t => { 21 | t.pass(); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/timeouts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ava-timeouts", 3 | "description": "Example for test timeouts", 4 | "scripts": { 5 | "test": "ava --timeout=2s --verbose" 6 | }, 7 | "devDependencies": { 8 | "ava": "^3.15.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/timeouts/readme.md: -------------------------------------------------------------------------------- 1 | # Test timeouts 2 | 3 | > Example for [test timeouts](https://github.com/avajs/ava/blob/main/docs/07-test-timeouts.md) 4 | 5 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/avajs/ava/tree/main/examples/timeouts?file=test.js&terminal=test&view=editor) 6 | -------------------------------------------------------------------------------- /examples/typescript-basic/readme.md: -------------------------------------------------------------------------------- 1 | # TypeScript basic example 2 | 3 | > Basic example for [AVA with TypeScript](https://github.com/avajs/ava/blob/main/docs/recipes/typescript.md) 4 | 5 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/avajs/ava/tree/main/examples/typescript-basic?file=source%2Ftest.ts&terminal=test&view=editor) 6 | -------------------------------------------------------------------------------- /examples/typescript-basic/source/index.ts: -------------------------------------------------------------------------------- 1 | export const sum = (a: number, b: number) => a + b; 2 | 3 | export const subtract = (a: number, b: number) => a - b; 4 | -------------------------------------------------------------------------------- /examples/typescript-basic/source/test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | import {sum, subtract} from '.'; 4 | 5 | test('sum', t => { 6 | t.is(sum(0, 0), 0); 7 | t.is(sum(2, 2), 4); 8 | }); 9 | 10 | test('subtract', t => { 11 | t.is(subtract(0, 0), 0); 12 | t.is(subtract(4, 2), 2); 13 | }); 14 | -------------------------------------------------------------------------------- /examples/typescript-basic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@sindresorhus/tsconfig", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "build", 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/typescript-context/readme.md: -------------------------------------------------------------------------------- 1 | # TypeScript context example 2 | 3 | > TypeScript example for [typing `t.context`](https://github.com/avajs/ava/blob/main/docs/recipes/typescript.md#typing-tcontext) 4 | 5 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/avajs/ava/tree/main/examples/typescript-context?file=source%2Ftest.ts&terminal=test&view=editor) 6 | -------------------------------------------------------------------------------- /examples/typescript-context/source/index.ts: -------------------------------------------------------------------------------- 1 | export const concat = (input: string[]) => input.join(' '); 2 | -------------------------------------------------------------------------------- /examples/typescript-context/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@sindresorhus/tsconfig", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "build", 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | // For compatibility with resolution algorithms other than Node16. 2 | 3 | export * from './entrypoints/main.cjs'; 4 | export {default} from './entrypoints/main.cjs'; 5 | -------------------------------------------------------------------------------- /lib/api-event-iterator.js: -------------------------------------------------------------------------------- 1 | export async function * asyncEventIteratorFromApi(api) { 2 | // TODO: support multiple runs (watch mode) 3 | const {value: plan} = await api.events('run').next(); 4 | 5 | for await (const stateChange of plan.status.events('stateChange')) { 6 | yield stateChange; 7 | 8 | if (stateChange.type === 'end' || stateChange.type === 'interrupt') { 9 | break; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/chalk.js: -------------------------------------------------------------------------------- 1 | import {Chalk} from 'chalk'; // eslint-disable-line unicorn/import-style 2 | 3 | let chalk = new Chalk(); // eslint-disable-line import/no-mutable-exports 4 | 5 | export {chalk}; 6 | 7 | let configured = false; 8 | export function set(options) { 9 | if (configured) { 10 | throw new Error('Chalk has already been configured'); 11 | } 12 | 13 | configured = true; 14 | chalk = new Chalk(options); 15 | } 16 | -------------------------------------------------------------------------------- /lib/is-ci.js: -------------------------------------------------------------------------------- 1 | import process from 'node:process'; 2 | 3 | import info from 'ci-info'; 4 | 5 | const {AVA_FORCE_CI} = process.env; 6 | 7 | export default AVA_FORCE_CI === 'not-ci' ? false : AVA_FORCE_CI === 'ci' || info.isCI; 8 | -------------------------------------------------------------------------------- /lib/pkg.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = require('../package.json'); 3 | -------------------------------------------------------------------------------- /lib/worker/completion-handlers.js: -------------------------------------------------------------------------------- 1 | import process from 'node:process'; 2 | 3 | import state from './state.cjs'; 4 | 5 | export function runCompletionHandlers() { 6 | for (const handler of state.completionHandlers) { 7 | process.nextTick(() => handler()); 8 | } 9 | } 10 | 11 | export function registerCompletionHandler(handler) { 12 | state.completionHandlers.push(handler); 13 | } 14 | -------------------------------------------------------------------------------- /lib/worker/main.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./guard-environment.cjs'); // eslint-disable-line import/no-unassigned-import 3 | 4 | const assert = require('node:assert'); 5 | 6 | const {flags, refs} = require('./state.cjs'); 7 | 8 | assert(refs.runnerChain); 9 | 10 | flags.loadedMain = true; 11 | 12 | module.exports = refs.runnerChain; 13 | -------------------------------------------------------------------------------- /lib/worker/options.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | let options = null; 3 | exports.get = () => { 4 | if (!options) { 5 | throw new Error('Options have not yet been set'); 6 | } 7 | 8 | return options; 9 | }; 10 | 11 | exports.set = newOptions => { 12 | if (options) { 13 | throw new Error('Options have already been set'); 14 | } 15 | 16 | options = newOptions; 17 | }; 18 | -------------------------------------------------------------------------------- /lib/worker/state.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | exports.flags = {loadedMain: false}; 3 | exports.refs = {runnerChain: null}; 4 | exports.completionHandlers = []; 5 | exports.sharedWorkerTeardowns = []; 6 | exports.waitForReady = []; 7 | -------------------------------------------------------------------------------- /lib/worker/utils.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const process = require('node:process'); 3 | const {isMainThread} = require('node:worker_threads'); 4 | 5 | exports.isRunningInThread = isMainThread === false; 6 | exports.isRunningInChildProcess = typeof process.send === 'function'; 7 | -------------------------------------------------------------------------------- /media/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/header.png -------------------------------------------------------------------------------- /media/header.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/header.psd -------------------------------------------------------------------------------- /media/logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/logo.ai -------------------------------------------------------------------------------- /media/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/logo.png -------------------------------------------------------------------------------- /media/magic-assert-combined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/magic-assert-combined.png -------------------------------------------------------------------------------- /media/pronunciation.m4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/pronunciation.m4a -------------------------------------------------------------------------------- /media/screenshot-fixtures/magic-assert-buffers.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('buffers', t => { 4 | const actual = Buffer.from('decafbadcab00d1e'.repeat(4), 'hex') 5 | const expected = Buffer.from('cab00d1edecafbad' + 'decafbadcab00d1e'.repeat(3), 'hex') 6 | t.deepEqual(actual, expected) 7 | }); 8 | -------------------------------------------------------------------------------- /media/screenshot-fixtures/magic-assert-exceptions.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import test from 'ava'; 3 | 4 | test('exception', t => { 5 | fs.readFileSync('non-existent-file') 6 | }); 7 | -------------------------------------------------------------------------------- /media/screenshot-fixtures/magic-assert-objects.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('objects', t => { 4 | const actual = { 5 | a: 1, 6 | b: { 7 | c: 2 8 | } 9 | }; 10 | 11 | const expected = { 12 | a: 1, 13 | b: { 14 | c: 3 15 | } 16 | }; 17 | 18 | t.deepEqual(actual, expected); 19 | }); 20 | -------------------------------------------------------------------------------- /media/screenshot-fixtures/magic-assert-strings.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('strings', t => { 4 | const actual = 'this is amazing'; 5 | const expected = 'this is cool'; 6 | t.is(actual, expected); 7 | }); 8 | -------------------------------------------------------------------------------- /media/screenshot-fixtures/mini-reporter.md: -------------------------------------------------------------------------------- 1 | Run the [Got](https://github.com/sindresorhus/got) tests. 2 | -------------------------------------------------------------------------------- /media/screenshot-fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "screenshot-fixtures", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "magic-assert-buffers.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "" 11 | } 12 | -------------------------------------------------------------------------------- /media/screenshot-fixtures/snapshot-testing.md: -------------------------------------------------------------------------------- 1 | See: https://github.com/avajs/ava-snapshot-example 2 | -------------------------------------------------------------------------------- /media/screenshot-fixtures/verbose-reporter.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('unicorn', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('rainbow', t => { 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /media/snapshot-testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/snapshot-testing.png -------------------------------------------------------------------------------- /media/tap-reporter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/tap-reporter.png -------------------------------------------------------------------------------- /media/verbose-reporter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/media/verbose-reporter.png -------------------------------------------------------------------------------- /plugin.d.ts: -------------------------------------------------------------------------------- 1 | // For compatibility with resolution algorithms other than Node16. 2 | 3 | export * from './entrypoints/plugin.cjs'; 4 | -------------------------------------------------------------------------------- /scripts/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | npx xo 5 | npx tsc --noEmit 6 | npx c8 --report=none test-ava 7 | npx c8 --report=none --no-clean tap 8 | npx c8 report 9 | -------------------------------------------------------------------------------- /test-tap/chalk.js: -------------------------------------------------------------------------------- 1 | import {test} from 'tap'; 2 | 3 | import {set} from '../lib/chalk.js'; 4 | 5 | test('throws an error when trying to set chalk config and chalk config is configured', t => { 6 | set({}); 7 | t.throws(set, 'Chalk has already been configured'); 8 | t.end(); 9 | }); 10 | -------------------------------------------------------------------------------- /test-tap/fixture/.fake-root: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/.fake-root -------------------------------------------------------------------------------- /test-tap/fixture/assert.cjs.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `assert.cjs` 2 | 3 | The actual snapshot is saved in `assert.cjs.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## passes 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'bar', 13 | } 14 | 15 | > Snapshot 2 16 | 17 | { 18 | foo: 'bar', 19 | } 20 | 21 | ## fails 22 | 23 | > Snapshot 1 24 | 25 | { 26 | foo: 'bar', 27 | } 28 | -------------------------------------------------------------------------------- /test-tap/fixture/assert.cjs.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/assert.cjs.snap -------------------------------------------------------------------------------- /test-tap/fixture/ava-paths/cwd/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/ava-paths/cwd/.gitkeep -------------------------------------------------------------------------------- /test-tap/fixture/ava-paths/target/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('ava'); 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/caching/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "application-name", 3 | "version": "0.0.1" 4 | } 5 | -------------------------------------------------------------------------------- /test-tap/fixture/caching/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('test', t => { 4 | t.true(2 + 2 === 4); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/cjs.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('pass', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/error-in-anonymous-function.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | const getAnonymousFn = () => () => { 4 | throw new Error(); 5 | }; 6 | 7 | test('test', t => { 8 | getAnonymousFn()(); 9 | t.pass(); 10 | }); 11 | -------------------------------------------------------------------------------- /test-tap/fixture/es2015.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/eslint-plugin-helper/ava.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: [], 3 | files: ['tests/**/*'], 4 | typescript: { 5 | compile: false, 6 | rewritePaths: { 7 | 'src/': 'build/', 8 | }, 9 | extensions: ['foo'], 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /test-tap/fixture/eslint-plugin-helper/for-overriding/ava.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: [], 3 | typescript: { 4 | rewritePaths: { 5 | 'src/': 'build/', 6 | }, 7 | compile: false, 8 | extensions: ['bar'], 9 | }, 10 | files: ['build/tests/**/*'], 11 | }; 12 | -------------------------------------------------------------------------------- /test-tap/fixture/eslint-plugin-helper/for-overriding/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/eslint-plugin-helper/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/extensions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "application-name", 3 | "version": "0.0.1" 4 | } 5 | -------------------------------------------------------------------------------- /test-tap/fixture/extensions/test.foo.bar: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | const one = {one: 1}; 4 | const two = {two: 2}; 5 | 6 | test('foo', t => { 7 | // Using optional catch-binding to ensure it transpiles on Node.js 8, since this 8 | // is a Node.js 10 feature 9 | try { 10 | throw new Error('test') 11 | } catch { 12 | t.pass() 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/crash/crashes.cjs: -------------------------------------------------------------------------------- 1 | require('../../../../entrypoints/main.cjs'); // eslint-disable-line import/no-unassigned-import 2 | 3 | process.exit(1); // eslint-disable-line unicorn/no-process-exit 4 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/crash/passes.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('first pass', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/multiple-files/passes.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('first pass', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/single-file/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('first pass', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('second fail', t => { 8 | t.fail(); 9 | }); 10 | 11 | test('third pass', t => { 12 | t.pass(); 13 | }); 14 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/timeout/fails.cjs: -------------------------------------------------------------------------------- 1 | const {setTimeout: delay} = require('node:timers/promises'); 2 | 3 | const test = require('../../../../entrypoints/main.cjs'); 4 | 5 | test('slow pass', async t => { 6 | await delay(1000); 7 | t.pass(); 8 | }); 9 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/timeout/passes-slow.cjs: -------------------------------------------------------------------------------- 1 | const {setTimeout: delay} = require('node:timers/promises'); 2 | 3 | const test = require('../../../../entrypoints/main.cjs'); 4 | 5 | test('slow pass with timeout', async t => { 6 | t.timeout(120); 7 | await delay(110); 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/timeout/passes.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('first pass', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/without-error/a.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('pass', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/fail-fast/without-error/b.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | setTimeout(() => { 4 | test.serial('pass', t => t.pass()); 5 | }, 2000); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/formatting-color.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('test', t => { 4 | t.deepEqual({foo: 1}, {foo: 2}); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/custom-extension/test/do-not-compile.cjs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/globs/custom-extension/test/do-not-compile.cjs -------------------------------------------------------------------------------- /test-tap/fixture/globs/custom-extension/test/foo.jsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/globs/custom-extension/test/foo.jsx -------------------------------------------------------------------------------- /test-tap/fixture/globs/custom-extension/test/helpers/a.jsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/globs/custom-extension/test/helpers/a.jsx -------------------------------------------------------------------------------- /test-tap/fixture/globs/custom-extension/test/helpers/b.cjs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/globs/custom-extension/test/helpers/b.cjs -------------------------------------------------------------------------------- /test-tap/fixture/globs/custom-extension/test/sub/_helper.jsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/globs/custom-extension/test/sub/_helper.jsx -------------------------------------------------------------------------------- /test-tap/fixture/globs/custom-extension/test/sub/bar.jsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/globs/custom-extension/test/sub/bar.jsx -------------------------------------------------------------------------------- /test-tap/fixture/globs/cwd/dir-a/test/bar.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/cwd/dir-a/test/foo.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/cwd/dir-b/test/baz.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/sub/directory/__tests__/_foo.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/sub/directory/__tests__/fixtures/foo.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/sub/directory/__tests__/foo.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/sub/directory/__tests__/helpers/foo.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/sub/directory/__tests__/helpers/foo.ts: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/sub/directory/bar.spec.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/sub/directory/bar.test.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test-foo.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test-foo.ts: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test/_foo-help.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test/baz.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test/deep/deep.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test/fixtures/foo-fixt.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/test/helpers/test.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/tests/_foo-help.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/tests/baz.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/tests/deep/deep.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/tests/fixtures/foo-fixt.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/default-patterns/tests/helpers/test.cjs: -------------------------------------------------------------------------------- 1 | // Empty 2 | -------------------------------------------------------------------------------- /test-tap/fixture/globs/no-files/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/ignored-dirs/helpers/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/ignored-dirs/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('pass', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/infinity-stack-trace.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | Error.stackTraceLimit = 1; 4 | 5 | test('test', t => { 6 | const c = () => t.fail(); 7 | const b = () => c(); 8 | const a = () => b(); 9 | 10 | a(); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/cjs/ava.config.cjs: -------------------------------------------------------------------------------- 1 | const configFactory = ({projectDir}) => ({ 2 | files: projectDir, 3 | }); 4 | 5 | module.exports = configFactory; 6 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/cjs/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/contains-ava-property/ava.config.js: -------------------------------------------------------------------------------- 1 | export default Object.create({ 2 | ava: {}, 3 | }); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/contains-ava-property/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/explicit-bad-extension/explicit.txt: -------------------------------------------------------------------------------- 1 | const config = { 2 | files: 'config-file-esm-test-value' 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/explicit-bad-extension/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/factory-no-plain-return/ava.config.js: -------------------------------------------------------------------------------- 1 | class Config {} 2 | 3 | const configFactory = () => new Config(); 4 | 5 | export default configFactory; 6 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/factory-no-plain-return/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/file-yes-cjs-yes/ava.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | files: 'package-yes-files-yes-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/file-yes-cjs-yes/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: 'package-yes-files-yes-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/file-yes-cjs-yes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/no-default-export/ava.config.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/load-config/no-default-export/ava.config.js -------------------------------------------------------------------------------- /test-tap/fixture/load-config/no-default-export/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/no-plain-config/ava.config.js: -------------------------------------------------------------------------------- 1 | export default 'should not work!'; 2 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/no-plain-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/non-function/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | filterNodeArgumentsForWorkerThreads: [], 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/non-function/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/non-object-experiments/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | nonSemVerExperiments: [], 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/non-object-experiments/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-no-file-yes-factory/ava.config.js: -------------------------------------------------------------------------------- 1 | const configFactory = ({projectDir}) => ({ 2 | files: projectDir, 3 | }); 4 | 5 | export default configFactory; 6 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-no-file-yes-factory/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-no-file-yes/ava.config.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | files: 'config-file-esm-test-value', 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-no-file-yes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-only/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "failFast": true, 4 | "concurrency": 10 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-yes-explicit-yes/explicit.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: 'package-yes-explicit-yes-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-yes-explicit-yes/nested/explicit.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: 'package-yes-explicit-yes-nested-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-yes-explicit-yes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "abc", 5 | "!xyz" 6 | ] 7 | }, 8 | "type": "module" 9 | } 10 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-yes-file-yes/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: 'package-yes-files-yes-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/package-yes-file-yes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "abc", 5 | "!xyz" 6 | ] 7 | }, 8 | "type": "module" 9 | } 10 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/require/ava.config.js: -------------------------------------------------------------------------------- 1 | const config = require('./cjs.cjs'); // eslint-disable-line unicorn/prefer-module 2 | 3 | export default config; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/require/cjs.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | files: 'config-file-cjs-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/require/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/throws/ava.config.js: -------------------------------------------------------------------------------- 1 | throw new Error('foo'); 2 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/throws/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/unsupported-experiments/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | nonSemVerExperiments: { 3 | unsupported: true, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /test-tap/fixture/load-config/unsupported-experiments/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/long-running.cjs: -------------------------------------------------------------------------------- 1 | const {setTimeout: delay} = require('node:timers/promises'); 2 | 3 | const test = require('../../entrypoints/main.cjs'); 4 | 5 | test('slow', async t => { 6 | t.log('helpful log of a pending test'); 7 | await delay(5000); 8 | t.pass(); 9 | }); 10 | 11 | test('fast', t => t.pass()); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/match-no-match-2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('this test will match', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('this test will not match', t => { 8 | t.pass(); 9 | }); 10 | 11 | test('this test will also not match', t => { 12 | t.pass(); 13 | }); 14 | -------------------------------------------------------------------------------- /test-tap/fixture/match-no-match.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('foo', t => { 4 | t.pass(); 5 | }); 6 | 7 | test.only('bar', t => { 8 | t.pass(); 9 | }); 10 | 11 | test.only('baz', t => { 12 | t.pass(); 13 | }); 14 | -------------------------------------------------------------------------------- /test-tap/fixture/matcher-skip.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('foo', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('bar', t => { 8 | t.pass(); 9 | }); 10 | 11 | test('baz', t => { 12 | t.fail(); 13 | }); 14 | 15 | test('tests are fun', t => { 16 | t.pass(); 17 | }); 18 | 19 | test('tests are not fun', t => { 20 | t.fail(); 21 | }); 22 | -------------------------------------------------------------------------------- /test-tap/fixture/mjs.mjs: -------------------------------------------------------------------------------- 1 | import test from '../../entrypoints/main.mjs'; 2 | 3 | test('pass', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/no-tests.cjs: -------------------------------------------------------------------------------- 1 | require('../../entrypoints/main.cjs'); // eslint-disable-line import/no-unassigned-import 2 | -------------------------------------------------------------------------------- /test-tap/fixture/node-env-foo.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('NODE_ENV is foo', t => { 4 | t.plan(1); 5 | t.is(process.env.NODE_ENV, 'foo'); 6 | }); 7 | -------------------------------------------------------------------------------- /test-tap/fixture/node-env-test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('NODE_ENV is test', t => { 4 | t.plan(1); 5 | t.is(process.env.NODE_ENV, 'test'); 6 | }); 7 | -------------------------------------------------------------------------------- /test-tap/fixture/package-config/fail-without-assertions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "failWithoutAssertions": false 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-tap/fixture/package-config/fail-without-assertions/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('test', () => {}); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": ["**/*"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/0-1.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '2'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/0-2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '2'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/0-3.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '2'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/1-1.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '1'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/1-2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '1'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/1-3.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '1'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/2-1.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '0'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/2-2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '0'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/2-3.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '0'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: ['*.cjs'], 3 | // Descending order 4 | sortTestFiles: (a, b) => b.localeCompare(a, [], {numeric: true}), 5 | }; 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/custom-comparator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/less-files-than-ci-total/2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '0'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/less-files-than-ci-total/9.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '1'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/less-files-than-ci-total/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "*.cjs" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/10.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '1'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '0'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/2a.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '0'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/9.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '0'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/Ab.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/filename-case */ 2 | const test = require('../../../../entrypoints/main.cjs'); 3 | 4 | test('at expected index', t => { 5 | t.is(process.env.CI_NODE_INDEX, '1'); 6 | }); 7 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/a.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '1'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/b.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '2'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/c.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('at expected index', t => { 4 | t.is(process.env.CI_NODE_INDEX, '2'); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/more-files-than-ci-total/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "*.cjs" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-tap/fixture/parallel-runs/no-files/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "*.cjs" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-tap/fixture/pkg-type-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/pkg-type-module/test.js: -------------------------------------------------------------------------------- 1 | import test from '../../../entrypoints/main.mjs'; 2 | 3 | test('pass', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/process-cwd-default.cjs: -------------------------------------------------------------------------------- 1 | const path = require('node:path'); 2 | 3 | const test = require('../../entrypoints/main.cjs'); 4 | 5 | test('test', async t => { 6 | const {packageConfigSync, packageJsonPath} = await import('package-config'); 7 | const config = packageConfigSync('ava'); 8 | const packageDirectory = path.dirname(packageJsonPath(config)); 9 | t.is(process.cwd(), packageDirectory); 10 | }); 11 | -------------------------------------------------------------------------------- /test-tap/fixture/process-cwd-pkgdir.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('test', t => { 4 | t.is(process.cwd(), __dirname); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/report/README.md: -------------------------------------------------------------------------------- 1 | To run these tests directly, `cd` into the respective directories and invoke via `node ../../../../entrypoints/cli.mjs`. 2 | 3 | Note that the `report` helper sorts the test files before running tests. 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/edgecases/ast-syntax-error.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | const fn = do { 4 | t => t.pass(); 5 | }; 6 | 7 | test('fn', fn); 8 | -------------------------------------------------------------------------------- /test-tap/fixture/report/edgecases/ava-import-no-test-declaration.cjs: -------------------------------------------------------------------------------- 1 | require('../../../../entrypoints/main.cjs'); // eslint-disable-line import/no-unassigned-import 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/edgecases/import-and-use-test-member.cjs: -------------------------------------------------------------------------------- 1 | const {test} = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('pass', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/edgecases/no-ava-import.cjs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/report/edgecases/no-ava-import.cjs -------------------------------------------------------------------------------- /test-tap/fixture/report/edgecases/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('passes', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/edgecases/throws.cjs: -------------------------------------------------------------------------------- 1 | throw new Error('throws'); 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/failfast/a.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('fails', t => t.fail()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/failfast/b.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('passes', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/failfast/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/failfast2/a.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('fails', t => t.fail()); 4 | test('passes', t => t.pass()); 5 | -------------------------------------------------------------------------------- /test-tap/fixture/report/failfast2/b.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('passes', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/failfast2/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/only/a.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test.only('only', t => t.pass()); 4 | 5 | test('passes', t => t.pass()); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/report/only/b.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('passes', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/only/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/regular/bad-test-chain.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test.serial.test('passes', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/report/regular/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/regular/uncaught-exception.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('passes', t => { 4 | setImmediate(() => { 5 | throw new Error('Can’t catch me'); 6 | }); 7 | t.pass(); 8 | }); 9 | -------------------------------------------------------------------------------- /test-tap/fixture/report/regular/unhandled-rejection.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | const passes = t => { 4 | Promise.reject(new Error('Can’t catch me')); 5 | t.pass(); 6 | }; 7 | 8 | test('passes', passes); 9 | 10 | test('unhandled non-error rejection', t => { 11 | const error = null; 12 | Promise.reject(error); 13 | t.pass(); 14 | }); 15 | -------------------------------------------------------------------------------- /test-tap/fixture/report/timeoutcontextlogs/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/timeoutinmultiplefiles/a.cjs: -------------------------------------------------------------------------------- 1 | const {setTimeout: delay} = require('node:timers/promises'); 2 | 3 | const test = require('../../../../entrypoints/main.cjs'); 4 | 5 | test('a passes', t => t.pass()); 6 | 7 | test('a slow', async t => { 8 | await delay(5000); 9 | t.pass(); 10 | }); 11 | test('a slow two', async t => { 12 | await delay(5000); 13 | t.pass(); 14 | }); 15 | 16 | test('a passes two', t => t.pass()); 17 | -------------------------------------------------------------------------------- /test-tap/fixture/report/timeoutinmultiplefiles/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/timeoutinsinglefile/a.cjs: -------------------------------------------------------------------------------- 1 | const {setTimeout: delay} = require('node:timers/promises'); 2 | 3 | const test = require('../../../../entrypoints/main.cjs'); 4 | 5 | test('passes', t => t.pass()); 6 | 7 | test('slow', async t => { 8 | await delay(5000); 9 | t.pass(); 10 | }); 11 | test('slow two', async t => { 12 | await delay(5000); 13 | t.pass(); 14 | }); 15 | 16 | test('passes two', t => t.pass()); 17 | -------------------------------------------------------------------------------- /test-tap/fixture/report/timeoutinsinglefile/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/timeoutwithmatch/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/watch/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/report/watch/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('passes', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/reset-cache/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/reset-cache/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('pass', t => t.pass()); 4 | -------------------------------------------------------------------------------- /test-tap/fixture/skip-only.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test.skip('test', t => { 4 | t.fail(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/.gitignore: -------------------------------------------------------------------------------- 1 | *.snap 2 | *.md 3 | snapshots 4 | __snapshots__ 5 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/__tests__-dir/__tests__/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../entrypoints/main.cjs'); 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/__tests__-dir/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-content/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "tests/test.cjs" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-content/test.cjs.md.expected: -------------------------------------------------------------------------------- 1 | # Snapshot report for `tests/test.cjs` 2 | 3 | The actual snapshot is saved in `test.cjs.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## test title 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'bar', 13 | } 14 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-content/test.cjs.snap.expected: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/snapshots/test-content/test.cjs.snap.expected -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-content/tests/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../entrypoints/main.cjs'); 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-dir/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-dir/test/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../entrypoints/main.cjs'); 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-snapshot-location/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "src/**/*test.cjs" 5 | ], 6 | "snapshotDir": "snapshot-fixtures" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-snapshot-location/src/feature/nested-feature/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../../../entrypoints/main.cjs'); 2 | 3 | test('test nested feature title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another nested feature test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-snapshot-location/src/feature/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../../entrypoints/main.cjs'); 2 | 3 | test('test feature title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another feature test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-snapshot-location/src/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../entrypoints/main.cjs'); 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/build/feature/__tests__/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../../../entrypoints/main.cjs'); 2 | test('feature test title', t => { 3 | t.snapshot({ foo: 'bar' }); 4 | t.snapshot({ answer: 40 }); 5 | }); 6 | test('another feature test', t => { 7 | t.snapshot(new Map()); 8 | }); 9 | //# sourceMappingURL=test.cjs.map 10 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/build/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../entrypoints/main.cjs'); 2 | test('top level test title', t => { 3 | t.snapshot({ foo: 'bar' }); 4 | t.snapshot({ answer: 42 }); 5 | }); 6 | test('another top level test', t => { 7 | t.snapshot(new Map()); 8 | }); 9 | //# sourceMappingURL=test.cjs.map 10 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/build/test/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../../entrypoints/main.cjs'); 2 | test('test title', t => { 3 | t.snapshot({ foo: 'bar' }); 4 | t.snapshot({ answer: 43 }); 5 | }); 6 | test('another test', t => { 7 | t.snapshot(new Map()); 8 | }); 9 | //# sourceMappingURL=test.cjs.map 10 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "build/**/test.cjs" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/src/feature/__tests__/test.ts: -------------------------------------------------------------------------------- 1 | import test from '../../../../../../../entrypoints/main.cjs'; 2 | 3 | test('feature test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 40}); 7 | }); 8 | 9 | test('another feature test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/src/test.ts: -------------------------------------------------------------------------------- 1 | import test from '../../../../../entrypoints/main.cjs'; 2 | 3 | test('top level test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another top level test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/src/test/test.ts: -------------------------------------------------------------------------------- 1 | import test from '../../../../../../entrypoints/main.cjs'; 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 43}); 7 | }); 8 | 9 | test('another test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test-sourcemaps/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "outDir": "build", 6 | "sourceMap": true, 7 | "strictNullChecks": true 8 | }, 9 | "include": [ 10 | "src/**/*test.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/tests-dir/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "tests/**/*.cjs" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/tests-dir/tests/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../../entrypoints/main.cjs'); 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/watcher-rerun-unlink/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/watcher-rerun/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test-tap/fixture/snapshots/watcher-rerun/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../../entrypoints/main.cjs'); 2 | 3 | test('test title', t => { 4 | t.snapshot({foo: 'bar'}); 5 | 6 | t.snapshot({answer: 42}); 7 | }); 8 | 9 | test('another test', t => { 10 | t.snapshot(new Map()); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/fixture/sort-tests/0.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('should run third', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/sort-tests/1.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('should run second', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/sort-tests/2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('should run first', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/sort-tests/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: ['*.cjs'], 3 | // Descending order 4 | sortTestFiles: (a, b) => b.localeCompare(a, [], {numeric: true}), 5 | concurrency: 1, 6 | verbose: true, 7 | }; 8 | -------------------------------------------------------------------------------- /test-tap/fixture/sort-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test-tap/fixture/stalled-tests/observable.cjs: -------------------------------------------------------------------------------- 1 | const Observable = require('zen-observable'); 2 | 3 | const test = require('../../../entrypoints/main.cjs'); 4 | 5 | test('test', t => new Observable(() => { 6 | t.pass(); 7 | })); 8 | -------------------------------------------------------------------------------- /test-tap/fixture/stalled-tests/promise.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('test', t => new Promise(() => { 4 | t.pass(); 5 | })); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/symlink: -------------------------------------------------------------------------------- 1 | ./symlinkdir -------------------------------------------------------------------------------- /test-tap/fixture/symlinkdir/symlink.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/symlinkfile.cjs: -------------------------------------------------------------------------------- 1 | target-symlink.cjs -------------------------------------------------------------------------------- /test-tap/fixture/tap/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": ["**/test*.*"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test-tap/fixture/tap/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | test('works', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/target-symlink.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/fixture/test-count-2.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('passCount', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('failCount', t => { 8 | t.fail(); 9 | }); 10 | 11 | test.skip('skipCount', t => { 12 | t.pass(); 13 | }); 14 | 15 | test.todo('todoCount'); 16 | -------------------------------------------------------------------------------- /test-tap/fixture/test-count-3.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('passCount', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('passCount2', t => { 8 | t.pass(); 9 | }); 10 | 11 | test('failCount', t => { 12 | t.fail(); 13 | }); 14 | 15 | test.skip('skipCount', t => { 16 | t.pass(); 17 | }); 18 | 19 | test.todo('todoCount'); 20 | -------------------------------------------------------------------------------- /test-tap/fixture/test-count.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('passCount', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('failCount', t => { 8 | t.fail(); 9 | }); 10 | 11 | test.skip('skipCount', t => { 12 | t.pass(); 13 | }); 14 | 15 | test.todo('todoCount'); 16 | -------------------------------------------------------------------------------- /test-tap/fixture/try-snapshot.cjs.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/try-snapshot.cjs.snap -------------------------------------------------------------------------------- /test-tap/fixture/with-dependencies/dep-1.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/with-dependencies/dep-1.js -------------------------------------------------------------------------------- /test-tap/fixture/with-dependencies/dep-2.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/with-dependencies/dep-2.js -------------------------------------------------------------------------------- /test-tap/fixture/with-dependencies/dep-3.custom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test-tap/fixture/with-dependencies/dep-3.custom -------------------------------------------------------------------------------- /test-tap/fixture/with-dependencies/no-tests.cjs: -------------------------------------------------------------------------------- 1 | require('./dep-1.js'); // eslint-disable-line import/no-unassigned-import 2 | require('./dep-2.js'); // eslint-disable-line import/no-unassigned-import 3 | require('./dep-3.custom'); // eslint-disable-line import/no-unassigned-import 4 | -------------------------------------------------------------------------------- /test-tap/fixture/with-dependencies/require-custom.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable n/no-deprecated-api */ 2 | require.extensions['.custom'] = require.extensions['.js']; 3 | -------------------------------------------------------------------------------- /test-tap/fixture/with-dependencies/test-failure.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | require('./dep-1.js'); // eslint-disable-line import/no-unassigned-import 4 | require('./dep-2.js'); // eslint-disable-line import/no-unassigned-import 5 | require('./dep-3.custom'); // eslint-disable-line import/no-unassigned-import 6 | 7 | test('hey ho', t => { 8 | t.fail(); 9 | }); 10 | -------------------------------------------------------------------------------- /test-tap/fixture/with-dependencies/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../../entrypoints/main.cjs'); 2 | 3 | require('./dep-1.js'); // eslint-disable-line import/no-unassigned-import 4 | require('./dep-2.js'); // eslint-disable-line import/no-unassigned-import 5 | require('./dep-3.custom'); // eslint-disable-line import/no-unassigned-import 6 | 7 | test('hey ho', t => { 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /test-tap/fixture/worker-argv.cjs: -------------------------------------------------------------------------------- 1 | const test = require('../../entrypoints/main.cjs'); 2 | 3 | test('argv', t => { 4 | t.deepEqual(process.argv, [process.execPath, require.resolve('../../lib/worker/base'), '--hello', 'world']); 5 | }); 6 | -------------------------------------------------------------------------------- /test-tap/helper/chalk0.js: -------------------------------------------------------------------------------- 1 | import {set as setChalk} from '../../lib/chalk.js'; 2 | 3 | setChalk({level: 0}); 4 | -------------------------------------------------------------------------------- /test-tap/helper/report-worker.js: -------------------------------------------------------------------------------- 1 | import {onlyColors} from './fix-reporter-env.js'; 2 | 3 | onlyColors(); 4 | import('../../lib/worker/base.js'); 5 | -------------------------------------------------------------------------------- /test-tap/integration/repl.js: -------------------------------------------------------------------------------- 1 | import {execa} from 'execa'; 2 | import {test} from 'tap'; 3 | 4 | test('Throws error when required from the REPL', t => execa('node', ['-r', 'ava'], {reject: false}).then(result => { 5 | t.match(result.stderr, 'The ’ava’ module can only be imported in test files'); 6 | })); 7 | -------------------------------------------------------------------------------- /test-tap/node-arguments.js: -------------------------------------------------------------------------------- 1 | import {test} from 'tap'; 2 | 3 | import normalizeNodeArguments from '../lib/node-arguments.js'; 4 | 5 | test('combines arguments', async t => { 6 | t.same( 7 | await normalizeNodeArguments(['--require setup.cjs'], '--throw-deprecation --zero-fill-buffers'), 8 | [...process.execArgv, '--require setup.cjs', '--throw-deprecation', '--zero-fill-buffers'], 9 | ); 10 | t.end(); 11 | }); 12 | -------------------------------------------------------------------------------- /test-tap/reporters/default.only.v18.log: -------------------------------------------------------------------------------- 1 | 2 | ---tty-stream-chunk-separator 3 | ✔ a › only 4 | ---tty-stream-chunk-separator 5 | ✔ b › passes 6 | ---tty-stream-chunk-separator 7 | ─ 8 | 9 | 2 tests passed 10 | ---tty-stream-chunk-separator 11 | -------------------------------------------------------------------------------- /test-tap/reporters/default.only.v20.log: -------------------------------------------------------------------------------- 1 | 2 | ---tty-stream-chunk-separator 3 | ✔ a › only 4 | ---tty-stream-chunk-separator 5 | ✔ b › passes 6 | ---tty-stream-chunk-separator 7 | ─ 8 | 9 | 2 tests passed 10 | ---tty-stream-chunk-separator 11 | -------------------------------------------------------------------------------- /test-tap/reporters/default.only.v22.log: -------------------------------------------------------------------------------- 1 | 2 | ---tty-stream-chunk-separator 3 | ✔ a › only 4 | ---tty-stream-chunk-separator 5 | ✔ b › passes 6 | ---tty-stream-chunk-separator 7 | ─ 8 | 9 | 2 tests passed 10 | ---tty-stream-chunk-separator 11 | -------------------------------------------------------------------------------- /test-tap/reporters/default.only.v23.log: -------------------------------------------------------------------------------- 1 | 2 | ---tty-stream-chunk-separator 3 | ✔ a › only 4 | ---tty-stream-chunk-separator 5 | ✔ b › passes 6 | ---tty-stream-chunk-separator 7 | ─ 8 | 9 | 2 tests passed 10 | ---tty-stream-chunk-separator 11 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.failfast.v18.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | not ok 1 - a › fails 4 | --- 5 | name: AssertionError 6 | assertion: t.fail() 7 | message: Test failed via `t.fail()` 8 | at: 'ExecutionContext.fail (/lib/assert.js:287:15)' 9 | ... 10 | ---tty-stream-chunk-separator 11 | 12 | 1..1 13 | # tests 1 14 | # pass 0 15 | # fail 1 16 | 17 | ---tty-stream-chunk-separator 18 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.failfast.v20.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | not ok 1 - a › fails 4 | --- 5 | name: AssertionError 6 | assertion: t.fail() 7 | message: Test failed via `t.fail()` 8 | at: 'ExecutionContext.fail (/lib/assert.js:287:15)' 9 | ... 10 | ---tty-stream-chunk-separator 11 | 12 | 1..1 13 | # tests 1 14 | # pass 0 15 | # fail 1 16 | 17 | ---tty-stream-chunk-separator 18 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.failfast.v22.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | not ok 1 - a › fails 4 | --- 5 | name: AssertionError 6 | assertion: t.fail() 7 | message: Test failed via `t.fail()` 8 | at: 'ExecutionContext.fail (/lib/assert.js:287:15)' 9 | ... 10 | ---tty-stream-chunk-separator 11 | 12 | 1..1 13 | # tests 1 14 | # pass 0 15 | # fail 1 16 | 17 | ---tty-stream-chunk-separator 18 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.failfast.v23.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | not ok 1 - a › fails 4 | --- 5 | name: AssertionError 6 | assertion: t.fail() 7 | message: Test failed via `t.fail()` 8 | at: 'ExecutionContext.fail (/lib/assert.js:287:15)' 9 | ... 10 | ---tty-stream-chunk-separator 11 | 12 | 1..1 13 | # tests 1 14 | # pass 0 15 | # fail 1 16 | 17 | ---tty-stream-chunk-separator 18 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.only.v18.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | ok 1 - a › only 4 | ---tty-stream-chunk-separator 5 | ok 2 - b › passes 6 | ---tty-stream-chunk-separator 7 | 8 | 1..2 9 | # tests 2 10 | # pass 2 11 | # fail 0 12 | 13 | ---tty-stream-chunk-separator 14 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.only.v20.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | ok 1 - a › only 4 | ---tty-stream-chunk-separator 5 | ok 2 - b › passes 6 | ---tty-stream-chunk-separator 7 | 8 | 1..2 9 | # tests 2 10 | # pass 2 11 | # fail 0 12 | 13 | ---tty-stream-chunk-separator 14 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.only.v22.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | ok 1 - a › only 4 | ---tty-stream-chunk-separator 5 | ok 2 - b › passes 6 | ---tty-stream-chunk-separator 7 | 8 | 1..2 9 | # tests 2 10 | # pass 2 11 | # fail 0 12 | 13 | ---tty-stream-chunk-separator 14 | -------------------------------------------------------------------------------- /test-tap/reporters/tap.only.v23.log: -------------------------------------------------------------------------------- 1 | TAP version 13 2 | ---tty-stream-chunk-separator 3 | ok 1 - a › only 4 | ---tty-stream-chunk-separator 5 | ok 2 - b › passes 6 | ---tty-stream-chunk-separator 7 | 8 | 1..2 9 | # tests 2 10 | # pass 2 11 | # fail 0 12 | 13 | ---tty-stream-chunk-separator 14 | -------------------------------------------------------------------------------- /test-tap/tsconfig.json: -------------------------------------------------------------------------------- 1 | // Empty config file so that TAP doesn't choke on ours. 2 | {} 3 | -------------------------------------------------------------------------------- /test-types/.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | -------------------------------------------------------------------------------- /test-types/import-in-cts/teardown.cts: -------------------------------------------------------------------------------- 1 | import test from '../../entrypoints/main.cjs'; 2 | 3 | test('test', t => { 4 | t.teardown(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function 5 | t.teardown(async () => {}); // eslint-disable-line @typescript-eslint/no-empty-function 6 | }); 7 | -------------------------------------------------------------------------------- /test-types/import-in-cts/timeout.cts: -------------------------------------------------------------------------------- 1 | import test from '../../entrypoints/main.cjs'; 2 | 3 | test('test', t => { 4 | t.timeout(100); 5 | t.timeout.clear(); 6 | }); 7 | -------------------------------------------------------------------------------- /test-types/module/teardown.ts: -------------------------------------------------------------------------------- 1 | import test from '../../entrypoints/main.mjs'; 2 | 3 | test('test', t => { 4 | t.teardown(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function 5 | t.teardown(async () => {}); // eslint-disable-line @typescript-eslint/no-empty-function 6 | }); 7 | -------------------------------------------------------------------------------- /test-types/module/timeout.ts: -------------------------------------------------------------------------------- 1 | import test from '../../entrypoints/main.mjs'; 2 | 3 | test('test', t => { 4 | t.timeout(100); 5 | t.timeout.clear(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/.fake-root: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/.fake-root -------------------------------------------------------------------------------- /test/assertions/fixtures/happy-path.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `happy-path.js` 2 | 3 | The actual snapshot is saved in `happy-path.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## t.snapshot({"foo":"bar"}) passes 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'bar', 13 | } 14 | -------------------------------------------------------------------------------- /test/assertions/fixtures/happy-path.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/assertions/fixtures/happy-path.js.snap -------------------------------------------------------------------------------- /test/assertions/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/assertions/fixtures/throws-async.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('throws native error', async t => { 4 | await t.throwsAsync(async () => { 5 | throw new Error('foo'); 6 | }); 7 | }); 8 | 9 | test('throws object that extends the error prototype', async t => { 10 | await t.throwsAsync(async () => { 11 | throw Object.create(Error.prototype); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /test/assertions/fixtures/throws.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('throws native error', t => { 4 | t.throws(() => { 5 | throw new Error('foo'); 6 | }); 7 | }); 8 | 9 | test('throws object that extends the error prototype', t => { 10 | t.throws(() => { 11 | throw Object.create(Error.prototype); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /test/assertions/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/assertions/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/builtin-nodejs-assert/fixtures/assert-failure.js: -------------------------------------------------------------------------------- 1 | import assert from 'node:assert'; 2 | 3 | import test from 'ava'; 4 | 5 | test('test', () => { 6 | assert(false); 7 | }); 8 | -------------------------------------------------------------------------------- /test/builtin-nodejs-assert/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/cjs-default/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "files": [ 4 | "*.cjs" 5 | ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/cjs-default/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../helpers/exec.js'; 4 | 5 | test('ok', async t => { 6 | await t.notThrowsAsync(fixture()); 7 | }); 8 | -------------------------------------------------------------------------------- /test/completion-handlers/fixtures/exit0.js: -------------------------------------------------------------------------------- 1 | import test, { registerCompletionHandler } from 'ava' 2 | 3 | registerCompletionHandler(() => { 4 | process.exit(0) 5 | }) 6 | 7 | test('pass', t => t.pass()) 8 | -------------------------------------------------------------------------------- /test/completion-handlers/fixtures/one.js: -------------------------------------------------------------------------------- 1 | import test, { registerCompletionHandler } from 'ava' 2 | 3 | registerCompletionHandler(() => { 4 | console.error('one') 5 | }) 6 | 7 | test('pass', t => { 8 | t.pass() 9 | }) 10 | -------------------------------------------------------------------------------- /test/completion-handlers/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/completion-handlers/fixtures/two.js: -------------------------------------------------------------------------------- 1 | import test, { registerCompletionHandler } from 'ava' 2 | 3 | registerCompletionHandler(() => { 4 | console.error('one') 5 | }) 6 | registerCompletionHandler(() => { 7 | console.error('two') 8 | }) 9 | 10 | test('pass', t => t.pass()) 11 | -------------------------------------------------------------------------------- /test/concurrency/fixtures/concurrency.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('works', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/concurrency/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/concurrency/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/concurrency/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/config-require/fixtures/exports-default/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "require": "./required.cjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/config-require/fixtures/exports-default/required.cjs: -------------------------------------------------------------------------------- 1 | exports.called = false; 2 | 3 | exports.default = function () { 4 | exports.called = true; 5 | }; 6 | -------------------------------------------------------------------------------- /test/config-require/fixtures/exports-default/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | import required from './required.cjs'; 4 | 5 | test('exports.default is called', t => { 6 | t.true(required.called); 7 | }); 8 | -------------------------------------------------------------------------------- /test/config-require/fixtures/failed-import/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "require": "@babel/register" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/config-require/fixtures/failed-import/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('should not make it this far', t => { 4 | t.fail(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/config-require/fixtures/non-json/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | require: [ 3 | ['./required.mjs', new Map([['hello', 'world']])], 4 | ], 5 | }; 6 | -------------------------------------------------------------------------------- /test/config-require/fixtures/non-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config-require/fixtures/non-json/required.mjs: -------------------------------------------------------------------------------- 1 | export let receivedArgs = null; // eslint-disable-line import/no-mutable-exports 2 | 3 | export default function (...args) { 4 | receivedArgs = args; 5 | } 6 | -------------------------------------------------------------------------------- /test/config-require/fixtures/non-json/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | import {receivedArgs} from './required.mjs'; 4 | 5 | test('non-JSON arguments can be provided', t => { 6 | t.deepEqual(receivedArgs, [new Map([['hello', 'world']])]); 7 | }); 8 | -------------------------------------------------------------------------------- /test/config-require/fixtures/require-dependency/.gitignore: -------------------------------------------------------------------------------- 1 | !node_modules/@ava 2 | -------------------------------------------------------------------------------- /test/config-require/fixtures/require-dependency/node_modules/@ava/stub/index.js: -------------------------------------------------------------------------------- 1 | export let required = false; // eslint-disable-line import/no-mutable-exports 2 | 3 | export default function () { 4 | required = true; 5 | } 6 | -------------------------------------------------------------------------------- /test/config-require/fixtures/require-dependency/node_modules/@ava/stub/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@ava/stub", 3 | "type": "module" 4 | } 5 | -------------------------------------------------------------------------------- /test/config-require/fixtures/require-dependency/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "require": [ 5 | "@ava/stub" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/config-require/fixtures/require-dependency/test.js: -------------------------------------------------------------------------------- 1 | import {required} from '@ava/stub'; 2 | import test from 'ava'; 3 | 4 | test('loads dependencies', t => { 5 | t.true(required); 6 | }); 7 | -------------------------------------------------------------------------------- /test/config-require/fixtures/single-argument/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "require": "./required.js" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/config-require/fixtures/single-argument/required.js: -------------------------------------------------------------------------------- 1 | export let required = false; // eslint-disable-line import/no-mutable-exports 2 | 3 | export default function () { 4 | required = true; 5 | } 6 | -------------------------------------------------------------------------------- /test/config-require/fixtures/single-argument/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | import {required} from './required.js'; 4 | 5 | test('loads when given as a single argument', t => { 6 | t.true(required); 7 | }); 8 | -------------------------------------------------------------------------------- /test/config-require/fixtures/with-arguments/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | require: [ 3 | ['./required.mjs', 'hello', 'world'], 4 | ['./required.cjs', 'goodbye'], 5 | './side-effect.js', 6 | ], 7 | }; 8 | -------------------------------------------------------------------------------- /test/config-require/fixtures/with-arguments/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config-require/fixtures/with-arguments/required.cjs: -------------------------------------------------------------------------------- 1 | function init(...args) { 2 | init.receivedArgs = args; 3 | } 4 | 5 | init.receivedArgs = null; 6 | 7 | module.exports = init; 8 | -------------------------------------------------------------------------------- /test/config-require/fixtures/with-arguments/required.mjs: -------------------------------------------------------------------------------- 1 | export let receivedArgs = null; // eslint-disable-line import/no-mutable-exports 2 | 3 | export default function (...args) { 4 | receivedArgs = args; 5 | } 6 | -------------------------------------------------------------------------------- /test/config-require/fixtures/with-arguments/side-effect.js: -------------------------------------------------------------------------------- 1 | export default Date.now(); 2 | -------------------------------------------------------------------------------- /test/config/fixtures/config-errors/ava.config.js: -------------------------------------------------------------------------------- 1 | throw new Error('foo'); 2 | -------------------------------------------------------------------------------- /test/config/fixtures/config-errors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/config-errors/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/factory-promise-return/ava.config.js: -------------------------------------------------------------------------------- 1 | export default async () => ({ 2 | failFast: true, 3 | }); 4 | -------------------------------------------------------------------------------- /test/config/fixtures/factory-promise-return/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/file-yes-cjs-yes-mjs-yes/ava.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | files: 'package-yes-files-yes-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/file-yes-cjs-yes-mjs-yes/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: 'package-yes-files-yes-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/file-yes-cjs-yes-mjs-yes/ava.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | files: 'package-yes-files-yes-test-value', 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/file-yes-cjs-yes-mjs-yes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/js-as-cjs/ava.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { // eslint-disable-line unicorn/prefer-module 2 | failFast: true, 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/js-as-cjs/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/config/fixtures/js-as-esm/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | failFast: true, 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/js-as-esm/error.js: -------------------------------------------------------------------------------- 1 | export default { 2 | failFast: true, 3 | }; 4 | 5 | throw new Error('🙈'); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/js-as-esm/no-default-export.js: -------------------------------------------------------------------------------- 1 | export const config = { 2 | failFast: true, 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/js-as-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs-with-tests/ava.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | files: ['dir-a/*.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs-with-tests/dir-a-wrapper/dir-a/dir-a-wrapper-3.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('test', t => { 5 | t.pass(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs-with-tests/dir-a-wrapper/dir-a/dir-a-wrapper-4.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('test', t => { 5 | t.pass(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs-with-tests/dir-a/dir-a-base-1.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs-with-tests/dir-a/dir-a-base-2.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs-with-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "name": "application-name", 4 | "version": "0.0.1" 5 | } 6 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs/ava.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | failFast: true, 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs/error.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | failFast: true, 3 | }; 4 | 5 | throw new Error('🙈'); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs/no-default-export.mjs: -------------------------------------------------------------------------------- 1 | export const config = { 2 | failFast: true, 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/mjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/monorepo/ava.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | files: ['foo.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/monorepo/package/foo.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('foo', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/monorepo/package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/pkg-with-tests/dir-a-wrapper/dir-a/dir-a-wrapper-3.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('test', t => { 5 | t.pass(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/config/fixtures/pkg-with-tests/dir-a-wrapper/dir-a/dir-a-wrapper-4.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('test', t => { 5 | t.pass(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/config/fixtures/pkg-with-tests/dir-a/dir-a-base-1.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/pkg-with-tests/dir-a/dir-a-base-2.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/config/fixtures/pkg-with-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "name": "application-name", 4 | "version": "0.0.1", 5 | "ava": { 6 | "files": [ 7 | "dir-a/*.js" 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/config/fixtures/promise-config/ava.config.js: -------------------------------------------------------------------------------- 1 | export default Promise.resolve({ 2 | failFast: true, 3 | }); 4 | -------------------------------------------------------------------------------- /test/config/fixtures/promise-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/fixtures/unsupported-configs/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | failFast: true, 3 | }; 4 | -------------------------------------------------------------------------------- /test/config/fixtures/unsupported-configs/ava.config.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/config/fixtures/unsupported-configs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/config/snapshots/integration.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/config/snapshots/integration.js.snap -------------------------------------------------------------------------------- /test/config/snapshots/loader.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/config/snapshots/loader.js.snap -------------------------------------------------------------------------------- /test/config/snapshots/next-gen.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/config/snapshots/next-gen.js.snap -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/array-custom.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: ['js', 'cts'], 3 | }; 4 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/array-extensions.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: ['js', 'cjs', 'mjs'], 3 | }; 4 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/bad-custom-type.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: { 3 | js: true, 4 | ts: 'cjs', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/change-cjs-loading.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: { 3 | cjs: 'module', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/change-js-loading.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: { 3 | js: 'module', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/change-mjs-loading.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: { 3 | mjs: 'commonjs', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/object-custom.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: { 3 | js: true, 4 | cts: 'commonjs', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/object-extensions.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | extensions: { 3 | js: true, 4 | cjs: true, 5 | mjs: true, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/test.cjs: -------------------------------------------------------------------------------- 1 | const test = require('ava'); 2 | 3 | test('always passing test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/test.cts: -------------------------------------------------------------------------------- 1 | const test = require('ava'); // eslint-disable-line ava/no-ignored-test-files 2 | 3 | // @ts-expect-error TS2345 4 | test('always passing test', t => { 5 | const numberWithTypes = 0; 6 | 7 | t.is(numberWithTypes, 0); 8 | }); 9 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('always passing test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/configurable-module-format/fixtures/test.mjs: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('always passing test', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/configurable-module-format/snapshots/invalid-configurations.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/configurable-module-format/snapshots/invalid-configurations.js.snap -------------------------------------------------------------------------------- /test/environment-variables/fixtures/environment-variables/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | environmentVariables: {MY_ENVIRONMENT_VARIABLE: 'some value'}, 3 | files: ['*.js'], 4 | }; 5 | -------------------------------------------------------------------------------- /test/environment-variables/fixtures/environment-variables/environment-variables.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('works', t => { 4 | t.is(process.env.MY_ENVIRONMENT_VARIABLE, 'some value'); 5 | }); 6 | -------------------------------------------------------------------------------- /test/environment-variables/fixtures/environment-variables/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/environment-variables/fixtures/invalid-environment-variables/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "environmentVariables": { 5 | "SOME_INVALID_ENVIRONMENT_VARIABLE": {} 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/environment-variables/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/environment-variables/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/extensions/fixtures/shared-duplicates/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "typescript": { 5 | "rewritePaths": { 6 | "src/": "build/" 7 | }, 8 | "compile": false, 9 | "extensions": [ 10 | "ts", 11 | "tsx" 12 | ] 13 | }, 14 | "extensions": [ 15 | "tsx" 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/extensions/fixtures/top-level-duplicates/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "extensions": [ 5 | "js", 6 | "js", 7 | "jsx", 8 | "jsx" 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/extensions/fixtures/top-level/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "extensions": [ 5 | "js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/extensions/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/extensions/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/external-assertions/fixtures/assert-failure.js: -------------------------------------------------------------------------------- 1 | import assert from 'node:assert'; 2 | 3 | import test from 'ava'; 4 | 5 | test('test', () => { 6 | assert(false); 7 | }); 8 | 9 | test('test async', async () => { 10 | assert(await Promise.resolve(false)); 11 | }); 12 | -------------------------------------------------------------------------------- /test/external-assertions/fixtures/expect-failure.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import {expect} from 'expect'; 3 | 4 | test('test', () => { 5 | expect(false).toBeTruthy(); 6 | }); 7 | 8 | test('test async', async () => { 9 | expect(await Promise.resolve(false)).toBeTruthy(); 10 | }); 11 | -------------------------------------------------------------------------------- /test/external-assertions/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | }, 8 | "dependencies": { 9 | "expect": "^29.5.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/external-assertions/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/external-assertions/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/globs/fixtures/files/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/globs/fixtures/filter-by-directory/directory/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('directory', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/globs/fixtures/filter-by-directory/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "**/test.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/globs/fixtures/filter-by-directory/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('file', t => { 4 | t.fail(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/globs/fixtures/ignored-by-watcher/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "watchMode": { 5 | "ignoreChanges": [] 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/globs/fixtures/treat-patterns-as-files/_helper.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('helper files must not be selected', t => { 5 | t.fail(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/globs/fixtures/treat-patterns-as-files/foo.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('foo.js', t => { 5 | t.pass(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/globs/fixtures/treat-patterns-as-files/foo.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('typescript files must not be selected', t => { 5 | t.fail(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/globs/fixtures/treat-patterns-as-files/node_modules/test.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line ava/no-ignored-test-files 2 | import test from 'ava'; 3 | 4 | test('node_modules files must not be selected', t => { 5 | t.fail(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/globs/fixtures/treat-patterns-as-files/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "**/test.js" 6 | ], 7 | "typescript": { 8 | "compile": false, 9 | "rewritePaths": { 10 | "src/": "build/" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/globs/fixtures/treat-patterns-as-files/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('test.js', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/globs/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/globs/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/helpers/with-temporary-fixture.js: -------------------------------------------------------------------------------- 1 | import fs from 'node:fs/promises'; 2 | 3 | import {temporaryDirectoryTask} from 'tempy'; 4 | 5 | export async function withTemporaryFixture(cwd, task) { 6 | let result; 7 | await temporaryDirectoryTask(async temporary => { 8 | await fs.cp(cwd, temporary, {recursive: true}); 9 | result = await task(temporary); 10 | }); 11 | 12 | return result; 13 | } 14 | -------------------------------------------------------------------------------- /test/hook-restrictions/fixtures/invalid-snapshots-in-hooks.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test.before(t => { 4 | t.snapshot({}); 5 | }); 6 | 7 | test('cannot use snapshot in hook', t => { 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/hook-restrictions/fixtures/invalid-t-try-in-hooks.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test.before(async t => { 4 | await t.try(tt => tt.pass()); 5 | }); 6 | 7 | test('cannot use `t.try()` in hook', t => { 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/hook-restrictions/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/hook-restrictions/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/hook-restrictions/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/idle-timeouts/fixtures/console-output.js: -------------------------------------------------------------------------------- 1 | import {setTimeout as delay} from 'node:timers/promises'; 2 | import test from 'ava'; 3 | 4 | test('timeout with console output', async t => { 5 | t.timeout(1000, 'timeout despite console output'); 6 | for (let i = 0; await delay(100, true); i++) { 7 | if (i % 2 === 0) { 8 | console.log('stdout'); 9 | } else { 10 | console.error('stderr'); 11 | } 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /test/idle-timeouts/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ], 7 | "timeout": "500ms" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/idle-timeouts/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../helpers/exec.js'; 4 | 5 | test('idle timeouts are not blocked by console output', async t => { 6 | const result = await t.throwsAsync(fixture(['console-output.js'])); 7 | const error = result.stats.getError(result.stats.failed[0]); 8 | t.is(error.message, 'timeout despite console output'); 9 | }); 10 | -------------------------------------------------------------------------------- /test/internal-events/fixtures/.gitignore: -------------------------------------------------------------------------------- 1 | internal-events.json 2 | -------------------------------------------------------------------------------- /test/internal-events/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/internal-events/fixtures/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('placeholder', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/line-numbers/fixtures/README.md: -------------------------------------------------------------------------------- 1 | Compile using: 2 | 3 | ```console 4 | npx tsc line-numbers.ts --outDir . --sourceMap --module es2020 --moduleResolution node 5 | ``` 6 | -------------------------------------------------------------------------------- /test/line-numbers/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/line-numbers/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/line-numbers/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/macros/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/macros/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../helpers/exec.js'; 4 | 5 | test('a-okay', async t => { 6 | const result = await fixture([]); 7 | t.is(result.stats.passed.length, 3); 8 | }); 9 | -------------------------------------------------------------------------------- /test/meta/fixtures/meta.cjs: -------------------------------------------------------------------------------- 1 | const url = require('node:url'); 2 | 3 | const test = require('ava'); 4 | 5 | test('meta.file', t => { 6 | t.is(test.meta.file, url.pathToFileURL(__filename).toString()); 7 | }); 8 | 9 | test('meta.snapshotDirectory', t => { 10 | const {meta} = test; 11 | t.true(meta.snapshotDirectory.startsWith('file://')); 12 | t.regex(meta.snapshotDirectory, /snapshot-fixture/); 13 | }); 14 | 15 | -------------------------------------------------------------------------------- /test/meta/fixtures/meta.mjs: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('meta.file', t => { 4 | t.is(test.meta.file, import.meta.url); 5 | }); 6 | 7 | test('meta.snapshotDirectory', t => { 8 | const {meta} = test; 9 | t.true(meta.snapshotDirectory.startsWith('file://')); 10 | t.regex(meta.snapshotDirectory, /snapshot-fixture/); 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /test/meta/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*" 6 | ], 7 | "snapshotDir": "snapshot-fixture" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/meta/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../helpers/exec.js'; 4 | 5 | test('with CJS files', async t => { 6 | const result = await fixture(['meta.cjs']); 7 | t.is(result.stats.passed.length, 2); 8 | }); 9 | 10 | test('with MJS files', async t => { 11 | const result = await fixture(['meta.mjs']); 12 | t.is(result.stats.passed.length, 2); 13 | }); 14 | -------------------------------------------------------------------------------- /test/multiple-implementations/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/multiple-implementations/fixtures/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('title', []); 4 | -------------------------------------------------------------------------------- /test/multiple-implementations/fixtures/try.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('try', async t => { 4 | await t.try([]); 5 | }); 6 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/node-arguments-from-config/node-arguments-from-config.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('works', t => { 4 | t.plan(2); 5 | t.truthy(global.SETUP_CALLED, 'setup variable set'); 6 | t.truthy(process.execArgv.some(argv => argv.startsWith('--require')), 'require passed'); 7 | }); 8 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/node-arguments-from-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ], 7 | "nodeArguments": [ 8 | "--require", 9 | "./setup.cjs" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/node-arguments-from-config/setup.cjs: -------------------------------------------------------------------------------- 1 | global.SETUP_CALLED = true; 2 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/node-arguments/node-arguments.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('exec arguments includes --throw-deprecation', t => { 4 | t.plan(1); 5 | t.truthy(process.execArgv.includes('--throw-deprecation')); 6 | }); 7 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/node-arguments/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/thread-arguments-filter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/thread-arguments-filter/process.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('exec arguments unfiltered', t => { 4 | t.plan(2); 5 | t.truthy(process.execArgv.includes('--throw-deprecation')); 6 | t.truthy(process.execArgv.includes('--allow-natives-syntax')); 7 | }); 8 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/thread-arguments-filter/thread-arguments-filter.config.mjs: -------------------------------------------------------------------------------- 1 | const processOnly = new Set(['--allow-natives-syntax']); 2 | 3 | export default { 4 | nodeArguments: [ 5 | '--throw-deprecation', 6 | '--allow-natives-syntax', 7 | ], 8 | filterNodeArgumentsForWorkerThreads: argument => !processOnly.has(argument), 9 | }; 10 | -------------------------------------------------------------------------------- /test/node-arguments/fixtures/thread-arguments-filter/thread.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('exec arguments filtered', t => { 4 | t.plan(2); 5 | t.truthy(process.execArgv.includes('--throw-deprecation')); 6 | t.falsy(process.execArgv.includes('--allow-natives-syntax')); 7 | }); 8 | -------------------------------------------------------------------------------- /test/node-arguments/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/node-arguments/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/node_modules/ava: -------------------------------------------------------------------------------- 1 | ../../ -------------------------------------------------------------------------------- /test/scheduler/fixtures/1pass.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('pass', t => { 4 | t.log(Date.now()); 5 | t.pass(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/scheduler/fixtures/2fail.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('fail', t => { 4 | t.log(Date.now()); 5 | t.fail(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/scheduler/fixtures/disabled-cache.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | files: [ 3 | '*.js', 4 | ], 5 | cache: false, 6 | }; 7 | -------------------------------------------------------------------------------- /test/scheduler/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/shared-workers/cannot-publish-before-available/fixtures/_worker.js: -------------------------------------------------------------------------------- 1 | export default async ({negotiateProtocol}) => { 2 | negotiateProtocol(['ava-4']).ready(); 3 | }; 4 | -------------------------------------------------------------------------------- /test/shared-workers/cannot-publish-before-available/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/shared-workers/cannot-publish-before-available/fixtures/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import * as plugin from 'ava/plugin'; 3 | 4 | test('cannot publish before ready', t => { 5 | const worker = plugin.registerSharedWorker({ 6 | filename: new URL('_worker.js', import.meta.url), 7 | supportedProtocols: ['ava-4'], 8 | }); 9 | 10 | t.throws(() => worker.publish(), {message: 'Shared worker is not yet available'}); 11 | }); 12 | -------------------------------------------------------------------------------- /test/shared-workers/cannot-publish-before-available/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/shared-workers/cannot-publish-before-available/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/shared-workers/cannot-publish-before-available/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../../helpers/exec.js'; 4 | 5 | test('shared worker plugins work', async t => { 6 | const result = await fixture(); 7 | t.snapshot(result.stats.passed); 8 | }); 9 | -------------------------------------------------------------------------------- /test/shared-workers/lifecycle/fixtures/_worker.js: -------------------------------------------------------------------------------- 1 | export default ({negotiateProtocol}) => { 2 | negotiateProtocol(['ava-4']).ready(); 3 | }; 4 | -------------------------------------------------------------------------------- /test/shared-workers/lifecycle/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/shared-workers/lifecycle/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../../helpers/exec.js'; 4 | 5 | test('availability', async t => { 6 | await t.notThrowsAsync(fixture(['available.js'])); 7 | }); 8 | 9 | test('teardown', async t => { 10 | const result = await fixture(['teardown.js']); 11 | t.true(result.stderr.includes('TEARDOWN CALLED')); 12 | }); 13 | -------------------------------------------------------------------------------- /test/shared-workers/multiple-workers-are-loaded/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/shared-workers/multiple-workers-are-loaded/fixtures/worker.mjs: -------------------------------------------------------------------------------- 1 | export default async ({negotiateProtocol}) => { 2 | const protocol = negotiateProtocol(['ava-4']); 3 | 4 | await protocol.ready(); 5 | 6 | for await (const testWorker of protocol.testWorkers()) { 7 | testWorker.publish(protocol.initialData); 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /test/shared-workers/multiple-workers-are-loaded/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../../helpers/exec.js'; 4 | 5 | test('can load multiple workers', async t => { 6 | await fixture(); 7 | 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/shared-workers/restricted-to-worker-threads/fixtures/_worker.js: -------------------------------------------------------------------------------- 1 | export default async ({negotiateProtocol}) => { 2 | negotiateProtocol(['ava-4']).ready(); 3 | }; 4 | -------------------------------------------------------------------------------- /test/shared-workers/restricted-to-worker-threads/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/shared-workers/restricted-to-worker-threads/fixtures/test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import * as plugin from 'ava/plugin'; 3 | 4 | plugin.registerSharedWorker({ 5 | filename: new URL('_worker.js', import.meta.url), 6 | supportedProtocols: ['ava-4'], 7 | }); 8 | 9 | test('registering', t => { 10 | t.pass(); 11 | }); 12 | -------------------------------------------------------------------------------- /test/shared-workers/timeout/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ], 7 | "timeout": "5s" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/shared-workers/timeout/fixtures/test.js: -------------------------------------------------------------------------------- 1 | import {setTimeout as delay} from 'node:timers/promises'; 2 | 3 | import test from 'ava'; 4 | import {registerSharedWorker} from 'ava/plugin'; 5 | 6 | registerSharedWorker({ 7 | filename: new URL('worker.mjs', import.meta.url), 8 | supportedProtocols: ['ava-4'], 9 | }); 10 | 11 | test('time out', async t => { 12 | await delay(10_000); 13 | 14 | t.pass(); 15 | }); 16 | -------------------------------------------------------------------------------- /test/shared-workers/timeout/fixtures/worker.mjs: -------------------------------------------------------------------------------- 1 | export default ({negotiateProtocol}) => { 2 | negotiateProtocol(['ava-4']).ready(); 3 | }; 4 | -------------------------------------------------------------------------------- /test/shared-workers/timeout/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../../helpers/exec.js'; 4 | 5 | test('times out', async t => { 6 | const error = await t.throwsAsync(async () => fixture()); 7 | 8 | t.is(error.exitCode, 1); 9 | }); 10 | -------------------------------------------------------------------------------- /test/shared-workers/unsupported-protocol/fixtures/_worker.js: -------------------------------------------------------------------------------- 1 | export default async ({negotiateProtocol}) => { 2 | negotiateProtocol(['🙈']).ready(); 3 | }; 4 | -------------------------------------------------------------------------------- /test/shared-workers/unsupported-protocol/fixtures/in-shared-worker.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import * as plugin from 'ava/plugin'; 3 | 4 | plugin.registerSharedWorker({ 5 | filename: new URL('_worker.js', import.meta.url), 6 | supportedProtocols: ['ava-4'], 7 | }); 8 | 9 | test('shared worker should cause tests to fail', t => { 10 | t.fail(); 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /test/shared-workers/unsupported-protocol/fixtures/in-test-worker.js: -------------------------------------------------------------------------------- 1 | import * as plugin from 'ava/plugin'; 2 | 3 | plugin.registerSharedWorker({ 4 | supportedProtocols: ['🙈'], 5 | filename: import.meta.url, 6 | }); 7 | -------------------------------------------------------------------------------- /test/shared-workers/unsupported-protocol/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/shared-workers/unsupported-protocol/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/shared-workers/unsupported-protocol/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/shared-workers/worker-execution-crash/fixtures/_plugin.js: -------------------------------------------------------------------------------- 1 | import * as plugin from 'ava/plugin'; 2 | 3 | export default plugin.registerSharedWorker({ 4 | filename: new URL('_worker.js', import.meta.url), 5 | supportedProtocols: ['ava-4'], 6 | }); 7 | -------------------------------------------------------------------------------- /test/shared-workers/worker-execution-crash/fixtures/_worker.js: -------------------------------------------------------------------------------- 1 | export default async ({negotiateProtocol}) => { 2 | const protocol = negotiateProtocol(['ava-4']); 3 | protocol.ready(); 4 | 5 | crash(protocol.subscribe()); 6 | }; 7 | 8 | async function crash(messages) { 9 | for await (const message of messages) { // eslint-disable-line no-unreachable-loop 10 | throw new Error(message.data); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/shared-workers/worker-execution-crash/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/shared-workers/worker-execution-crash/snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test/shared-workers/worker-execution-crash/test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## shared worker plugins work 8 | 9 | > Snapshot 1 10 | 11 | [ 12 | { 13 | file: 'test.js', 14 | title: 'shared workers crash', 15 | }, 16 | ] 17 | -------------------------------------------------------------------------------- /test/shared-workers/worker-execution-crash/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/shared-workers/worker-execution-crash/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/shared-workers/worker-execution-crash/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../../helpers/exec.js'; 4 | 5 | test('shared worker plugins work', async t => { 6 | const result = await t.throwsAsync(fixture()); 7 | t.snapshot(result.stats.passed); 8 | t.is(result.stats.sharedWorkerErrors[0].message, '🙈'); 9 | }); 10 | -------------------------------------------------------------------------------- /test/shared-workers/worker-protocol/fixtures/_plugin.js: -------------------------------------------------------------------------------- 1 | import * as plugin from 'ava/plugin'; 2 | 3 | export default plugin.registerSharedWorker({ 4 | filename: new URL('_worker.js', import.meta.url), 5 | supportedProtocols: ['ava-4'], 6 | }); 7 | -------------------------------------------------------------------------------- /test/shared-workers/worker-protocol/fixtures/other.test.js: -------------------------------------------------------------------------------- 1 | import declare from './_declare.js'; 2 | 3 | declare(import.meta.url); 4 | -------------------------------------------------------------------------------- /test/shared-workers/worker-protocol/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/shared-workers/worker-protocol/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/shared-workers/worker-protocol/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/shared-workers/worker-protocol/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../../helpers/exec.js'; 4 | 5 | test('shared worker plugins work', async t => { 6 | const result = await fixture(); 7 | t.snapshot(result.stats.passed); 8 | }); 9 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/fixtures/_factory-function.js: -------------------------------------------------------------------------------- 1 | export default () => { 2 | throw new Error('🙈'); 3 | }; 4 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/fixtures/_module.js: -------------------------------------------------------------------------------- 1 | throw new Error('🙊'); 2 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/fixtures/_no-factory-function.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/shared-workers/worker-startup-crashes/fixtures/_no-factory-function.js -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/fixtures/factory-function.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import * as plugin from 'ava/plugin'; 3 | 4 | plugin.registerSharedWorker({ 5 | filename: new URL('_factory-function.js', import.meta.url), 6 | supportedProtocols: ['ava-4'], 7 | }); 8 | 9 | test('shared worker should cause tests to fail', t => { 10 | t.fail(); 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/fixtures/module.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import * as plugin from 'ava/plugin'; 3 | 4 | plugin.registerSharedWorker({ 5 | filename: new URL('_module.js', import.meta.url), 6 | supportedProtocols: ['ava-4'], 7 | }); 8 | 9 | test('shared worker should cause tests to fail', t => { 10 | t.fail(); 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/fixtures/no-factory-function.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import * as plugin from 'ava/plugin'; 3 | 4 | plugin.registerSharedWorker({ 5 | filename: new URL('_no-factory-function.js', import.meta.url), 6 | supportedProtocols: ['ava-4'], 7 | }); 8 | 9 | test('shared worker should cause tests to fail', t => { 10 | t.fail(); 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test/shared-workers/worker-startup-crashes/test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## handles crashes in when there is no factory function 8 | 9 | > Snapshot 1 10 | 11 | 'Missing default factory function export for shared worker plugin at FILE' 12 | -------------------------------------------------------------------------------- /test/shared-workers/worker-startup-crashes/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/shared-workers/worker-startup-crashes/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/shared-workers/workers-are-loaded-once/fixtures/_worker.js: -------------------------------------------------------------------------------- 1 | import crypto from 'node:crypto'; 2 | 3 | export default async ({negotiateProtocol}) => { 4 | const protocol = negotiateProtocol(['ava-4']).ready(); 5 | 6 | const random = crypto.randomBytes(16).toString('hex'); 7 | for await (const testWorker of protocol.testWorkers()) { 8 | testWorker.publish({random}); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /test/shared-workers/workers-are-loaded-once/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/shared-workers/workers-are-loaded-once/fixtures/test-1.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | import {random} from './_plugin.js'; 4 | 5 | test('the shared worker produces a random value', async t => { 6 | const {data} = await random; 7 | t.log(data); 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/shared-workers/workers-are-loaded-once/fixtures/test-2.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | import {random} from './_plugin.js'; 4 | 5 | test('the shared worker produces a random value', async t => { 6 | const {data} = await random; 7 | t.log(data); 8 | t.pass(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/shared-workers/workers-are-loaded-once/test.js: -------------------------------------------------------------------------------- 1 | import test from '@ava/test'; 2 | 3 | import {fixture} from '../../helpers/exec.js'; 4 | 5 | test('shared workers are loaded only once', async t => { 6 | const result = await fixture(); 7 | const logs = result.stats.passed.map(object => result.stats.getLogs(object)); 8 | t.is(logs.length, 2); 9 | t.deepEqual(logs[0], logs[1]); 10 | }); 11 | -------------------------------------------------------------------------------- /test/snapshot-order/fixtures/intertest-order/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/snapshot-order/fixtures/randomness/.gitignore: -------------------------------------------------------------------------------- 1 | test.js.snap 2 | -------------------------------------------------------------------------------- /test/snapshot-order/fixtures/randomness/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/snapshot-order/fixtures/report-declaration-order/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/snapshot-order/helpers/get-snapshot-ids.js: -------------------------------------------------------------------------------- 1 | export default function getSnapshotIds(report) { 2 | function * matchAll(string, regexp) { 3 | let match; 4 | while ((match = regexp.exec(string)) !== null) { 5 | yield match; 6 | } 7 | } 8 | 9 | const ids = [...matchAll(report, /'index: ([-.\d]+)'/g)].map(match => Number(match[1])); 10 | 11 | return ids; 12 | } 13 | -------------------------------------------------------------------------------- /test/snapshot-order/snapshots/randomness.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-order/snapshots/randomness.js.snap -------------------------------------------------------------------------------- /test/snapshot-regenerate-report/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/fixed-snapshot-dir/fixedSnapshotDir/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## some snapshots 8 | 9 | > Snapshot 1 10 | 11 | 'foo' 12 | 13 | > Snapshot 2 14 | 15 | 'bar' 16 | 17 | ## another snapshot 18 | 19 | > Snapshot 1 20 | 21 | 'baz' 22 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/fixed-snapshot-dir/fixedSnapshotDir/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/fixed-snapshot-dir/fixedSnapshotDir/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/fixed-snapshot-dir/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "ava": { 3 | "snapshotDir": "fixedSnapshotDir" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/no-snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/no-snapshots/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('without snapshots', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/only-test/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/only-test/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## some snapshots 8 | 9 | > Snapshot 1 10 | 11 | 'foo' 12 | 13 | > Snapshot 2 14 | 15 | 'bar' 16 | 17 | ## another snapshot 18 | 19 | > Snapshot 1 20 | 21 | 'baz' 22 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/only-test/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/only-test/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/removal/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/removal/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## some snapshots 8 | 9 | > Snapshot 1 10 | 11 | 'foo' 12 | 13 | > Snapshot 2 14 | 15 | 'bar' 16 | 17 | ## another snapshot 18 | 19 | > Snapshot 1 20 | 21 | 'baz' 22 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/removal/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/removal/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-snapshots-in-try/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-snapshots-in-try/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## skipped snapshots in try 8 | 9 | > Snapshot 1 10 | 11 | 'in try' 12 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-snapshots-in-try/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/skipped-snapshots-in-try/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## some snapshots 8 | 9 | > Snapshot 1 10 | 11 | 'foo' 12 | 13 | > Snapshot 2 14 | 15 | 'bar' 16 | 17 | ## another snapshot 18 | 19 | > Snapshot 1 20 | 21 | 'baz' 22 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/skipped-snapshots/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-tests/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-tests/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## some snapshots 8 | 9 | > Snapshot 1 10 | 11 | 'foo' 12 | 13 | > Snapshot 2 14 | 15 | 'bar' 16 | 17 | ## another snapshot 18 | 19 | > Snapshot 1 20 | 21 | 'baz' 22 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/skipped-tests/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/skipped-tests/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/snapshot-dir/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/snapshot-dir/test/snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test/test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## some snapshots 8 | 9 | > Snapshot 1 10 | 11 | 'foo' 12 | 13 | > Snapshot 2 14 | 15 | 'bar' 16 | 17 | ## another snapshot 18 | 19 | > Snapshot 1 20 | 21 | 'baz' 22 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/snapshot-dir/test/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/snapshot-dir/test/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/try/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/try/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## snapshots in try 8 | 9 | > Snapshot 1 10 | 11 | 'in try' 12 | -------------------------------------------------------------------------------- /test/snapshot-removal/fixtures/try/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/fixtures/try/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-removal/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-removal/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/corrupt/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/corrupt/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); 2 | 3 | test('a snapshot', t => { 4 | t.snapshot('foo'); 5 | }); 6 | 7 | test('a snapshot with a message', t => { 8 | t.snapshot('foo', 'a message'); 9 | }); 10 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/large/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/large/test.js: -------------------------------------------------------------------------------- 1 | const {Buffer} = require('node:buffer'); 2 | 3 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); 4 | 5 | for (let i = 0; i < 2; i++) { 6 | test(`large snapshot ${i}`, t => { 7 | t.snapshot(Buffer.alloc(1024 * 16)); 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/multiline-snapshot-label/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/multiline-snapshot-label/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); 2 | 3 | const f = () => [ 4 | 'Hello', 5 | 'World!', 6 | ].join(', '); 7 | 8 | test('snapshot with a multiline label', t => { 9 | const result = f(); 10 | const label = '```javascript\n' + f.toString() + '\n```'; 11 | t.snapshot(result, label); 12 | }); 13 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/normalized-title-in-snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/normalized-title-in-snapshots/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); 2 | 3 | test('test\r\n\ttitle', t => { 4 | t.snapshot('Hello, World!'); 5 | }); 6 | 7 | test('test\r\n\ttitle', Object.assign(t => { 8 | t.snapshot('Hello, World!'); 9 | }, { 10 | title: title => `macro\n${title}`, 11 | })); 12 | 13 | -------------------------------------------------------------------------------- /test/snapshot-tests/fixtures/normalized-title-in-stdout/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-tests/snapshots/corrupt.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-tests/snapshots/corrupt.js.snap -------------------------------------------------------------------------------- /test/snapshot-tests/snapshots/formatting.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-tests/snapshots/formatting.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-skipped-snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-skipped-snapshots/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot({foo: 'one'}); 5 | 6 | if (!process.env.TEMPLATE) { 7 | t.snapshot.skip({foo: 'two'}); 8 | t.snapshot({foo: 'three'}); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-skipped-snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-skipped-snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/adding-skipped-snapshots/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-snapshots/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot({foo: 'one'}); 5 | 6 | if (!process.env.TEMPLATE) { 7 | t.snapshot({foo: 'two'}); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/adding-snapshots/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-test/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-test/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot({foo: 'one'}); 5 | }); 6 | 7 | if (!process.env.TEMPLATE) { 8 | test('bar', t => { 9 | t.snapshot({bar: 'one'}); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-test/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/adding-test/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/adding-test/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-label/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-label/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot({foo: 'one'}, process.env.TEMPLATE ? undefined : 'a new message'); 5 | }); 6 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-label/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-label/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/changing-label/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-title/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-title/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test(`a ${process.env.TEMPLATE ? '' : 'new '}title`, t => { 4 | t.snapshot({foo: 'one'}); 5 | }); 6 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-title/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## a title 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/changing-title/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/changing-title/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/commit-skip/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/commit-skip/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## commit a skipped snapshot 8 | 9 | > Snapshot 1 10 | 11 | 1 12 | 13 | > Snapshot 2 14 | 15 | 'before' 16 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/commit-skip/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/commit-skip/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/discard-skip/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/discard-skip/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## discard a skipped snapshot 8 | 9 | > Snapshot 1 10 | 11 | 1 12 | 13 | > Snapshot 2 14 | 15 | 'before (second try)' 16 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/discard-skip/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/discard-skip/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/filling-in-blanks/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/filling-in-blanks/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | > Snapshot 2 16 | 17 | 18 | 19 | > Snapshot 3 20 | 21 | { 22 | foo: 'three', 23 | } 24 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/filling-in-blanks/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/filling-in-blanks/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/first-run/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/first-run/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot({foo: 'one'}); 5 | }); 6 | 7 | test('bar', t => { 8 | t.pass(); 9 | }); 10 | 11 | test('baz', t => { 12 | t.snapshot({baz: 'one'}, 'a message'); 13 | t.snapshot({baz: 'two'}); 14 | }); 15 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/invalid-snapfile/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-all-snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-all-snapshots/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | if (process.env.TEMPLATE) { 5 | t.snapshot({foo: 'one'}); 6 | } 7 | 8 | t.pass(); 9 | }); 10 | 11 | test('bar', t => { 12 | t.snapshot({bar: 'one'}); 13 | }); 14 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-all-snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | ## bar 16 | 17 | > Snapshot 1 18 | 19 | { 20 | bar: 'one', 21 | } 22 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-all-snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/removing-all-snapshots/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-snapshots/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-snapshots/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot({foo: 'one'}); 5 | 6 | if (process.env.TEMPLATE) { 7 | t.snapshot({foo: 'two'}); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-snapshots/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | > Snapshot 2 16 | 17 | { 18 | foo: 'two', 19 | } 20 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/removing-snapshots/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-test/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-test/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot({foo: 'one'}); 5 | }); 6 | 7 | if (process.env.TEMPLATE) { 8 | test('bar', t => { 9 | t.snapshot({bar: 'one'}); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-test/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | ## bar 16 | 17 | > Snapshot 1 18 | 19 | { 20 | bar: 'one', 21 | } 22 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/removing-test/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/removing-test/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/reorder/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/reorder/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## first test 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'bar', 13 | } 14 | 15 | ## second test 16 | 17 | > Snapshot 1 18 | 19 | { 20 | bar: 'baz', 21 | } 22 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/reorder/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/reorder/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/select-test-update/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/select-test-update/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | t.snapshot(process.env.TEMPLATE ? {foo: 'one'} : {foo: 'new'}); 5 | }); 6 | 7 | test('bar', t => { 8 | t.snapshot(process.env.TEMPLATE ? {bar: 'one'} : {bar: 'new'}); 9 | }); 10 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/select-test-update/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | ## bar 16 | 17 | > Snapshot 1 18 | 19 | { 20 | bar: 'one', 21 | } 22 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/select-test-update/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/select-test-update/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-snapshot-update/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-snapshot-update/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | > Snapshot 2 16 | 17 | { 18 | foo: 'two', 19 | } 20 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-snapshot-update/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/skipping-snapshot-update/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-snapshot/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-snapshot/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | test('foo', t => { 4 | (process.env.TEMPLATE ? t.snapshot : t.snapshot.skip)({foo: 'one'}); 5 | t.snapshot({foo: 'two'}); 6 | }); 7 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-snapshot/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | > Snapshot 2 16 | 17 | { 18 | foo: 'two', 19 | } 20 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-snapshot/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/skipping-snapshot/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-test-update/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-test-update/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | ## bar 16 | 17 | > Snapshot 1 18 | 19 | { 20 | bar: 'one', 21 | } 22 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-test-update/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/skipping-test-update/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-test/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-test/test.js: -------------------------------------------------------------------------------- 1 | const test = require(process.env.TEST_AVA_REQUIRE_FROM); // This fixture is copied to a temporary directory, so require AVA through its configured path. 2 | 3 | (process.env.TEMPLATE ? test : test.skip)('foo', t => { 4 | t.snapshot({foo: 'one'}); 5 | }); 6 | 7 | test('bar', t => { 8 | t.snapshot({bar: 'one'}); 9 | }); 10 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-test/test.js.md: -------------------------------------------------------------------------------- 1 | # Snapshot report for `test.js` 2 | 3 | The actual snapshot is saved in `test.js.snap`. 4 | 5 | Generated by [AVA](https://avajs.dev). 6 | 7 | ## foo 8 | 9 | > Snapshot 1 10 | 11 | { 12 | foo: 'one', 13 | } 14 | 15 | ## bar 16 | 17 | > Snapshot 1 18 | 19 | { 20 | bar: 'one', 21 | } 22 | -------------------------------------------------------------------------------- /test/snapshot-workflow/fixtures/skipping-test/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/fixtures/skipping-test/test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/adding.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/adding.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/changing-label.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/changing-label.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/invalid-snapfile.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/invalid-snapfile.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/removing-all-snapshots.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/removing-all-snapshots.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/removing-snapshots.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/removing-snapshots.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/removing-test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/removing-test.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/reorder.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/reorder.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/selection.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/selection.js.snap -------------------------------------------------------------------------------- /test/snapshot-workflow/snapshots/try-skip.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/snapshot-workflow/snapshots/try-skip.js.snap -------------------------------------------------------------------------------- /test/test-process-exit/fixtures/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | files: ['*.js'], 3 | }; 4 | -------------------------------------------------------------------------------- /test/test-process-exit/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/test-process-exit/fixtures/process-exit.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('good', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('process.exit', async t => { 8 | t.pass(); 9 | await new Promise(resolve => { 10 | setImmediate(resolve); 11 | }); 12 | process.exit(0); // eslint-disable-line unicorn/no-process-exit 13 | }); 14 | 15 | test('still good', t => { 16 | t.pass(); 17 | }); 18 | -------------------------------------------------------------------------------- /test/test-timeouts/fixtures/custom-message.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('timeout with custom message', async t => { 4 | t.timeout(10, 'time budget exceeded'); 5 | await new Promise(() => {}); 6 | }); 7 | -------------------------------------------------------------------------------- /test/test-timeouts/fixtures/invalid-message.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('timeout with invalid message', t => { 4 | t.timeout(10, 20); // eslint-disable-line ava/assertion-arguments 5 | }); 6 | 7 | -------------------------------------------------------------------------------- /test/test-timeouts/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "ava": { 4 | "files": [ 5 | "*.js" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/test-timeouts/snapshots/test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avajs/ava/a6f42ea472cfbe7047a0fb89ab0cd728b4e04ae1/test/test-timeouts/snapshots/test.js.snap -------------------------------------------------------------------------------- /test/watch-mode/fixtures/basic/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | watchMode: { 3 | ignoreChanges: ['ignored-by-watcher.js'], 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/basic/ignored-by-watcher.js: -------------------------------------------------------------------------------- 1 | import process from 'node:process'; 2 | 3 | process.exit(1); // eslint-disable-line unicorn/no-process-exit 4 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/basic/not-depended-on.js: -------------------------------------------------------------------------------- 1 | import process from 'node:process'; 2 | 3 | process.exit(1); // eslint-disable-line unicorn/no-process-exit 4 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/basic/source.js: -------------------------------------------------------------------------------- 1 | export default 'source'; 2 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/basic/source.test.js: -------------------------------------------------------------------------------- 1 | import source from './source.js'; 2 | 3 | const {default: test} = await import(process.env.TEST_AVA_IMPORT_FROM); // This fixture is copied to a temporary directory, so import AVA through its configured path. 4 | 5 | test('source', t => { 6 | t.is(source, 'source'); 7 | }); 8 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/basic/test.js: -------------------------------------------------------------------------------- 1 | const {default: test} = await import(process.env.TEST_AVA_IMPORT_FROM); // This fixture is copied to a temporary directory, so import AVA through its configured path. 2 | 3 | test('pass', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('snapshot', t => { 8 | t.snapshot('snapshot'); 9 | }); 10 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/exclusive/a.test.js: -------------------------------------------------------------------------------- 1 | const {default: test} = await import(process.env.TEST_AVA_IMPORT_FROM); // This fixture is copied to a temporary directory, so import AVA through its configured path. 2 | 3 | test('pass', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('fail', t => { 8 | t.fail(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/exclusive/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | watchMode: { 3 | ignoreChanges: ['ignored-by-watcher.js'], 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/exclusive/b.test.js: -------------------------------------------------------------------------------- 1 | const {default: test} = await import(process.env.TEST_AVA_IMPORT_FROM); // This fixture is copied to a temporary directory, so import AVA through its configured path. 2 | 3 | test.only('pass', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('fail', t => { 8 | t.fail(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/exclusive/c.test.js: -------------------------------------------------------------------------------- 1 | const {default: test} = await import(process.env.TEST_AVA_IMPORT_FROM); // This fixture is copied to a temporary directory, so import AVA through its configured path. 2 | 3 | test('pass', t => { 4 | t.pass(); 5 | }); 6 | 7 | test('fail', t => { 8 | t.fail(); 9 | }); 10 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/exclusive/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-inline/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-inline/ava.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | typescript: { 3 | rewritePaths: { 4 | 'src/': 'build/', 5 | }, 6 | compile: 'tsc', 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-inline/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-inline/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@sindresorhus/tsconfig", 3 | "compilerOptions": { 4 | "outDir": "build", 5 | }, 6 | "types": [ 7 | "node_modules/@types/node", 8 | "../../../../node_modules/@types/node", 9 | ], 10 | "include": [ 11 | "src" 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-precompiled/ava.config.js: -------------------------------------------------------------------------------- 1 | import process from 'node:process'; 2 | 3 | export default { 4 | typescript: { 5 | extensions: process.env.JUST_TS_EXTENSION ? ['ts'] : ['ts', 'js'], 6 | rewritePaths: { 7 | 'src/': 'build/', 8 | }, 9 | compile: false, 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-precompiled/build/test.js: -------------------------------------------------------------------------------- 1 | const {default: test} = await import(process.env.TEST_AVA_IMPORT_FROM); // This fixture is copied to a temporary directory, so import AVA through its configured path. 2 | 3 | test('pass', t => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-precompiled/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-precompiled/src/test.ts: -------------------------------------------------------------------------------- 1 | import process from 'node:process'; 2 | 3 | import type ava from 'ava'; 4 | 5 | // This fixture is copied to a temporary directory, so import AVA through its 6 | // configured path. 7 | const {default: test} = await (import(process.env['TEST_AVA_IMPORT_FROM'] ?? '') as Promise<{default: typeof ava}>); 8 | 9 | test('pass', t => { 10 | t.pass(); 11 | }); 12 | -------------------------------------------------------------------------------- /test/watch-mode/fixtures/typescript-precompiled/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@sindresorhus/tsconfig", 3 | "compilerOptions": { 4 | "outDir": "build", 5 | }, 6 | "types": [ 7 | "../../../../node_modules/@types/node", 8 | ], 9 | "include": [ 10 | "src" 11 | ], 12 | } 13 | -------------------------------------------------------------------------------- /test/worker-threads/fixtures/child-process.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | workerThreads: false, 3 | }; 4 | -------------------------------------------------------------------------------- /test/worker-threads/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /test/worker-threads/fixtures/test.js: -------------------------------------------------------------------------------- 1 | import {isMainThread} from 'node:worker_threads'; 2 | 3 | import test from 'ava'; 4 | 5 | test('in worker thread', t => { 6 | t.false(isMainThread); 7 | }); 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@sindresorhus/tsconfig", 3 | "compilerOptions": { 4 | // See . This does not 5 | // seem solved with 4.8.3. 6 | "forceConsistentCasingInFileNames": false, 7 | }, 8 | "include": [ 9 | "test", 10 | "test-tap", 11 | "test-types" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /types/subscribable.d.cts: -------------------------------------------------------------------------------- 1 | export type Subscribable = { 2 | subscribe(observer: { 3 | error(error: any): void; 4 | complete(): void; 5 | }): void; 6 | }; 7 | --------------------------------------------------------------------------------