Skip to content

Commit 3f55217

Browse files
fix: handle changes in runtimes logs
In 6.1.0 there are several changes in the way both runtimes print logs. In order to handle this and keep the logs as they were with previous versions, introduce a check for the runtime version. In case the version is 6.1.0 or later (including prerelease versions) CLI will just replace the file reference in the message. For older versions CLI will still change the format of the message. Add integration tests for the whole CLI logic for parsing the logs - the input of the tests is the real output from device and the tests verify CLI will print the expected messages to the output. In the resources of the test you can find .zip file containing the project used for running the tests. In case additional verifications are needed, unzip the content and add required tests.
1 parent 2fc81c5 commit 3f55217

File tree

13 files changed

+81536
-62
lines changed

13 files changed

+81536
-62
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
!bin/nativescript.js
66
!vendor/*.js
77
!resources/**
8+
!lib/common/test/resources/**/*
9+
lib/common/test/resources/.DS_Store
810
*.js.map
911
!.travis/**/*
1012
coverage
@@ -80,4 +82,4 @@ lib/common/xunit.xml
8082
lib/common/test-reports.xml
8183
!lib/common/test-scripts/**
8284
!lib/common/scripts/**
83-
config/test-deps-versions-generated.json
85+
config/test-deps-versions-generated.json

Gruntfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ module.exports = function (grunt) {
125125
"!lib/common/bin/*.js",
126126
"!lib/common/test-scripts/**/*",
127127
"!lib/common/scripts/**/*",
128+
"!lib/common/test/resources/**/*",
128129
"*.tgz"]
129130
},
130131
template: {

lib/common/.gitignore

-38
This file was deleted.

lib/common/mobile/android/logcat-helper.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ export class LogcatHelper implements Mobile.ILogcatHelper {
4949
}
5050
});
5151

52-
lineStream.on('data', (line: Buffer) => {
53-
const lineText = line.toString();
54-
this.$deviceLogProvider.logData(lineText, this.$devicePlatformsConstants.Android, deviceIdentifier);
52+
lineStream.on('data', (lineBuffer: Buffer) => {
53+
const lines = (lineBuffer.toString() || '').split("\n");
54+
for (const line of lines) {
55+
this.$deviceLogProvider.logData(line, this.$devicePlatformsConstants.Android, deviceIdentifier);
56+
}
5557
});
5658
}
5759
}
2.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)