import vo from 'vo';
import got from 'got';
import nightmare from 'nightmare';

function* checkIsLive(url) {
    yield got(url, { timeout: 1000, retries: 1 });
}

function* checkHasError(url) {
    const night = nightmare({ show: false });
    let isJSError = false;

    night.on('page-error', () => {
        isJSError = true;
    });

    yield night.goto(url).end();

    return isJSError;
}

export default vo([checkIsLive, checkHasError]);

import vo from 'vo';
import got from 'got';
import nightmare from 'nightmare';

function* checkIsLive(url) {
    yield got(url, { timeout: 1000, retries: 1 });
}

function* checkHasError(url) {
    const night = nightmare({ show: false });
    let isJSError = false;
    let isLoaded = false;
    let isLoadError = false;

    night.on('did-finish-load', () => {
        isLoaded = true;
    });

    night.on('did-fail-load', () => {
        isLoadError = true;
    });

    night.on('page-error', () => {
        isJSError = true;
    });

    yield night.goto(url).wait(1000).end();

    return !isLoaded || isLoadError || isJSError;
}

export default vo([checkIsLive, checkHasError]);

Check that the page has loaded when reporting on errors, and wait 1000ms
Check that the page has loaded when reporting on errors, and wait 1000ms
