Skip to content

Commit 2986ae6

Browse files
committed
1 parent ee91242 commit 2986ae6

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

tests/build/android/prepare_android_tests.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import unittest
77

88
from core.base_class.BaseClass import BaseClass
9+
from core.git.git import Git
910
from core.npm.npm import Npm
11+
from core.osutils.command import run
1012
from core.osutils.file import File
1113
from core.osutils.folder import Folder
1214
from core.osutils.os_type import OSType
@@ -21,6 +23,7 @@
2123
class PrepareAndroidTests(BaseClass):
2224
def setUp(self):
2325
BaseClass.setUp(self)
26+
Folder.navigate_to(folder=TEST_RUN_HOME, relative_from_current_folder=False)
2427

2528
def test_101_prepare_android(self):
2629
Tns.create_app(self.app_name, update_modules=False)
@@ -129,6 +132,30 @@ def test_310_prepare_should_flatten_scoped_dependencies(self):
129132
ng_path = os.path.join(self.app_name, TnsAsserts.PLATFORM_ANDROID_NPM_MODULES_PATH, '@angular', 'core')
130133
assert File.exists(ng_path), "Scoped dependencies are flattened, please see #1783!"
131134

135+
@unittest.skipIf(CURRENT_OS == OSType.WINDOWS, "Skip on Windows")
136+
def test_320_prepare_scoped_plugins(self):
137+
"""
138+
Test for https://github.com/NativeScript/nativescript-cli/pull/3080
139+
140+
Before this change we copied all NG components at following location (js demo of nativescript-facebook):
141+
platforms/android/src/main/assets/app/tns_modules/nativescript-facebook/node_modules/@angular
142+
143+
Now folder above should be empty (or not existing at all).
144+
"""
145+
146+
Folder.cleanup("nativescript-facebook")
147+
Git.clone_repo(repo_url='git@github.com:NativeScript/nativescript-facebook.git',
148+
local_folder="nativescript-facebook")
149+
Folder.navigate_to(folder="nativescript-facebook/src")
150+
output = run(command="npm run build")
151+
Folder.navigate_to(folder=TEST_RUN_HOME, relative_from_current_folder=False)
152+
assert "tsc" in output
153+
assert "ERR" not in output
154+
Tns.prepare_android(attributes={"--path": "nativescript-facebook/demo"})
155+
output = run(command="find nativescript-facebook/demo/platforms/android/ | grep @")
156+
assert "@angular/core" not in output, "@angular/* should not be in platforms folder."
157+
assert "@angular/router" not in output, "@angular/* should not be in platforms folder."
158+
132159
def test_400_prepare_missing_or_missing_platform(self):
133160
Tns.create_app(self.app_name, update_modules=False)
134161

tests/emulator/run_android_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def test_390_tns_run_android_should_warn_if_package_ids_do_not_match(self):
519519
output = Tns.run_android(attributes={'--path': self.app_name, '--justlaunch': ''})
520520
assert "The Application identifier is different from the one inside 'package.json' file." in output
521521
assert "NativeScript CLI might not work properly." in output
522-
assert "BUILD SUCCESSFUL" in output
522+
assert "Project successfully built" in output
523523

524524
@unittest.skipIf(CURRENT_OS == OSType.LINUX, "`shell cp -r` fails for some reason on emulators on Linux.")
525525
def test_400_tns_run_android_respect_adb_errors(self):

0 commit comments

Comments
 (0)