# @hon2a/cypress-without

> command for Cypress (https://www.cypress.io) for breaking out of a inside custom commands

Latest version **2.1.1** (published 2025-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hon2a/cypress-without
pnpm add @hon2a/cypress-without
yarn add @hon2a/cypress-without
bun add @hon2a/cypress-without
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2025-04-22 |
| First published | 2021-06-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Wiser Solutions, Inc. |
| Maintainers | hon2a |

## Links

- npm: https://www.npmjs.com/package/@hon2a/cypress-without
- Repository: https://github.com/hon2a/cypress-without
- Homepage: https://github.com/hon2a/cypress-without#readme
- Issues: https://github.com/hon2a/cypress-without/issues
- npm.io page: https://npm.io/package/@hon2a/cypress-without

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) 7.27.0

## Recent versions

- 2.1.1 (latest) — 2025-04-22
- 2.1.0 — 2023-07-21
- 2.0.0 — 2023-07-21
- 1.1.8 — 2021-12-13
- 1.1.7 — 2021-12-10
- 1.1.6 — 2021-06-29

## README

# cypress-without

`without` command for Cypress (https://www.cypress.io) for breaking out of a `within` inside custom commands

## Use

### `without`

Either import and use the command directly as a plain function:

```javascript
import { without } from '@hon2a/cypress-without'

cy.get('.some-container').within(() => {
  // ... find elements inside the container only
  without(() => {
    // ... find elements anywhere (e.g. drop-downs rendered through portals)
  })
  // ... find more elements just inside the container
})
```

Or register the command with Cypress and chain it off `cy`:

```javascript
import '@hon2a/cypress-without/lib/register' // best done just once in your support script

cy.get('.some-container').within(() => {
  // ... find elements inside the container only
  cy.without(() => {
    // ... find elements anywhere (e.g. drop-downs rendered through portals)
  })
  // ... find more elements just inside the container
})
```

Provide `{ log: false }` as the second argument to mute the log output.

### `absoluteRoot`

If you need to chain off the document root rather than perform a one-off action
on it, use `absoluteRoot` to get the root.

```javascript
import { absoluteRoot } from '@hon2a/cypress-without'

export const getActiveModal = () => absoluteRoot().find('.some-modal:visible')
```

This helper also gets registered as Cypress command when importing `…/register` (see above).

## Development

### Install

Install dependencies using:

```sh
npm install
```

### Develop

After you modify sources, run the following (or set up your IDE to do it for you):

- format the code using `npm run format`
- lint it using `npm run lint`
- test it using `npm test`

and fix the errors, if there are any.

### Publish

Publishing is done in two steps:

1. Create a new version tag and push it to the repository:
    ```sh
    npm version <patch|minor|major>
    git push --follow-tags
    ```
1. Build and publish the new version as a npm package:
    ```sh
    npm publish --access public
    ```

---
_Source: https://npm.io/package/@hon2a/cypress-without · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
