diff --git a/README.md b/README.md index 9bce7c6f..f31db1aa 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,7 @@ To see the detailed documentation, please visit the [**Documentation**](https:// - [Avoiding conflicts in environments with multiple platforms installed](https://poku.io/docs/tutorials/cross-platform#recommendations). - [Properly running asynchronous tests on the same file](https://poku.io/docs/examples/promises). - [Migrating from version **1.x** to version **2.x**](https://github.com/wellwelwel/poku/issues/533). +- [Using **Poku** with **Deno** and approaches to **JSR**](https://github.com/wellwelwel/poku/discussions/565). --- diff --git a/package.json b/package.json index dff8d517..17f2659c 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,12 @@ "test": "npm run test:parallel && npm run test:sequential", "test:bun": "npm run test:bun:parallel && npm run test:bun:sequential", "test:deno": "npm run test:deno:parallel && npm run test:deno:sequential", - "test:sequential": "tsx src/bin/index.ts --include=test/unit,test/integration,test/e2e", - "test:parallel": "tsx src/bin/index.ts --parallel --include=test/unit,test/integration,test/e2e", - "test:bun:sequential": "bun src/bin/index.ts --platform=bun --include=test/unit,test/integration,test/e2e", - "test:bun:parallel": "bun src/bin/index.ts --platform=bun --parallel --include=test/unit,test/integration,test/e2e", - "test:deno:sequential": "tsx src/bin/index.ts --platform=deno --deno-allow=all --deno-cjs --include=ci/test/unit,ci/test/integration,ci/test/e2e", - "test:deno:parallel": "tsx src/bin/index.ts --platform=deno --deno-allow=all --deno-cjs --parallel --include=ci/test/unit,ci/test/integration,ci/test/e2e", + "test:sequential": "tsx src/bin/index.ts test/unit test/integration test/e2e", + "test:parallel": "tsx src/bin/index.ts -p test/unit test/integration test/e2e", + "test:bun:sequential": "bun src/bin/index.ts --bun test/unit test/integration test/e2e", + "test:bun:parallel": "bun src/bin/index.ts --bun -p test/unit test/integration test/e2e", + "test:deno:sequential": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs ci/test/unit ci/test/integration ci/test/e2e", + "test:deno:parallel": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs -p ci/test/unit ci/test/integration ci/test/e2e", "test:c8": "c8 tsx test/c8.test.ts", "test:ci": "tsx test/ci.test.ts", "test:ci:node": "FILTER='node-' npm run test:ci", diff --git a/src/bin/index.ts b/src/bin/index.ts index 653d0109..717b8d7e 100644 --- a/src/bin/index.ts +++ b/src/bin/index.ts @@ -16,17 +16,17 @@ import { Write } from '../services/write.js'; import { getConfigs } from '../parsers/options.js'; (async () => { - const configFile = getArg('config'); + const configFile = getArg('config') || getArg('c', '-'); const defaultConfigs = await getConfigs(configFile); const dirs: string[] = (() => { - const includeArg = getArg('include'); + const includeArg = getArg('include'); // deprecated if (includeArg !== undefined) { return includeArg.split(','); } return ( - getPaths() ?? + getPaths('-') ?? (defaultConfigs?.include ? Array.prototype.concat(defaultConfigs?.include) : ['.']) @@ -47,11 +47,12 @@ import { getConfigs } from '../parsers/options.js'; .filter((a) => a) || hasArg('deno-cjs') || defaultConfigs?.deno?.cjs; - const parallel = hasArg('parallel') || defaultConfigs?.parallel; - const quiet = hasArg('quiet') || defaultConfigs?.quiet; - const debug = hasArg('debug') || defaultConfigs?.debug; + const parallel = + hasArg('parallel') || hasArg('p', '-') || defaultConfigs?.parallel; + const quiet = hasArg('quiet') || hasArg('q', '-') || defaultConfigs?.quiet; + const debug = hasArg('debug') || hasArg('d', '-') || defaultConfigs?.debug; const failFast = hasArg('fail-fast') || defaultConfigs?.failFast; - const watchMode = hasArg('watch'); + const watchMode = hasArg('watch') || hasArg('w', '-'); const hasEnvFile = hasArg('env-file'); const concurrency = (() => { if (!(parallel || defaultConfigs?.parallel)) { @@ -101,9 +102,15 @@ import { getConfigs } from '../parsers/options.js'; const options: Configs = { platform: platformIsValid(platform) ? platform - : platformIsValid(defaultConfigs?.platform) - ? defaultConfigs?.platform - : undefined, + : hasArg('node') + ? 'node' + : hasArg('bun') + ? 'bun' + : hasArg('deno') + ? 'deno' + : platformIsValid(defaultConfigs?.platform) + ? defaultConfigs?.platform + : undefined, filter: typeof filter === 'string' ? new RegExp(escapeRegExp(filter)) : filter, exclude: diff --git a/website/docs/documentation/poku/config-files.mdx b/website/docs/documentation/poku/config-files.mdx index 1e3085c5..e535828f 100644 --- a/website/docs/documentation/poku/config-files.mdx +++ b/website/docs/documentation/poku/config-files.mdx @@ -11,14 +11,22 @@ By default, **Poku** comes with the most common usage pre-set, but you can confi + Support for -c short flag. + , + ], + }, { version: '2.1.0', changes: [ <> - support for config files (js and cjs) + Support for config files (js and cjs). , <> - support for config files (json and jsonc) + Support for config files (json and jsonc). , ], }, @@ -27,9 +35,21 @@ By default, **Poku** comes with the most common usage pre-set, but you can confi ## JavaScript - + +
+ Pos: Supports functions and regex. +
+
+ Cons: Needs to be an CommonJS file. +
+ + } +/> -Create a `poku.js` (or `poku.cjs` when using `"type": "module"` in your _package.json_) in your project's root directory, for example: +Create a `poku.config.js` (or `poku.config.cjs` when using `"type": "module"` in your _package.json_) in your project's root directory, for example: ```js const { defineConfig } = require('poku'); @@ -67,6 +87,21 @@ module.exports = defineConfig({ ## JSON and JSONC + +
+ Pos: Universal file for both CommonJS, ES Modules and + TypeScript. +
+
+ Cons: Doesn't support functions and regex. +
+ + } +/> + Create a `poku.json` (or `poku.jsonc`) in your project's root directory, for example: ```js @@ -145,3 +180,5 @@ npx poku --config='my-file.jsonc' ```sh npx poku --config='my-file' ``` + +- Short flag: `-c`. diff --git a/website/docs/documentation/poku/include-files.mdx b/website/docs/documentation/poku/include-files.mdx index 961212a1..f536d5fd 100644 --- a/website/docs/documentation/poku/include-files.mdx +++ b/website/docs/documentation/poku/include-files.mdx @@ -9,8 +9,6 @@ import { Stability } from '@site/src/components/Stability'; By default, **Poku** searches for _`.test.`_ and `.spec.` files, but you can customize it using the [`filter`](/docs/documentation/poku/options/filter) option. -## CLI - +## CLI + ### Common usage ```bash @@ -72,7 +72,7 @@ npx poku targetPathA targetPathB diff --git a/website/docs/documentation/poku/options/debug.mdx b/website/docs/documentation/poku/options/debug.mdx index 89b7cd43..e8774bd8 100644 --- a/website/docs/documentation/poku/options/debug.mdx +++ b/website/docs/documentation/poku/options/debug.mdx @@ -2,9 +2,24 @@ sidebar_position: 6 --- +import { History } from '@site/src/components/History'; + # `debug` -By default **Poku** doesn't shows logs that doesn't comes from **Poku**'s **`assert`**, but you can enable them: +By default **Poku** doesn't shows logs that doesn't comes from **Poku**'s **`assert`**, but you can enable them. + + + Support for -d short flag. + , + ], + }, + ]} +/> ## CLI @@ -12,6 +27,8 @@ By default **Poku** doesn't shows logs that doesn't comes from **Poku**'s **`ass npx poku --debug ./test ``` +- Short flag: `-d`. + ## API ```ts diff --git a/website/docs/documentation/poku/options/parallel.mdx b/website/docs/documentation/poku/options/parallel.mdx index a4722f59..65de8fec 100644 --- a/website/docs/documentation/poku/options/parallel.mdx +++ b/website/docs/documentation/poku/options/parallel.mdx @@ -2,10 +2,25 @@ sidebar_position: 1 --- +import { History } from '@site/src/components/History'; + # `parallel` Run the tests files in parallel. + + Support for -p short flag. + , + ], + }, + ]} +/> + ## CLI ```bash @@ -14,6 +29,8 @@ Run the tests files in parallel. npx poku --parallel ./test ``` +- Short flag: `-p`. + ## API ```ts diff --git a/website/docs/documentation/poku/options/platform.mdx b/website/docs/documentation/poku/options/platform.mdx index c4901ea7..3961a900 100644 --- a/website/docs/documentation/poku/options/platform.mdx +++ b/website/docs/documentation/poku/options/platform.mdx @@ -3,9 +3,25 @@ sidebar_position: 3 tags: [require, import, loader] --- +import { History } from '@site/src/components/History'; + # `platform` -By default, **Poku** tries to identify the platform automatically, but you can set it manually: +By default, **Poku** tries to identify the platform automatically, but you can set it manually. + + + Support for --node, --bun, and{' '} + --deno alternative flags. + , + ], + }, + ]} +/> ## CLI @@ -28,6 +44,9 @@ deno run npm:poku --platform=node ./test # ... ``` +- Alternative flags: `--node`, `--bun`, and `--deno`. + - It's only possible to use one per command. + ## API ```ts diff --git a/website/docs/documentation/poku/options/quiet.mdx b/website/docs/documentation/poku/options/quiet.mdx index a434ccc2..fe60c8f6 100644 --- a/website/docs/documentation/poku/options/quiet.mdx +++ b/website/docs/documentation/poku/options/quiet.mdx @@ -2,17 +2,34 @@ sidebar_position: 5 --- +import { History } from '@site/src/components/History'; + # `quiet` Perform tests with no logs.
This option overwrites all `log` settings by exiting with code and no logs (see bellow). + + Support for -q short flag. + , + ], + }, + ]} +/> + ## CLI ```bash npx poku --quiet ./test ``` +- Short flag: `-q`. + ## API ```ts diff --git a/website/docs/documentation/poku/options/watch.mdx b/website/docs/documentation/poku/options/watch.mdx index 62a6719e..fd24db36 100644 --- a/website/docs/documentation/poku/options/watch.mdx +++ b/website/docs/documentation/poku/options/watch.mdx @@ -2,10 +2,25 @@ sidebar_position: 9 --- +import { History } from '@site/src/components/History'; + # `watch` Watches the events on tests and files that contains tests (after running all the tests), re-running the tests files that are updated for each new event. + + Support for -w short flag. + , + ], + }, + ]} +/> + ## CLI ```bash @@ -20,6 +35,8 @@ You can use the flag `--watch-interval` to set a custom interval for `watch` eve npx poku --watch --watch-interval=1500 ``` +- Short flag: `-w`. +
:::tip diff --git a/website/docs/tutorials/cross-platform.mdx b/website/docs/tutorials/cross-platform.mdx index 6e42abdb..99761509 100644 --- a/website/docs/tutorials/cross-platform.mdx +++ b/website/docs/tutorials/cross-platform.mdx @@ -35,13 +35,13 @@ npx poku - It tries to identify the platform or run it in **Node.js** by default. ```sh -npx poku --platform=bun +npx poku --bun ``` - It calls **Poku** through **Node.js**, but runs all the tests using **Bun**. ```sh -npx poku --platform=deno +npx poku --deno ``` - It calls **Poku** through **Node.js**, but runs all the tests using **Deno**. @@ -62,19 +62,19 @@ It's important to note that the **Poku** runtime is different from the test runt To avoid conflicts in environments with multiple platforms installed (**Node.js** + **Bun**, **Deno** + **Bun**. etc.), see the following examples: ```sh -npx poku --platform=node +npx poku --node ``` - It runs **Poku** through **Node.js** and ensures that all tests are run with **Node.js** (or **tsx** for **TypeScript** tests). ```sh -bun poku --platform=bun +bun poku --bun ``` - It runs **Poku** through **Bun** and ensures that all tests are run with **Bun**. ```sh -deno run npm:poku --platform=deno +deno run npm:poku --deno ``` - It runs **Poku** through **Deno** and ensures that all tests are run with **Deno**. @@ -92,19 +92,19 @@ For **TypeScript** users, there's no need to install **tsx** for **Bun** and **D #### All files as CommonJS ```sh -deno run npm:poku --platform=deno --deno-cjs +deno run npm:poku --deno --deno-cjs ``` #### A specific extension as CommonJS ```sh -deno run npm:poku --platform=deno --deno-cjs='.cjs' +deno run npm:poku --deno --deno-cjs='.cjs' ``` #### Multiple extensions as CommonJS ```sh -deno run npm:poku --platform=deno --deno-cjs='.cjs,.js' +deno run npm:poku --deno --deno-cjs='.cjs,.js' ```
diff --git a/website/src/components/StarHunter.tsx b/website/src/components/StarHunter.tsx deleted file mode 100644 index a9bfac09..00000000 --- a/website/src/components/StarHunter.tsx +++ /dev/null @@ -1,8 +0,0 @@ -export const StarHunter: React.FC = () => { - return ( -
-

Enjoying Poku?

-

Consider giving him a star, he is a good Pet Runner 🩷

-
- ); -};