I am trying to develop tests for my nativescript application.
The framework i chose was Mocha. It seems to be the better of all the three existing frameworks.
Running the first command that appears on Unit Testing NativeScript Docs:
https://docs.nativescript.org/tooling/testing
Running
tns test init
and selecting Mocha, gives the following error:
C:\Users\MoutaL\Desktop\NativeScript With TypeScript\FastCanteen>tns test init
? Select testing framework: mocha
C:\Users\MoutaL\Desktop\NativeScript With TypeScript\FastCanteen
+-- karma@1.7.0
`-- UNMET PEER DEPENDENCY zone.js@0.8.2
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @angular/core@4.0.3 requires a peer of zone.js@^0.8.4 but none was installed.
npm WARN nativescript-angular@3.1.3 requires a peer of zone.js@^0.8.4 but none was installed.
C:\Users\MoutaL\Desktop\NativeScript With TypeScript\FastCanteen
+-- karma-mocha@1.3.0
`-- UNMET PEER DEPENDENCY zone.js@0.8.2
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @angular/core@4.0.3 requires a peer of zone.js@^0.8.4 but none was installed.
npm WARN nativescript-angular@3.1.3 requires a peer of zone.js@^0.8.4 but none was installed.
C:\Users\MoutaL\Desktop\NativeScript With TypeScript\FastCanteen
+-- karma-nativescript-launcher@0.4.0
`-- UNMET PEER DEPENDENCY zone.js@0.8.2
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @angular/core@4.0.3 requires a peer of zone.js@^0.8.4 but none was installed.
npm WARN nativescript-angular@3.1.3 requires a peer of zone.js@^0.8.4 but none was installed.
npm ERR! registry error parsing json
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "karma-chai" "--save-dev"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! Unexpected token < in JSON at position 0
npm ERR! <html>
npm ERR! <head>
npm ERR! <title>Access Denied</title>
npm ERR! <meta name="author" content="BillYazji" version="082009">
npm ERR! <meta name="description" content="Error Template">
npm ERR! <style type="text/css">
npm ERR! html { font-size:100%; /* IE Hack */ margin:0; padding:0; height:100%; }
npm ERR! body { font-size:14px; background: #FFFFFF; font-family: Arial, Verdana, Tahoma, Helvetica; margin:0; padding:0; height:100%; }
npm ERR! a:link { color: blue; }
npm ERR! a:visited { color: blue; }
npm ERR! a:hover { color: blue; }
npm ERR! a:active { color: blue; }
npm ERR! #logo { position:absolute; left:30px; top:12px; height:75px; width:75px; z-index:1; }
npm ERR! #header { margin:0; padding:0; height:64px; background:#ed0726; clear:right; border-bottom: 1px solid black;}
npm ERR! #headtext { position:absolute; left:80px; top:14px; height:50px; font-family: Arial, Verdana, Tahoma, Helvetica; color: white; font-size: 32px; z-index:0; font-smooth: always; }
npm ERR! #debug { display:none; }
npm ERR! </style>
npm ERR! <script language="javascript" type="text/javascript">
npm ERR! function ToggleDebug(){
npm ERR!
npm ERR! if(document.getElementById("debug").style.display == ""){
npm ERR! document.getElementById("debug").style.display = "block";
npm ERR! }else{
npm ERR! document.getElementById("debug").style.display = "";
npm ERR! }
npm ERR! }
npm ERR! </script>
npm ERR!
npm ERR! </head>
npm ERR! <body><div> <a name="top"></a>
npm ERR! <div id="logo"><img src="http://vodafonelogo.vf-pt.internal.vodafone.com/Vodafone.png" alt=" ";></img></div>
npm ERR! <span id="headtext"><b>Vodafone</b></span>
npm ERR! <div id="header"></div>
npm ERR! </div>
npm ERR! <div align="right"><span style="background-color:#FFFFFF; padding-left: 2px; padding-right: 2px; padding-bottom: 2px; border:1px solid black;"><a href="javascript:ToggleDebug()">Debug Info</a></span></div>
npm ERR! <br><br>
npm ERR! <center>
npm ERR! <table>
npm ERR! <tr><td colspan="2" style="color: #C11B17; font-size:32px;"><center><b>Access Denied</b></center></td></tr>
npm ERR! <tr><td><b> </b></td><td> </td></tr>
npm ERR! <tr><td><b>Client IP:</b></td><td>10.15.249.33</td></tr>
npm ERR! <tr><td><b>Username:</b></td><td>moutal </td></tr>
npm ERR! <tr><td><b>URL:</b></td><td>registry.npmjs.org</td></tr>
npm ERR! <tr><td><b>Categories:</b> </td><td></td></tr>
npm ERR! <!--<tr><td><b>Exception:</b></td><td>Your credentials could not be authenticated: "General authentication failure due to bad user ID or authentication token.". You will not be permitted access until your credentials can be verified.</td></tr>-->
npm ERR! </table>
npm ERR! <br>
npm ERR! <div style="width:50%">Your credentials could not be authenticated: "General authentication failure due to bad user ID or authentication token.". You will not be permitted access until your credentials can be verified.<br><br>
npm ERR! </div>
npm ERR! <br>
npm ERR! <br>
npm ERR! <div id="debug"><i>--------- When emailing, select/copy everything below this line ---------</i>
npm ERR! <br><br><br>
npm ERR! <b><u>Detailed Information (debug):</u></b><br>
npm ERR!
npm ERR! <div style="width:60%; display:block;">
npm ERR! <div style="border: 1px dashed blue; padding-left: 20px; padding-right: 20px; padding-top: 10px; padding-bottom: 10px; display: table-cell;">
npm ERR! <table border="0">
npm ERR! <tr><td colspan="2"><u>Error Specifics</u></td></tr>
npm ERR! <tr><td>Date:</td><td>08/07/2017 @ 11:34:17</td></tr>
npm ERR! <tr><td>Proxy ID:</td><td>VFPT-PROXY02-AL</td></tr>
npm ERR! <tr><td>Conn Type:</td><td>Explicit</td></tr>
npm ERR! <tr><td>Error ID:</td><td>authentication_failed</td></tr>
npm ERR! <tr><td>Summary:</td><td>Access Denied</td></tr>
npm ERR! <tr><td>Details:</td><td>Your credentials could not be authenticated: "General authentication failure due to bad user ID or authentication token.". You will not be permitted access until your credentials can be verified.</td></tr>
npm ERR! <tr><td>Help:</td><td>This is typically caused by an incorrect username and/or password, but could also be caused by network problems.</td></tr>
npm ERR! <tr><td>Last Error:</td><td></td></tr>
npm ERR! <tr><td>Dest IP:</td><td>10.74.50.1</td></tr>
npm ERR! <tr><td>Method:</td><td>GET</td></tr>
npm ERR! <tr><td>URL Host:</td><td>registry.npmjs.org</td></tr>
npm ERR! <tr><td>URL Path:</td><td>/karma-chai</td></tr>
npm ERR! <tr><td>URL Port:</td><td>80</td></tr>
npm ERR! <tr><td>HTTP Code:</td><td>401</td></tr>
npm ERR! <tr><td>Reason:</td><td>Authentication failed either because credentials were not provided or they could not be validated</td></tr>
npm ERR! <tr><td>Category:</td><td></td></tr>
npm ERR! <tr><td>Redirect:</td><td></td></tr>
npm ERR! <tr><td colspan="2"><br><u>User Information</u></td></tr>
npm ERR! <tr><td>Source IP:</td><td>10.15.249.33</td></tr>
npm ERR! <tr><td>Username:</td><td>moutal</td></tr>
npm ERR! <!--<tr><td>User Host:</td><td>10.15.249.33</td></tr>-->
npm ERR! <tr><td>User Domain:</td><td>LOCAL</td></tr>
npm ERR! <tr><td>Login Count:</td><td>0</td></tr>
npm ERR! <tr><td colspan="2"><br><u>SSL Information (if applicable)</u></td></tr>
npm ERR! <tr><td>S-SSL Hostname:</td><td></td></tr>
npm ERR! <tr><td>S-SSL Cipher:</td><td>none</td></tr>
npm ERR! <tr><td>S-SSL Cipher Strength:</td><td> none</td></tr>
npm ERR! <tr><td>S-SSL Version:</td><td></td></tr>
npm ERR! <tr><td>S-Socket Error:</td><td></td></tr>
npm ERR! <tr><td>C-SSL Fail Reason:</td><td></td></tr>
npm ERR! <tr><td>C-SSL Cipher:</td><td>none</td></tr>
npm ERR! <tr><td>C-SSL Cipher Strength:</td><td>none</td></tr>
npm ERR! <tr><td colspan="2"><br><u>DNS Information</u></td></tr>
npm ERR! <tr><td>DNS Lookup Time:</td><td></td></tr>
npm ERR! </table>
npm ERR! </div>
npm ERR! </div>
npm ERR! <br><br>
npm ERR! <i>--------------------------- End select/copy ---------------------------</i>
npm ERR! <br><br><br>
npm ERR! </div>
npm ERR! </center>
npm ERR! </body>
npm ERR! </html>
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\MoutaL\Desktop\NativeScript With TypeScript\FastCanteen\npm-debug.log
Command npm.cmd install karma-chai --save-dev failed with exit code 1
# test init
βββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β Usage β Synopsis β
β General β $ tns test init [--framework <Framework>] β
βββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββ
Configures your project for unit testing with a selected framework. This operation installs the nativescript-unit-test-runner npm module and its dependencies and creates a tests folder in the app directory.
### Options
* --framework <Framework> - Sets the unit testing framework to install. The following frameworks are available: jasmine, mocha and qunit.
Any hints?