karma disregards browser and reporter settings - gruntjs

I am running karma with grunt and I am using the advice from the karma-runner page how to configure it to watch on changed files:
Config your watch task to run the karma task with the :run flag. For example:
...
In your terminal window run $ grunt karma:unit:start watch,
tests are run and everything is fine except for the fact that karma starts reporting in the console in teamcity format (and I have it nowhere in the settings or dependencies) and insists on using PhantomJs regardless what settings I put in the browser array.
What could be causing that behavior?

It turned out the problem is missing explicit port value in the karma conf

Related

Error when running Corda flow tests from IntelliJ

When I run Corda flow tests from IntelliJ, the tests fail with the following errors:
QUASAR WARNING: Quasar Java Agent isn't running. If you're using
another instrumentation method you can ignore this message; otherwise,
please refer to the Getting Started section in the Quasar
documentation.
and
java.lang.IllegalStateException: Missing the '-javaagent' JVM
argument. Make sure you run the tests with the Quasar java agent
attached to your JVM. See https://docs.corda.net/troubleshooting.html
- 'Fiber classes not instrumented' for more details.
How can I fix this?
Corda flows need to be instrumented using Quasar before they are run, so that they can be suspended mid-execution.
To achieve this in IntelliJ, you need to:
Create a run config for your tests
Open the run config and change the VM options to -ea -javaagent:PATH-TO-QUASAR-JAR
In the CorDapp example and templates, quasar.jar is located at lib/quasar.jar, so you'd use -ea -javaagent:../lib/quasar.jar
Alternatively, you can edit the default JUnit run config to use the Quasar javaagent by default, avoiding you having to do this every time you pick a new test to run.
This is a basic error that you get if you don't set Quasar, you need to select your test-> go to Intellij top bar-> Run -> Edit Configurations and then set up like this photo in VM options:
From template readme
We recommend editing your IntelliJ preferences so that you use the Gradle runner - this means that the quasar utils plugin will make sure that some flags (like -javaagent - see below) are set for you.
To switch to using the Gradle runner:
Navigate to Build, Execution, Deployment -> Build Tools -> Gradle ->
Runner (or search for runner) Windows: this is in "Settings" MacOS:
this is in "Preferences" Set "Delegate IDE build/run actions to
gradle" to true Set "Run test using:" to "Gradle Test Runner" If you
would prefer to use the built in IntelliJ JUnit test runner, you can
run gradlew installQuasar which will copy your quasar JAR file to the
lib directory. You will then need to specify -javaagent:lib/quasar.jar
and set the run directory to the project root directory for each test.
Btw, if you face same error in VSCode, you can add
"java.test.config": {
"vmArgs": ["-ea", "-javaagent:../lib/quasar.jar"]
},
to settings.json. The path ../lib/quasar.jar may be different in your project.

Grunt : htmlmin freezes -> which html file has errors

I use grunt to package my webapp.
Grunt freezes at htmlmin stage. I guess it's because one of my html files is malformed. But how can I know which html file is the cause of the freeze?
Thanks.
Grunt has several options which can be utlized via the CLI.
--debug and --verbose may help to reveal the problem file.
They are used as follows when running grunt:
$ grunt --verbose --debug
...or when running a specific task. E.g.
$ grunt foobar --verbose --debug
(In the last example foobar would be replaced with the name of the task!)
Tip: Add a .html validation tool to your IDE to catch errors earlier in your workflow, or use an online validation tool. For example. validator.w3.org

Running 'grunt' command on mean.js app just stalling

I am following the installation guidelines as described on mean.js.org Everything seemed to install fine. I have all prereqs installed. I ran npm install after cloning the github repo and then tried to run grunt and I didnt get any errors however It seems to just be stalling on the command line. Last message on the command line is the "debugger is running on port 5858" and then it just sits there.
After some time the message [nodemon] watching 51,839 files - this might cause high cpu usage. To reduce use "--watch" comes up. I am on windows 10 and have all the latest versions of node,npm,grunt and mean.js. I am running the command line as admin.
Mean.js should be running on localhost:3000 but it is not.
This is intended.
There is an application invoked by the grunt command and running in background, watching your files for changes. In default configuration: nodemon and grunt-watch.
This will execute specific tasks based on the files you edited, such as linting JS files or compiling LESS files.
The cmd will probably show something when you edit files in the projects directory.

'grunt serve' starts fine but never loads

I just created a new application using JHipster on Windows. I can run it just fine using "mvn spring-boot:run". However, I would like to get auto-reloading of pages and so would like to use "grunt serve". When I run it, it starts fine. But when I go to "http://localhost:3000/" in Chrome it just sits there waiting for the server to connect. I can go to http://localhost:3001/ just fine and see BrowserSync but there are not any servers listed under the "Current Connections" section.
Here is the out put I see after running "grunt serve":
C:\mydev\pmi>grunt serve
Running "clean:server" (clean) task
>> 0 paths cleaned.
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "ngconstant:dev" (ngconstant) task
Creating module pmiApp at src/main/webapp/scripts/app/app.constants.js...OK
Running "concurrent:server" (concurrent) task
Running "browserSync:dev" (browserSync) task
[BS] [info] Proxying: http://localhost:8080
[BS] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://10.255.247.72:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://10.255.247.72:3001
--------------------------------------
[BS] Watching files...
Running "watch" task
Waiting...
I just never see anything in the browser (neither Chrome nor Firefox connect).
I saw another post suggesting that I delete my node-modules directory and reinstall use "npm install". I did that and got the same result.
I've been looking at it for an hour and a half tonight. Last night, something finally triggered and it started working. But I'm getting the same problem tonight. I don't know what finally got it working last night. I had been having the same problem for an hour last night.
I'm stumped.
You're not the only one :). I was having trouble with this as well.
Just to clarify. You need to run both
'mvn spring-boot:run'
and
'grunt serve'
D'oh
I was under the mistaken assumption that 'grunt serve' did the same thing (only better) as "mvn spring-boot:run". Not so.
"mvn spring-boot:run" runs the backend web server and handles the REST endpoints.
'grunt serve' handles the front end angularJS side of things.
Looking back at the documentation it is now obvious.
What a Noob.
If you are using gradle you can run this:
./gradlew bootRun
In my case the message bellow informs that you can access the spring application:
> Building 85% > :bootRun
After that you can run this:
grunt serve
The message "Running "watch" task Waiting..." will appear in the console, but
the browser will open automatically and show the address bellow:
http://localhost:3000/#/

How to properly exit grunt watch under yeoman

I am running grunt serve and when it exits and I try to run it again the port is taken and it won`t run. How do I exit so that the port is not taken?
I am trying out yeoman and I am not familiar to the tools it uses.
I'm using Ctrl+C to stop the grunt livereload server, that has newer given me that problem that it would not release the port.

Resources