From 1ee83495b3b856d4846e5572cc85178d955c77b4 Mon Sep 17 00:00:00 2001 From: AenEnlil Date: Mon, 1 Jun 2026 15:04:41 +0300 Subject: [PATCH 1/2] Added --partial option(alias for TESTOMATIO_PREPEND_DIR + no-detached for -d option) --- bin/check.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/check.js b/bin/check.js index b16e809c..cdf4960b 100755 --- a/bin/check.js +++ b/bin/check.js @@ -99,6 +99,11 @@ async function mainAction(framework, files, opts) { .catch(err => console.log('Error in creating test document', err)); } if (apiKey) { + if (opts.partial && !opts.dir) { + console.log(' ⚠️ --partial requires -d option to specify directory'); + return; + } + const reporter = new Reporter(apiKey.trim(), framework, workDir); reporter.addTests(decorator.getTests()); const resp = reporter.send({ @@ -106,9 +111,10 @@ async function mainAction(framework, files, opts) { create: opts.create || false, noempty: !opts.empty, branch, - 'no-detach': process.env.TESTOMATIO_NO_DETACHED || !opts.detached, + 'no-detach': process.env.TESTOMATIO_NO_DETACHED || !opts.detached || opts.partial, structure: opts.keepStructure, force: opts.force || false, + ...(opts.partial && { dir: workDir }), }); // async call if (opts.sync) { @@ -200,6 +206,10 @@ program .option('--test-alias ', 'Specify custom alias for test/it etc (separated by commas if multiple)') .option('--exclude ', 'Glob pattern to exclude files from analysis') .option('--require-ids', 'Fail build if tests are missing Testomat.io IDs') + .option( + '--partial', + 'Upload tests from -d directory without marking other tests as detached (sets TESTOMATIO_PREPEND_DIR to -d value)', + ) .action(mainAction); // Pull command From afe831f59b3df348605da5670d7cb07391124d24 Mon Sep 17 00:00:00 2001 From: AenEnlil Date: Sun, 14 Jun 2026 16:20:03 +0300 Subject: [PATCH 2/2] added documentation for --partial option --- README.md | 12 ++++++++++++ cli.md | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 130cf961..5fc7c63b 100644 --- a/README.md +++ b/README.md @@ -632,6 +632,18 @@ TESTOMATIO=11111111 npx check-tests CodeceptJS "**/*{.,_}{test,spec}.js" --no-de This option could also be set via environment variable `TESTOMATIO_NO_DETACHED=1`. If you don't want to pass it each time, create .env file in the root dir of your project with this variable set. +## Partial Import + +If your project is large and you want to import (or re-sync) only a subset of tests from a specific directory, without affecting the rest of the tests already imported into Testomat.io, use the `--partial` option together with `-d`: + +``` +TESTOMATIO=1111111 npx check-tests CodeceptJS "**/*{.,_}{test,spec}.js" -d ./tests/api --partial +``` + +This is equivalent to combining `-d ./tests/api` with `TESTOMATIO_PREPEND_DIR=./tests/api`: only tests found inside `./tests/api` are scanned and imported into the matching folder in Testomat.io, while tests outside that directory are left untouched and are not marked as detached. + +`--partial` requires the `-d` option; without it the command will fail. + ## Synchronous Import By default `check-tests` doesn't wait for all tests to be processed. It sends request to Testomatio and exits. To wait for processing to finish use `--sync` option. diff --git a/cli.md b/cli.md index 6dbcd2f6..5d536e79 100644 --- a/cli.md +++ b/cli.md @@ -76,16 +76,17 @@ TESTOMATIO=your-api-key npx check-tests push -d ./tests --files "**/*.md" ### Testomat.io Integration -| Option | Description | Default | -| ----------------------------- | ------------------------------------------------------------- | ------- | -| `--sync` | Import tests to Testomat.io and wait for completion | false | -| `--no-detached` | Don't mark all unmatched tests as detached | false | -| `--update-ids` | Update test and suite with Testomat.io IDs | false | -| `--create` | Create tests and suites for missing IDs | false | -| `--keep-structure` | Prefer structure of source code over structure in Testomat.io | false | -| `--no-empty` | Remove empty suites after import | false | -| `--clean-ids` | Remove Testomat.io IDs from test and suite | false | -| `--purge, --unsafe-clean-ids` | Remove Testomat.io IDs without server verification | false | +| Option | Description | Default | +| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| `--sync` | Import tests to Testomat.io and wait for completion | false | +| `--no-detached` | Don't mark all unmatched tests as detached | false | +| `--update-ids` | Update test and suite with Testomat.io IDs | false | +| `--create` | Create tests and suites for missing IDs | false | +| `--keep-structure` | Prefer structure of source code over structure in Testomat.io | false | +| `--no-empty` | Remove empty suites after import | false | +| `--clean-ids` | Remove Testomat.io IDs from test and suite | false | +| `--purge, --unsafe-clean-ids` | Remove Testomat.io IDs without server verification | false | +| `--partial` | Import only tests from `-d` directory into the matching folder, without marking tests outside it as detached (requires `-d`; equivalent to `-d ` + `TESTOMATIO_PREPEND_DIR=`) | false | ### Test Analysis Options