This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new 1ec8763 fix(regression): Cannot read version of undefined caused by
Java refactor
(https://github.com/apache/cordova-android/pull/1130#discussion_r563597125)
(#1185)
1ec8763 is described below
commit 1ec87634d447235f9c2003e12a4d921e6070b8aa
Author: Norman Breau <[email protected]>
AuthorDate: Tue Mar 30 10:40:34 2021 -0300
fix(regression): Cannot read version of undefined caused by Java refactor
(https://github.com/apache/cordova-android/pull/1130#discussion_r563597125)
(#1185)
---
bin/templates/cordova/lib/check_reqs.js | 4 ++++
spec/unit/check_reqs.spec.js | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/bin/templates/cordova/lib/check_reqs.js
b/bin/templates/cordova/lib/check_reqs.js
index 25c3f73..82827ac 100644
--- a/bin/templates/cordova/lib/check_reqs.js
+++ b/bin/templates/cordova/lib/check_reqs.js
@@ -135,6 +135,8 @@ module.exports.check_gradle = function () {
/**
* Checks for the java installation and correct version
+ *
+ * Despite the name, it should return the Java version value, it's used by the
Cordova CLI.
*/
module.exports.check_java = async function () {
const javaVersion = await java.getVersion();
@@ -145,6 +147,8 @@ module.exports.check_java = async function () {
'Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment
variables.'
);
}
+
+ return javaVersion;
};
// Returns a promise.
diff --git a/spec/unit/check_reqs.spec.js b/spec/unit/check_reqs.spec.js
index 2e30ccd..66b6326 100644
--- a/spec/unit/check_reqs.spec.js
+++ b/spec/unit/check_reqs.spec.js
@@ -56,6 +56,14 @@ describe('check_reqs', function () {
await
expectAsync(check_reqs.check_java()).toBeRejectedWithError(CordovaError,
/Requirements check failed for JDK 9999.9999.9999! Detected version: 1.8.0/);
});
+
+ it('should return the version', async () => {
+ check_reqs.__set__({
+ java: { getVersion: async () => ({ version: '1.8.0' }) }
+ });
+
+ await expectAsync(check_reqs.check_java()).toBeResolvedTo({
version: '1.8.0' });
+ });
});
describe('check_android', function () {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]