Running Mocha Test - indentation error - mongodb

I am running some mocha tests for a mean.js app and I get a large number of indentation errors and then a "Mocha exploded!" error.
I fixed it this morning but messed with it more and undid my fix by accident. I cannot remember exactly how I fixed it but I was messing with npm install and making sure the mongoDB database was correct. I checked that my mocha version is up to date which it is.
Any suggestions with what to turn to next that could be the issue would be greatly appreciated.
I attached the terminal errors below.
Image 1: executing grunt test --force
Image 2: indentation errors
Image 3: "Mocha exploded!" error

The issue was an extra curly bracket in one of the test files that mocha was running through. This solved the mocha exploded issue as well as all of the indentation issues.

Check the poststest script and remove it if necessary.
A script like the below will launch Eslint(a tool that analyses Javascript code) after all tests run:
"script": {
"lint": "eslint .",
"posttest": "npm run lint"
}

Related

Code runner runs javascript in terminal but does't work in otput

Hi when I try to run javascript with code runner i get only:
"[Running] node "/home/lukasz/JavaScript/app.js"
[Done] exited with code=0 in 0.11 seconds"
without any actual output.
When I switch to run in terminal everything works fine. Any ideas how to fix it?
[Run in terminal][Run in output]
I compared settings of execution map with other on osx which is working perfectly and can't see any difference.

npm isn't working in powershell giving error but works fine in hyper terminal

I was a react native project but it throws error everytime. I tried to add pakages to my node project earlier it throws the same error always. I've tried to update it. but It's hopeless.
PS C:\Users\sarth\Desktop\app> npm i -g react-app
C:\Users\sarth\AppData\Roaming\npm\node_modules\npm\lib\utils\replace-info.js:13
result += cleanUrl(str.slice(index, match.index)) + match[0]
^
TypeError: cleanUrl is not a function
at splitAndReplace (C:\Users\sarth\AppData\Roaming\npm\node_modules\npm\lib\utils\replace-info.js:13:15)
at replaceInfo (C:\Users\sarth\AppData\Roaming\npm\node_modules\npm\lib\utils\replace-info.js:23:12)
at process.exitHandler (C:\Users\sarth\AppData\Roaming\npm\node_modules\npm\lib\utils\exit-handler.js:168:26)
at process.emit (node:events:520:28)
at process._fatalException (node:internal/process/execution:164:25)
This error always persist when I'm using terminal like powershell and command prompt. But it work fine on a downloaded terminal called Hyper which is truly doesn't make any sense.
Any help will be appreciated. Thanks in advance
Try delete folder npm in path "C:\Users****\AppData\Roaming\npm"
I had the same problem after updating npm version

VSCode - Starting debugging for an extension gives process terminated error

I followed the VSCode extension development guide to create a new extension project.
Starting debugging for the extension gave -
The terminal process "/bin/zsh '-c', 'npm run watch'" terminated with exit code: 1.
Another question seems related, but I do have Inherit Env checked under Terminal>Integrated in settings as mentioned in the answer.
Also I am on mac os.
For me, the solution was to add
"watch": {
"files": "**/*.ts"
},
in the package.json file, at the same level as "scripts", based on the npm-watch documentation.

Ionic CLI: [ERROR] Gulpfile (or dependent module) not found: .\gulpfile.js

Senario
I recently upon running an Ionic 3 app, updated (well accidentally) the Ionic CLI version. Now upon running the build from command line, it produces the following error every time and halts the build:
In the error message it says to disable the gulp integration by running the command ionic config set gulp.enabled false which I did. But still getting the same error. I also tried to add the command to the start script of package.json to no avail (not needed though since it seems the config is set globally).
Any help would be appreciated.
Ionic CLI version: 3.9.2
Finally figured out what the problem was. Even if Gulp integration has been disabled with the command ionic config set gulp.enabled false, as long as Gulp is a Dev dependency (i.e. there is a reference to it in the package.json under devDependencies) the Ionic CLI would (well, logically) assume that the Ionic project has a dependency on Gulp, therefore would throw the error (see original post).
Solution
The solution for a case where you don't want Gulp integration, apart from disabling it by running the command ionic config set gulp.enabled false, is to also make sure Gulp is NOT under the devDependencies in the package.json file.
Hope this helps anyone else with a similar issue.
NOTE: Not sure from which version onwards Ionic requires integration with Cordova and Gulp in the shape of ionic.config.json file. Anyway, the above solution will be relevant for a similar case in any of those versions.

Continuous Integration: Codeship + Gulp (Jasmine)

My Continuous Integration works pretty great using Codeship except one thing: stop deploying and alert us when unit tests are failing.
Here is our current commands:
npm install
npm install bower
bower install
gulp test
gulp build
The problem is whether gulp test end with success or fail, the gulp build builds.
I succeed to console.log() my gulp test exit status but I have no idea about how to make Codeship listen to this exit status.
The build on Codeship will fail as soon as any command exits with an exit code other than zero.
Please make sure this is the case with running gulp test.
(You can also reach out to us via support#codeship.com if any other questions come up!)
Using #mlocker answer and this discussion on Github, I've found a workaround that works fine for me:
gulp.task('test', function (done) {
karma.start({}, function(exitStatus){
done(exitStatus ? "There are failing unit tests" : undefined);
});
});
The trick here is that if the exitStatus is different from 0, you'll get a formatError on "There are failing unit tests" which will exit gulp test with 1 making Codeship to stop and consider the build as failed.
maybe you can try chaining the test and build tasks?
gulp test && gulp build