# all files / cli/init/ index.js

100% Statements 26/26
100% Branches 4/4
100% Functions 7/7
100% Lines 7/7
1 branch Ignored

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29

    1
    3

    3

    1
    1
    1

     'use strict';

    // Config:
    import { config } from '../../config';

    // Utilities:
    import log from 'npmlog';

    // Dependencies:
    import createTestDirectoryStructure from './create-test-directory-structure';
    import createBaseTestFiles from './create-base-test-files';
    import installTractorDependenciesLocally from './install-tractor-dependencies-locally';
    import setUpSelenium from './set-up-selenium';

    export default function init () {
        log.info('Setting up tractor...');

        return createTestDirectoryStructure.run(config.testDirectory)
        .then(() => createBaseTestFiles.run(config.testDirectory))
        .then(() => installTractorDependenciesLocally.run())
        .then(() => setUpSelenium.run())
        .then(() => log.info('Set up complete!'))
        .catch((error) => {
            log.error('Something broke, sorry :(');
            log.error(error.message);
            throw error;
        });
    }