Yeoman grunt fails on mocha test [closed] - yeoman

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I'm taking my first spin with Yeoman, but running into problems when I get to the "grunt test" and "grunt" calls in terminal.
It seems to fail on mocha in both cases.
Running "jshint:all" (jshint) task
4 files lint free.
Running "clean:server" (clean) task
Cleaning ".tmp"...OK
Running "coffee:dist" (coffee) task
File .tmp/scripts/hello.js created.
Running "coffee:test" (coffee) task
Running "compass:dist" (compass) task
directory .tmp/styles/
create .tmp/styles/main.css
Running "compass:server" (compass) task
unchanged app/styles/main.scss
Running "connect:test" (connect) task
Starting connect web server on localhost:9000.
Running "mocha:all" (mocha) task
Testing index.htmlFatal error: spawn ENOENT
I cant seem to find any references to this error in Grunt or Mocha.
Where should I be checking to resolve this?

Related

How to guard against missing dependencies in production electron app?

I am using electron-builder to package an application and I'm looking for a way to guard against the following mistake:
My electron app has a main process dependency required in production, but I mistakenly listed it in devDependencies. I don't notice this during development because the module is installed in my development environment.
After building the production version and launching it, an alert dialog will pop-up with an Error: cannot find module stacktrace.
I'm looking for an automated way to catch/prevent this mistake.
What I tried so far:
After building with electron-builder, I have an automated test that launches the production app as a node child_process.spawn and then connects to it using puppeteer. And I have a process.on('uncaughtException') listener in the main process.
Since this error is raised from the require stack, it appears to not get handled by this listener. Also, the error creates an alert dialog box that blocks execution of the spawned process until the box is closed (something I don't know how to do in a CI environment) which means the test hangs and times-out without providing useful feedback.
I'm using electron-builder to package the main process dependencies and vite to bundle the renderer dependencies.

Why Jest tests are SOMETIMES failing on CircleCI?

I have Jest tests that are running against the dockerized Neo4j Database, and sometimes they fail on CircleCI. The error message for all 25+ of them is :
thrown: "Exceeded timeout of 5000 ms for a hook.
#*******api: Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
Since they fail sometimes, like once in 25 runs, I am wondering if jest.setTimeout will solve the issue. I was able to fail them locally by setting jest.setTimeout(10), but I am not sure how to debug this even more, or whether something else could be an issue here aside from a small timeout (default 5000). I would understand if 1/25 or a few fails, or if all other suits fail, but only a single file with all tests within that file is failing. And it is always the same file, never some other file for this reason ever.
Additional information, locally, that single file runs in less than a 1000ms connected to the staging database which is huge compared to the dockerized that has only a few files at the time of running
For anyone who sees this, I was able to solve this by adding the --maxWorkers=2 flag to the test command in my CircleCI config. See here for details: https://support.circleci.com/hc/en-us/articles/360005442714-Your-test-tools-are-smart-and-that-s-a-problem-Learn-about-when-optimization-goes-wrong-
Naman's answer is perfect! I couldn't believe it but it really solved my problem. Just to be extra clear on how to do it:
I change the test script from my package.json from jest to jest --maxWorkers=2. Then I pushed and it did solve my error.

How to improve PHPUnit tests run? By freezing code somehow, for example

I am working with a code with a lot of tests (i suppose). There are about 6000 tests. Cost of running that tests is 1m 30sec. You may think that it is nothing, but during tests execution you can do nothing with Your code, because PHPUnit doesn't seem to freeze tested and test's code (which is understandable) and if You change anything during tests execution some tests may fail. I have whole project on docker container with shared folders set by -v parameter.
I have imagined sth like that:
1) In PHPStorm runs tests;
2) Stops sharing folder between docker and host during test execution to preserve code state at the moment when tests started;
3) Complete tests execution, show any errors if present, bring back folder sharing.
Is it possible ?

Electron build timing out on CircleCI

I am trying to get CircleCI to work with my electron app but I can't understand how to stop the timeout error.
You can look at the app here: https://github.com/sauravyash/OutFlux
It fails on the npm test stage of the build with:
> outflux#1.0.0 test /home/ubuntu/OutFlux
> electron .
Xlib: extension "RANDR" missing on display ":99".
Xlib: extension "RANDR" missing on display ":99".
command ((npm :test)) took more than 10 minutes since last output
I'm new to the whole idea of CI so bear with me if the answer is obvious.
In case anyone sees this, you must understand that running electron by itself isnt testing anything, which is the point of CI. You should use something like Spectron to test if your app is successful in headless testing (testing without a real display).
https://github.com/electron/spectron

running script after specified time in windows 7

I have a ruby script open.rb
require 'launchy'
Launchy.open("http://stackoverflow.com")
Now what i want is that in a day i run script first time than it should run after every 10 minute.
so is there any way to do this and here i am using windows 7.
After google on this i got a way to do it Ruby on Rails with worker as a background job but that is not my solution so is there any possible way to do it or is there any gem to do this task.
and also how can i clear chache before running this.
The solution is to use Windows Scheduler.
To set the task run every 10 minutes, follow the solution in this Stack Overflow question: windows scheduler to run a task every x-minutes?
UPDATE: here is a way to run associate Ruby script to ruby.exe : https://stackoverflow.com/a/1422398/188331 ( you can make a batch script )

Resources