Jest - Getting Started lesson not completely - tdd

I'm using w/ VScode on a mac. I followed the instructions for the first test on https://jestjs.io/docs/en/getting-started.
I'm getting a jest prompt - and it's just hanging. The test is not completing.
Jest is installed and my package.json is set up. What's is going on? I'd love to start doing TDD.

Related

How to fix npm Error "timed out" after npm update

We have a React app, based on the Hydrogen theme for Shopify (which uses vite). It was all working ok until I had to add a package and update. It then started giving the following message: Error timed out. That is it, no other error message, I looked in the logs and there was nothing remarkable in there.
I tried removing the package, and all references to it in the code. But it looks like the issue may well have been the update command. But being rather new to React and npm on Windows, I have no idea how to fix it. Things that I did try were clearing the cache using:
npm cache clean --force
Doing another update. Removing the lock file.
Does anyone have a suggestion as to a method to debug that one-line error code, or could point me in the right direction? I am running on localhost, via Windows 10.
npm error timed out image
My problem must have been a broken dependency. After a day or so of trying updates, it eventually just started working again. The update that actually worked had some vulnerabilities, so I ran an:
npm audit fix
After the npm audit fix, the code started running correctly again.

Cypress doesn't create directory on install

I did have Cypress working at one point with 4.12.1, then upgraded to 5.0 and updated a couple of npm packages identified by npm-check-update. Now it refuses to start at all, it just hangs with Starting:Cypress displayed.
I tried my best to uninstall and remove all trace of cypress, even deleting the cache directory before installing the new version (either 4.12.1 or 5.0).
But every time I install it, even in a new project directory, it no longer creates the cypress directory. I think if I can find out why that isn't happening it will somehow be related to the original problem.
When I try to start with 'npx run cypress', I get the following:
Starting: cypress
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'D:\inSight_HEAD\Web\Frontend\Apps\Test\cypress'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I even went so far as to revert my (Windows 10) machine back to a system save point from yesterday when it was working, having to reinstall my web browsers afterward, but it didn't help.
Thanks for any ideas on how to proceed. I've only been using cypress for a couple of days, had written a few successful tests, but now it's come to a screeching halt and I've spent an entire day just trying to get it to run at all.
Thanks Alapan, that was it. Somehow I got confused and kept trying to run 'npx run cypress' (which either doesn't create the directories, or if the directories do exist it hangs forever on Starting: cypress), when I should have been running 'npx cypress open' or 'npx cypress run'.

Cypress web automation - Cannot open Test Runner

I'm trying to open the Test Runner in cypress first time using the command node_modules.bin\cypress open
But I'm getting the following error.
Cypress verification timed out
Command failed "path"\cypress.exe\smoke test ping=948
I had tried all other open commands as well.
Could you help me with this?
I know this question was long ago, but I just had this problem, and in case anyone does in the future, I want to tell you how I solved it. In my case I had just installed Cypress in a project, and after running npm install the problem has been solved.

cypress open --config baseUrl=https://... won't open

I can't manage to open cypress in my windows machine (this is the CI environment) when I pass --config:
In cmd.exe, if I type npx cypress open cypress opens just fine;
If I instead type npx cypress open --config baseUrl=https://... then nothing appears and the command terminates without printing anything in the terminal.
In the second case, echo %errorlevel% prints 0.
I can reproduce the problem with cypress run: passing a --config baseUrl=... parameter breaks it.
I'm using cypress package and binary 3.6.0. cypress verify is happy.
The regression is now fixed in Cypress 3.8.0 (h/t to Robert DROP TABLE STUDENTS).
OLD ANSWER:
It's a regression introduced in 3.5.0 which came bundled with new Electron, where the underlying issue seems to be this PR: electron/electron#13039 (h/t Jennifer Sheane), which is fixing a security issue and is unlikely to be reverted/handled differently any time soon.
It's being tracked in cypress shows error in Windows when passing args containing a url in 3.5.0.

Running Expresso TDD in Node.js on Windows

Has anyone been able to get this to work?
Environment:
Windows 7 64-bit
node.js v0.6.7
npm 1.1.0-beta-10
expresso 0.9.2
I've successfully installed via npm from zip download (after modifying package.json to remove node-jscoverage dependence). 'npm ls' lists expresso as installed. After overcoming the problem described here by commenting out the reference to SIGINT, expresso will execute from cmd window. However, when I actually attempt to run test suites, I get a 'Cannot find module' error when it tries to open the first test suite. Any help would be appreciated.
You'll have to install the module locally, too.
Have you considered using mocha? It's supposed to be expresso's successor, written by the same author.

Resources