<commit_before>import request from 'request'

const jobDataProperties = ['name', 'tags', 'public', 'build', 'custom-data']

class SauceService {
    /**
     * gather information about runner
     */
    before (capabilities) {
        this.sessionId = global.browser.sessionId
        this.capabilities = capabilities
        this.sauceUser = global.browser.requestHandler.auth.user
        this.sauceKey = global.browser.requestHandler.auth.pass
        this.sauceAPIUri = `https://saucelabs.com/rest/v1/${this.sauceUser}/jobs/${this.sessionId}`
    }

    /**
     * update Sauce Labs job
     */
    after (failures) {
        if (!this.sauceUser || !this.sauceKey) {
            return
        }

        return new Promise((resolve, reject) => request.put(this.sauceAPIUri, {
            json: true,
            auth: {
                user: this.sauceUser,
                pass: this.sauceKey
            },
            body: this.getBody(failures)
        }, (e, res, body) => {
            if (e) {
                return reject(e)
            }
            global.browser.jobData = body
            resolve(body)
        }))
    }

    /**
     * massage data
     */
    getBody (failures) {
        let body = {}
        for (let prop of jobDataProperties) {
            if (!this.capabilities[prop]) {
                continue
            }

            body[prop] = this.capabilities[prop]
        }

        body.passed = failures === 0
        return body
    }
}

let service = new SauceService()
export default service<commit_msg>modify job title<commit_after>import request from 'request'

const jobDataProperties = ['name', 'tags', 'public', 'build', 'custom-data']

class SauceService {
    /**
     * gather information about runner
     */
    before (capabilities) {
        this.sessionId = global.browser.sessionId
        this.capabilities = capabilities
        this.sauceUser = global.browser.requestHandler.auth.user
        this.sauceKey = global.browser.requestHandler.auth.pass
        this.sauceAPIUri = `https://saucelabs.com/rest/v1/${this.sauceUser}/jobs/${this.sessionId}`
    }

    beforeSuite (suite) {
        this.suiteTitle = suite.title
    }

    /**
     * update Sauce Labs job
     */
    after (failures) {
        if (!this.sauceUser || !this.sauceKey) {
            return
        }

        return new Promise((resolve, reject) => request.put(this.sauceAPIUri, {
            json: true,
            auth: {
                user: this.sauceUser,
                pass: this.sauceKey
            },
            body: this.getBody(failures)
        }, (e, res, body) => {
            if (e) {
                return reject(e)
            }
            global.browser.jobData = body
            resolve(body)
        }))
    }

    /**
     * massage data
     */
    getBody (failures) {
        let body = {}

        /**
         * set default values
         */
        body.name = this.suiteTitle

        for (let prop of jobDataProperties) {
            if (!this.capabilities[prop]) {
                continue
            }

            body[prop] = this.capabilities[prop]
        }

        body.passed = failures === 0
        return body
    }
}

let service = new SauceService()
export default service
{'fraction_non_alphanumeric': 0.11649294911097487, 'fraction_numerical': 0.001226241569589209, 'mean_word_length': 1.6229903536977492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2901658', 'n_tokens_mistral': 962, 'n_tokens_neox': 930, 'n_words': 192}