# @jscutlery/cypress-mount

> **⚠️ This package is now internal, please use [`@jscutlery/cypress-angular`](../../packages/cypress-angular) instead. **

Latest version **0.12.7** (published 2022-06-25) · 0 weekly downloads

## Install

```sh
npm install @jscutlery/cypress-mount
pnpm add @jscutlery/cypress-mount
yarn add @jscutlery/cypress-mount
bun add @jscutlery/cypress-mount
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.12.7 |
| Published | 2022-06-25 |
| First published | 2020-12-01 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 26.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 268 |
| Maintainers | yjaaidi, koalaa |

## Links

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

## Dependencies (2)

- [@cypress/mount-utils](https://npm.io/package/@cypress/mount-utils.md) ^2.0.0
- [ng-dynamic-component](https://npm.io/package/ng-dynamic-component.md) ^10.0.0

## Recent versions

- 0.12.7 (latest) — 2022-06-25
- 0.12.6 — 2022-06-24
- 0.12.4 — 2022-06-14
- 0.12.3 — 2022-04-07
- 0.12.1 — 2022-03-26
- 0.12.0 — 2021-12-21
- 0.11.6 — 2021-12-08
- 0.11.5 — 2021-12-04
- 0.11.4 — 2021-12-04
- 0.11.3 — 2021-10-28
- 0.11.2 — 2021-10-26
- 0.11.0 — 2021-09-26
- 0.10.1 — 2021-05-25
- 0.10.0 — 2021-05-17
- 0.9.1 — 2021-05-16
- … 13 more at https://npm.io/package/@jscutlery/cypress-mount/versions

## README

# Cypress Mount

**⚠️ This package is now internal, please use [`@jscutlery/cypress-angular`](../../packages/cypress-angular) instead.
**

This module brings Angular support to [Cypress Component Testing](https://docs.cypress.io/guides/component-testing/introduction.html#What-is-Cypress-Component-Testing).

It is aiming to make Cypress Component Testing with Angular easier than writing code without tests 😜.

## Cypress Component Testing

[Cypress Component Testing](https://docs.cypress.io/guides/component-testing/introduction.html#What-is-Cypress-Component-Testing) is the missing balance between component unit-testing and pure e2e testing.

It will help you enjoy both the benefits of unit-tests isolation and Cypress tooling & Developer eXperience.

## Setup

### 0. Use NX

Cypress Component Testing _(and everything else)_ is easier with [Nx](https://nx.dev/latest/angular/getting-started/why-nx).

If you are writing a new app, you can create a Nx workspace with the following command:

```shell
yarn create nx-workspace # or npm init nx-workspace
```

... otherwise, you can migrate to Nx using:

```shell
ng add @nrwl/workspace
```

### 1. Install

The following install guide targets Cypress >= 7, follow [this guide](./docs/experimental-install.md) for Cypress < 7.

```shell
yarn add -D @jscutlery/cypress-mount @jscutlery/cypress-angular-dev-server @cypress/webpack-dev-server html-webpack-plugin

# or

npm install -D @jscutlery/cypress-mount @jscutlery/cypress-angular-dev-server @cypress/webpack-dev-server html-webpack-plugin
```

### 2. Enable Cypress Component Testing

2.a. Enable Cypress Component Testing by updating `cypress.json`:

```json
{
  ...
  "component": {
    "testFiles": "**/*.spec.{js,ts,jsx,tsx}",
    "componentFolder": "./src/components"
  }
}
```

2.b. Update the `include` property in `tsconfig.json` file:

```json
{
  ...
  "include": ["src/components/**/*.ts", "src/support/**/*.ts"],
}
```

2.c. Import support commands by updating e2e folder's `*-e2e/src/support/index.ts` and adding:

```ts
import '@jscutlery/cypress-mount/support';
```

2.d. Setup Angular Dev Server in `*-e2e/src/plugins/index.ts`, in order to build angular components (e.g. handle templateUrl etc...):

```ts
import { startAngularDevServer } from '@jscutlery/cypress-angular-dev-server';

module.exports = (on, config) => {
  on('dev-server:start', (options) =>
    startAngularDevServer({ config, options })
  );
  return config;
};
```

## Usage

Cf. [`@jscutlery/cypress-angular`](../../packages/cypress-angular)

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