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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 0 additions & 38 deletions
This file was deleted.

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

Lines changed: 5 additions & 3 deletions
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

Lines changed: 328 additions & 0 deletions
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

Lines changed: 38223 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 320 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)