Skip to content

feat: added test with snapshot, webpack and sourcemap #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions products/nativescript/tns.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ def prepare_ios(app_name, release=False, for_device=False, log_trace=False, veri

@staticmethod
def build(app_name, platform, release=False, provision=Settings.IOS.PROVISIONING, for_device=False, bundle=True,
aot=False, uglify=False, snapshot=False, log_trace=False, verify=True, app_data=None):
aot=False, uglify=False, source_map=False, snapshot=False, log_trace=False, verify=True, app_data=None):
result = Tns.exec_command(command='build', path=app_name, platform=platform, release=release,
provision=provision, for_device=for_device, bundle=bundle, aot=aot, uglify=uglify,
snapshot=snapshot, wait=True, log_trace=log_trace)
source_map=source_map, snapshot=snapshot, wait=True, log_trace=log_trace)
if verify:
# Verify output
assert result.exit_code == 0, 'Build failed with non zero exit code.'
Expand All @@ -344,10 +344,11 @@ def build(app_name, platform, release=False, provision=Settings.IOS.PROVISIONING
return result

@staticmethod
def build_android(app_name, release=False, bundle=True, aot=False, uglify=False, snapshot=False, log_trace=False,
verify=True, app_data=None):
def build_android(app_name, release=False, bundle=True, aot=False, source_map=False, uglify=False, snapshot=False,
log_trace=False, verify=True, app_data=None):
return Tns.build(app_name=app_name, platform=Platform.ANDROID, release=release, bundle=bundle, aot=aot,
uglify=uglify, snapshot=snapshot, log_trace=log_trace, verify=verify, app_data=app_data)
source_map=source_map, uglify=uglify, snapshot=snapshot, log_trace=log_trace, verify=verify,
app_data=app_data)

@staticmethod
def build_ios(app_name, release=False, provision=Settings.IOS.PROVISIONING, for_device=False,
Expand Down
8 changes: 7 additions & 1 deletion tests/cli/build/build_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_001_build_android(self):
assert result.output.count("Gradle build...") == 1, "More than 1 gradle build is triggered."

def test_002_build_android_release(self):
Tns.build_android(self.app_name, release=True)
Tns.build_android(self.app_name, release=True, source_map=True, uglify=True, aot=True)

# Configs are respected
assert File.exists(TnsPaths.get_apk_path(self.app_name, release=True))
Expand All @@ -103,6 +103,12 @@ def test_002_build_android_release(self):
run(cmd=command, cwd=Settings.TEST_RUN_HOME, wait=True)
assert File.exists(os.path.join(self.app_path, 'app', 'app.tar.gz'))

def test_100_build_snapshot_uglify_release_aot_sourceMap(self):
#https://github.com/NativeScript/nativescript-dev-webpack/issues/920
result = Tns.build_android(self.app_name, release=True, aot=True, uglify=True, snapshot=True, source_map=True)
assert not "ERROR in NativeScriptSnapshot. Snapshot generation failed!" in result.output
assert not "Target architecture: arm64-v8a" in result.output

def test_301_build_project_with_space_release(self):

# Ensure ANDROID_KEYSTORE_PATH contain spaces (verification for CLI issue 2650)
Expand Down