Skip to content

Commit 172ac70

Browse files
vchimevvchimev
vchimev
authored and
vchimev
committed
Verify source map in app
NativeScript/nativescript-cli#485
1 parent 25faee1 commit 172ac70

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/transpilers/typescript.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
class TypeScript(unittest.TestCase):
13+
1314
@classmethod
1415
def setUpClass(cls):
1516
Folder.cleanup('TNS_App')
@@ -65,6 +66,14 @@ def test_101_transpilation_typescript_prepare_debug(self):
6566
assert File.extension_exists("TNS_App/app", ".map")
6667
assert File.extension_exists("TNS_App/app", ".ts")
6768

69+
# Verify source map in app
70+
output = run("cat ./TNS_App/app/app.js")
71+
assert "//# sourceMappingURL=app.js.map" in output
72+
73+
output = run("cat ./TNS_App/app/app.js.map")
74+
assert "\"file\":\"app.js\"" in output
75+
assert "\"sources\":[\"app.ts\"]" in output
76+
6877
assert File.extension_exists(
6978
"TNS_App/platforms/android/src/main/assets/app", ".js")
7079
assert File.extension_exists(
@@ -76,6 +85,14 @@ def test_101_transpilation_typescript_prepare_debug(self):
7685
assert not File.extension_exists(
7786
"TNS_App/platforms/android/src/main/assets/app/tns_modules/application", ".ts")
7887

88+
# Verify source map in native android app
89+
output = run("cat ./TNS_App/platforms/android/src/main/assets/app/app.js")
90+
assert "//# sourceMappingURL=app.js.map" in output
91+
92+
output = run("cat ./TNS_App/platforms/android/src/main/assets/app/app.js.map")
93+
assert "\"file\":\"app.js\"" in output
94+
assert "\"sources\":[\"app.ts\"]" in output
95+
7996
if CURRENT_OS == OSType.OSX:
8097

8198
# prepare in debug => .ts should go to the platforms folder
@@ -99,6 +116,14 @@ def test_101_transpilation_typescript_prepare_debug(self):
99116
assert not File.extension_exists(
100117
"TNS_App/platforms/android/src/main/assets/app/tns_modules/application", ".ts")
101118

119+
# Verify source map in native iOS app
120+
output = run("cat ./TNS_App/platforms/ios/TNSApp/app/app.js")
121+
assert "//# sourceMappingURL=app.js.map" in output
122+
123+
output = run("cat ./TNS_App/platforms/ios/TNSApp/app/app.js.map")
124+
assert "\"file\":\"app.js\"" in output
125+
assert "\"sources\":[\"app.ts\"]" in output
126+
102127
def test_201_transpilation_typescript_prepare_release(self):
103128
# prepare in release => .ts should NOT go to the platforms folder
104129
output = Tns.prepare(path="TNS_App", platform="android", release=True)

0 commit comments

Comments
 (0)