Skip to content

Commit 9fdf86b

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 9fdf86b

File tree

12 files changed

+81535
-62
lines changed

12 files changed

+81535
-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

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.

lib/common/test/resources/device-log-provider-integration-tests/android/app/bundle.js

+328
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/common/test/resources/device-log-provider-integration-tests/android/app/vendor.js

+38,223
Large diffs are not rendered by default.

lib/common/test/resources/device-log-provider-integration-tests/ios/app/bundle.js

+320
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)