NativeScript: DisconnectedClient disconnected from CONNECTED state (transport error)

Environment Your ANDROID_HOME environment variable is set and points to correct directory. √ Your adb from the Android SDK is correctly installed. √ The Android SDK is installed. √ A compatible Android SDK for compilation is found. √ Javac is installed and is configured properly. √ The Java Development Kit (JDK) is installed and is configured properly. √ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure. √ Getting NativeScript components versions information… √ Component nativescript has 5.4.0 version and is up to date. ‼ Update available for component tns-core-modules. Your current version is 5.4.0 and the latest available version is 5.4.1. √ Component tns-android has 5.4.0 version and is up to date. ‼ Update available for component tns-ios. Your current version is 5.3.1 and the latest available version is 5.4.0.

Contents of my package.json

{ “nativescript”: { “id”: “org.nativescript.demoTest”, “tns-android”: { “version”: “5.4.0” }, “tns-ios”: { “version”: “5.4.0” } }, “main”: “app.js”, “description”: “NativeScript Application”, “license”: “SEE LICENSE IN <your-license-filename>”, “repository”: “<fill-your-repository-here>”, “dependencies”: { “nativescript-theme-core”: “~1.0.4”, “nativescript-unit-test-runner”: “^0.6.3”, “tns-core-modules”: “~5.4.0” }, “devDependencies”: { “@types/jasmine”: “3.3.12”, “karma”: “4.1.0”, “karma-jasmine”: “2.0.1”, “karma-nativescript-launcher”: “0.4.0”, “karma-webpack”: “3.0.5”, “nativescript-dev-typescript”: “~0.9.0”, “nativescript-dev-webpack”: “~0.22.0” }, “gitHead”: “c06800e52ee1a184ea2dffd12a6702aaa43be4e3”, “readme”: “NativeScript Application” }

Contents of karma.conf.js

module.exports = function (config) {
const options = {

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: ['app/tests/**/*.ts'],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [],

customLaunchers: {
  android: {
    base: 'NS',
    platform: 'android'
  },
  ios: {
    base: 'NS',
    platform: 'ios'
  },
  ios_simulator: {
    base: 'NS',
    platform: 'ios',
    arguments: ['--emulator']
  }
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
};

setWebpackPreprocessor(config, options);
setWebpack(config, options);

config.set(options);
}

function setWebpackPreprocessor(config, options) {
if (config && config.bundle) {
if (!options.preprocessors) {
  options.preprocessors = {};
}

options.files.forEach(file => {
  if (!options.preprocessors[file]) {
    options.preprocessors[file] = [];
  }
  options.preprocessors[file].push('webpack');
  });
}
}

function setWebpack(config, options) {
if (config && config.bundle) {
const env = {};
env[config.platform] = true;
env.sourceMap = config.debugBrk;
options.webpack = require('./webpack.config')(env);
delete options.webpack.entry;
delete options.webpack.output.libraryTarget;
}
}

Describe the bug Whenever I try to run test cases on my android emulators, I can see the results, but I receive a warning from test runner:

26 05 2019 16:30:13.077:WARN [NativeScript / 26 (8.0.0; Android SDK built for x86)]: Disconnected (0 times)Client disconNativeScript / 26 (8.0.0; Android SDK built for x86) ERROR

And I can`t see my results in the browser or the emulator, only inside the console.

Expected behavior I want to be able to what test failed and passed in the browser and if possible code coverage to see what branches were missed

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 19 (4 by maintainers)

Most upvoted comments

@tsonevn Ive tried your proposed solution to with the links on how to configure karma, and Ive managed to make karma to upload files, buuuut, now I get a different error:

Error during loading: Uncaught ReferenceError: global is not defined in 
http://localhost:9876/base/tests/example.test.bundle.js?cccf17fbd55109d054fc39d95e2fa703e126a45d 
line 1

I assume that {NS} already has global dependency, and I tried to install it from npm, but it didn`t remove the error. I followed this thread , but it is for Angular project, not {NS} Typescript or any {NS} project related