<commit_before>const fetchception = require('../');
const expect = require('unexpected')
    .clone()
    // We need to include unexpected-messy in the test suite because we assert
    // the output. It is NOT necessary when using fetchception normally.
    .use(require('unexpected-messy'));

// Set up the preferred output width for both the internal expect as well as the
// one we use in this test suite.
expect.output.preferredWidth = 80;
fetchception.expect.output.preferredWidth = 80;

let originalFetch;

describe('with no global fetch', () => {
    beforeEach(() => {
        originalFetch = global.fetch;
        delete global.fetch;
    });

    it('should complain if no fetch is available', () => {
        return expect(() => fetchception([], () => {}), 'to throw', 'fetchception: Did not find a global.fetch. Make sure that you load a fetch polyfill if you are running your tests in an environment with no native implementation.');
    });

    afterEach(() => {
        global.fetch = originalFetch;
    });
});<commit_msg>Fix test with missing fetch on node v6.<commit_after>const fetchception = require('../');
const expect = require('unexpected')
    .clone()
    // We need to include unexpected-messy in the test suite because we assert
    // the output. It is NOT necessary when using fetchception normally.
    .use(require('unexpected-messy'));

// Set up the preferred output width for both the internal expect as well as the
// one we use in this test suite.
expect.output.preferredWidth = 80;
fetchception.expect.output.preferredWidth = 80;

let originalFetch;

describe('with no global fetch', () => {
    beforeEach(() => {
        originalFetch = global.fetch;
        global.fetch = undefined;
    });

    it('should complain if no fetch is available', () => {
        return expect(() => fetchception([], () => {}), 'to throw', 'fetchception: Did not find a global.fetch. Make sure that you load a fetch polyfill if you are running your tests in an environment with no native implementation.');
    });

    afterEach(() => {
        global.fetch = originalFetch;
    });
});
{'fraction_non_alphanumeric': 0.12328117591275486, 'fraction_numerical': 0.004267425320056899, 'mean_word_length': 3.2712550607287447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4368768', 'n_tokens_mistral': 560, 'n_tokens_neox': 543, 'n_words': 225}