Skip to content

Commit 6d3e263

Browse files
committed
chore: replace imports
1 parent ea8e143 commit 6d3e263

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Diff for: tests/cli/run/tests/test_run_scope_package_only.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from core.enums.platform_type import Platform
1212
from core.settings import Settings
1313
from core.utils.device.simctl import Simctl
14-
from core.utils.file_utils import Folder
14+
from core.utils.file_utils import Folder, File
1515
from core.utils.npm import Npm
1616
from data.templates import Template
1717
from products.nativescript.run_type import RunType
@@ -24,11 +24,9 @@
2424
class TestRunWithScopedPackages(TnsRunTest):
2525
test_data = [
2626
[Template.HELLO_WORLD_JS.name.replace('template-', ''), Template.HELLO_WORLD_JS],
27-
# Skip TS projects because on TS projects we need to update all requires in the app in order to make it work.
28-
# [Template.HELLO_WORLD_TS.name.replace('template-', ''), Template.HELLO_WORLD_TS],
27+
[Template.HELLO_WORLD_TS.name.replace('template-', ''), Template.HELLO_WORLD_TS],
2928
[Template.HELLO_WORLD_NG.name.replace('template-', ''), Template.HELLO_WORLD_NG],
30-
# Skip MasterDetailNG, it fails, need to be investigated.
31-
# [Template.MASTER_DETAIL_NG.name.replace('template-', ''), Template.MASTER_DETAIL_NG],
29+
[Template.MASTER_DETAIL_NG.name.replace('template-', ''), Template.MASTER_DETAIL_NG],
3230
]
3331

3432
@parameterized.expand(test_data)
@@ -40,6 +38,17 @@ def test_scoped_package_only(self, app_name, template_info):
4038
Tns.create(app_name=app_name, template=template_info.local_package, update=True)
4139
Npm.uninstall(package='tns-core-modules', option='--save', folder=app_path)
4240
Npm.install(package=Settings.Packages.NATIVESCRIPT_CORE, option='--save --save-exact', folder=app_path)
41+
42+
# Replace imports
43+
if template_info == Template.HELLO_WORLD_TS:
44+
files = File.find_by_extension(folder=os.path.join(app_path, 'app'), extension='ts')
45+
for file in files:
46+
File.replace(path=file, old_string='tns-core-modules', new_string='@nativescript/core', fail_safe=True)
47+
if template_info == Template.MASTER_DETAIL_NG:
48+
files = File.find_by_extension(folder=os.path.join(app_path, 'src'), extension='ts')
49+
for file in files:
50+
File.replace(path=file, old_string='tns-core-modules', new_string='@nativescript/core', fail_safe=True)
51+
4352
Tns.platform_add_android(app_name=app_name, framework_path=Settings.Android.FRAMEWORK_PATH)
4453
if Settings.HOST_OS is OSType.OSX:
4554
Tns.platform_add_ios(app_name=app_name, framework_path=Settings.IOS.FRAMEWORK_PATH)

0 commit comments

Comments
 (0)