|
6 | 6 | import unittest
|
7 | 7 |
|
8 | 8 | from core.base_class.BaseClass import BaseClass
|
| 9 | +from core.git.git import Git |
9 | 10 | from core.npm.npm import Npm
|
| 11 | +from core.osutils.command import run |
10 | 12 | from core.osutils.file import File
|
11 | 13 | from core.osutils.folder import Folder
|
12 | 14 | from core.osutils.os_type import OSType
|
|
21 | 23 | class PrepareAndroidTests(BaseClass):
|
22 | 24 | def setUp(self):
|
23 | 25 | BaseClass.setUp(self)
|
| 26 | + Folder.navigate_to(folder=TEST_RUN_HOME, relative_from_current_folder=False) |
24 | 27 |
|
25 | 28 | def test_101_prepare_android(self):
|
26 | 29 | Tns.create_app(self.app_name, update_modules=False)
|
@@ -129,6 +132,30 @@ def test_310_prepare_should_flatten_scoped_dependencies(self):
|
129 | 132 | ng_path = os.path.join(self.app_name, TnsAsserts.PLATFORM_ANDROID_NPM_MODULES_PATH, '@angular', 'core')
|
130 | 133 | assert File.exists(ng_path), "Scoped dependencies are flattened, please see #1783!"
|
131 | 134 |
|
| 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 | + |
132 | 159 | def test_400_prepare_missing_or_missing_platform(self):
|
133 | 160 | Tns.create_app(self.app_name, update_modules=False)
|
134 | 161 |
|
|
0 commit comments