<commit_before>/*
 * Copyright 2016 Palantir Technologies, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import * as cp from "child_process";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import { createTempFile, denormalizeWinPath } from "../utils";

// when tests are run with mocha from npm scripts CWD points to project root
const EXECUTABLE_DIR = path.resolve(process.cwd(), "test", "executable");
const EXECUTABLE_PATH = path.resolve(EXECUTABLE_DIR, "npm-like-executable");
const TEMP_JSON_PATH = path.resolve(EXECUTABLE_DIR, "tslint.json");

/* tslint:disable:only-arrow-functions */
describe("Executable", function(this: Mocha.ISuiteCallbackContext) {
    this.slow(3000);    // the executable is JIT-ed each time it runs; avoid showing slowness warnings
    this.timeout(4000);

    describe("Files", () => {
        it("exits with code 1 if no arguments passed", (done) => {
            execCli([], (err, stdout, stderr) => {
                assert.isNotNull(err, "process should exit with error");
                assert.strictEqual(err.code, 1, "error code should be 1");

                assert.include(stderr, "Missing files", "stderr should contain notification about missing files");
                assert.strictEqual(stdout, "", "shouldn't contain any output in stdout");
                done();
            });
        });<commit_msg>Ignore lint error `no-invalid-this`<commit_after>/*
 * Copyright 2016 Palantir Technologies, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import * as cp from "child_process";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import { createTempFile, denormalizeWinPath } from "../utils";

// when tests are run with mocha from npm scripts CWD points to project root
const EXECUTABLE_DIR = path.resolve(process.cwd(), "test", "executable");
const EXECUTABLE_PATH = path.resolve(EXECUTABLE_DIR, "npm-like-executable");
const TEMP_JSON_PATH = path.resolve(EXECUTABLE_DIR, "tslint.json");

/* tslint:disable:only-arrow-functions */
describe("Executable", function(this: Mocha.ISuiteCallbackContext) {
    // tslint:disable:no-invalid-this
    this.slow(3000);    // the executable is JIT-ed each time it runs; avoid showing slowness warnings
    this.timeout(4000);
    // tslint:enable:no-invalid-this

    describe("Files", () => {
        it("exits with code 1 if no arguments passed", (done) => {
            execCli([], (err, stdout, stderr) => {
                assert.isNotNull(err, "process should exit with error");
                assert.strictEqual(err.code, 1, "error code should be 1");

                assert.include(stderr, "Missing files", "stderr should contain notification about missing files");
                assert.strictEqual(stdout, "", "shouldn't contain any output in stdout");
                done();
            });
        });
{'fraction_non_alphanumeric': 0.11125287063026282, 'fraction_numerical': 0.009696351109977035, 'mean_word_length': 3.3652561247216037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4607005', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1056, 'n_words': 403}