PHPackages                             25th/behat-js-errorlog - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. 25th/behat-js-errorlog

ActiveLibrary[Testing &amp; Quality](/categories/testing)

25th/behat-js-errorlog
======================

217.5k↓11.1%[1 issues](https://github.com/25th-floor/behat-js-errorlog/issues)PHP

Since Apr 10Pushed 11y ago9 watchersCompare

[ Source](https://github.com/25th-floor/behat-js-errorlog)[ Packagist](https://packagist.org/packages/25th/behat-js-errorlog)[ RSS](/packages/25th-behat-js-errorlog/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

behat-js-errorlog
=================

[](#behat-js-errorlog)

JS Error Logger Context for Behat 3.

The Context extends from Mink and was tested with the selenium2 driver. Basically it looks after every Step if there is an error present.

To get this working you need to add a js snippet into the html code of your project.

Selenium
--------

[](#selenium)

The Context was tested soley with the selenium2 driver. There can be Situations that the check for js errors after a step can break the testcase. There was no reason why the setup behaves that way.

The only workaround was to introduce a ignore tag called `ignore-js-error`. Scenarios with that tag will not be checked in any way.

Installation
------------

[](#installation)

Just install via composer

Configuration
-------------

[](#configuration)

### behat

[](#behat)

Add the context to your behat confguration file. There are no Constructor Parameters

### your application

[](#your-application)

You need to adjust your application to work with the context.

```

    window.jsErrors = [];

    window.onerror = function (errorMessage) {
        window.jsErrors[window.jsErrors.length] = errorMessage;
    };

```

Depending if you are using a javascript framework you might to adjust to that as well

#### Angular

[](#angular)

If you are using angular you might want to add your own exception handler to catch js errors.

```
"use strict";

!function (angular) {

    var Module = angular.module('myModule');

    Module.provider("$exceptionHandler",
        {
            $get: ['errorLogService', function (errorLogService) {
                return (errorLogService);
            }]
        }
    );

    //
    // Factory to provider error log service
    // - simple console logger
    //
    Module.factory(
        "errorLogService",
        ['$log', function ($log) {

            function log(exception, cause) {
                // Default behavior, log to browser console
                $log.error.apply($log, arguments);

                // for selenium
                exception.message += ' (caused by "' + cause + '")';
                if ($window.jsErrors !== undefined) {
                    $window.jsErrors[$window.jsErrors.length] = exception.message;
                }
            }

            // Return the logging function.
            return (log);
        }]
    );

}(angular);
```

### Scenarios

[](#scenarios)

You don't need to adjust anything in your Scenarios to get this working. But there is way if you don't want the Context to run at a specific Scenario or a whole Feature File. You can use the tag `@ignore-js-logging` if you don't want any step to check for js errors.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f819de39a6e7566165242b47d06b2c866572c80e4789d4d29bb6fd0b75b9824?d=identicon)[dready](/maintainers/dready)

![](https://www.gravatar.com/avatar/b712966d74076870f9952c31aff1dbb540bf5cd554458857325320d7a02dfd89?d=identicon)[adepretis](/maintainers/adepretis)

### Embed Badge

![Health badge](/badges/25th-behat-js-errorlog/health.svg)

```
[![Health](https://phpackages.com/badges/25th-behat-js-errorlog/health.svg)](https://phpackages.com/packages/25th-behat-js-errorlog)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
