 childProcess = require 'child_process'
 fs = require 'fs'
 pathUtils = require 'path'
+
+log = Neft.log.scope('testing').scope 'ios'
 
 SIMULATOR_PATH = """
     /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator

    cmd = "xcrun simctl io #{deviceId} screenshot #{path}"
    childProcess.execSync cmd, stdio: 'pipe'

exports.run = (env, logsReader, callback) ->
    logsReader.log "Finding requested device id"
    device = getDeviceId env
    env.deviceId = device.id
    logsReader.log "Use device id #{env.deviceId}"

    if device.status is 'Booted'
        logsReader.log "Requested simulator is already booted"
    else
        logsReader.log "Running simulator"
        runSimulator env

    logsReader.log "Building project"
    buildProject env

    logsReader.log "Installing project"
    installProject env

    logsReader.log "Running tests"
    clearLogs env
    launchProject env
    scanProgress env, logsReader, callback
    return

            onLog msg
        return

    tail.stderr.on 'data', (data) ->
        log.error String data

    tail.on 'exit', -> onExit()

    kill: ->
