# @codeceptjs/helper

> Base class for all CodeceptJS helpers

Latest version **2.0.4** (published 2024-03-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install @codeceptjs/helper
pnpm add @codeceptjs/helper
yarn add @codeceptjs/helper
bun add @codeceptjs/helper
```

## Health

**Score 25/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2024-03-07 |
| First published | 2020-09-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Michael Bodnarchuk @davert |
| Maintainers | egor_bodnar, davert |
| Keywords | codeceptjs |

## Links

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

## Dependencies (1)

- [typescript](https://npm.io/package/typescript.md) ^5.1.3

## Recent versions

- 2.0.4 (latest) — 2024-03-07
- 4.0.0-beta.2 (beta) — 2025-07-13
- 4.0.0-beta.1 — 2025-07-13
- 2.0.3 — 2024-02-15
- 2.0.2 — 2024-02-10
- 2.0.1 — 2022-04-28
- 1.0.2 — 2021-01-06
- 1.0.1 — 2020-09-22
- 1.0.0 — 2020-09-21

## README

# CodeceptJS Helper

Base class for all CodeceptJS helpers. This class has been moved into a separate package to allow other helpers to be extended from it, without requiring main codeceptjs package.

## Installation

    npm i @codeceptjs/helper --save

## Usage

[Create CodeceptJS helper as described in documentation](https://codecept.io/helpers/).

```js
const Helper = require('@codeceptjs/helper');

class MyHelper extends Helper {
  // implement custom helper here
}
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [Helper](#helper)
    -   [Parameters](#parameters)
    -   [\_validateConfig](#_validateconfig)
        -   [Parameters](#parameters-1)
    -   [\_setConfig](#_setconfig)
        -   [Parameters](#parameters-2)
    -   [\_init](#_init)
    -   [\_before](#_before)
        -   [Parameters](#parameters-3)
    -   [\_after](#_after)
    -   [\_test](#_test)
        -   [Parameters](#parameters-4)
    -   [\_passed](#_passed)
        -   [Parameters](#parameters-5)
    -   [\_failed](#_failed)
        -   [Parameters](#parameters-6)
    -   [\_beforeStep](#_beforestep)
        -   [Parameters](#parameters-7)
    -   [\_afterStep](#_afterstep)
        -   [Parameters](#parameters-8)
    -   [\_beforeSuite](#_beforesuite)
        -   [Parameters](#parameters-9)
    -   [\_afterSuite](#_aftersuite)
        -   [Parameters](#parameters-10)
    -   [\_finishTest](#_finishtest)
        -   [Parameters](#parameters-11)
    -   [\_useTo](#_useto)
        -   [Parameters](#parameters-12)
    -   [helpers](#helpers)
    -   [debug](#debug)
        -   [Parameters](#parameters-13)
    -   [debugSection](#debugsection)
        -   [Parameters](#parameters-14)
    -   [\_config](#_config)

### Helper

Abstract class.
Helpers abstracts test execution backends.

Methods of Helper class will be available in tests in `I` object.
They provide user-friendly abstracted actions over NodeJS libraries.

Hooks (methods starting with `_`) can be used to setup/teardown,
or handle execution flow.

Methods are expected to return a value in order to be wrapped in promise.

#### Parameters

-   `config` **any** 

#### \_validateConfig

Abstract method to validate config

##### Parameters

-   `config` **any** 

Returns **any** 

#### \_setConfig

Sets config for current test

##### Parameters

-   `opts` **any** 

#### \_init

Hook executed before all tests

#### \_before

Hook executed before each test.

##### Parameters

-   `test` **Mocha.Test** 

#### \_after

Hook executed after each test

#### \_test

Hook provides a test details
Executed in the very beginning of a test

##### Parameters

-   `test` **Mocha.Test** 

#### \_passed

Hook executed after each passed test

##### Parameters

-   `test` **Mocha.Test** 

#### \_failed

Hook executed after each failed test

##### Parameters

-   `test` **Mocha.Test** 

#### \_beforeStep

Hook executed before each step

##### Parameters

-   `step` **CodeceptJS.Step** 

#### \_afterStep

Hook executed after each step

##### Parameters

-   `step` **CodeceptJS.Step** 

#### \_beforeSuite

Hook executed before each suite

##### Parameters

-   `suite` **Mocha.Suite** 

#### \_afterSuite

Hook executed after each suite

##### Parameters

-   `suite` **Mocha.Suite** 

#### \_finishTest

Hook executed after all tests are executed

##### Parameters

-   `suite` **Mocha.Suite** 

#### \_useTo

Abstract method to provide common interface to accessing helpers internals inside a test.

##### Parameters

-   `description`  
-   `fn`  

#### helpers

Access another configured helper: `this.helpers['AnotherHelper']`

Type: any

#### debug

Print debug message to console (outputs only in debug mode)

##### Parameters

-   `msg` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

#### debugSection

##### Parameters

-   `section` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `msg` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

#### \_config

Abstract method to provide required config options

Returns **any**

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