0
0
Cypresstesting~20 mins

Cypress installation (npm install cypress) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cypress Installation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What does the command npm install cypress do?
When you run npm install cypress in your project folder, what happens?
AIt downloads and installs the Cypress testing tool and adds it to your project's dependencies.
BIt runs all Cypress tests in your project automatically.
CIt updates the Node.js version on your computer to support Cypress.
DIt creates a new Cypress project with default test files.
Attempts:
2 left
💡 Hint
Think about what npm install generally does for packages.
Predict Output
intermediate
2:00remaining
What is the output after running npm install cypress successfully?
After running npm install cypress in a new project, what message will you see indicating success?
AError: Cannot find module 'cypress'
Badded 257 packages, and audited 258 packages in 12s
CCypress tests executed successfully
Dnpm: command not found
Attempts:
2 left
💡 Hint
Look for a message that confirms package installation, not test execution.
locator
advanced
2:00remaining
Where does Cypress get installed after running npm install cypress?
After installing Cypress with npm, where can you find the Cypress executable files in your project?
AInside the <code>node_modules/cypress</code> folder within your project directory.
BIn the root folder of your project, as a standalone <code>cypress</code> folder.
CIn the global npm folder outside your project directory.
DInside the <code>tests/cypress</code> folder created automatically.
Attempts:
2 left
💡 Hint
Think about where npm installs packages locally by default.
assertion
advanced
2:00remaining
Which assertion correctly verifies Cypress is installed in a Node.js project?
Given the following Node.js code snippet, which assertion correctly checks that Cypress is listed as a dependency in package.json?
Cypress
const fs = require('fs');
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
// Which assertion below is correct?
Aassert(packageJson.scripts.cypress === 'install')
Bassert(packageJson.devDependencies.includes('cypress'))
Cassert(packageJson.dependencies.cypress === undefined)
Dassert(packageJson.dependencies.hasOwnProperty('cypress'))
Attempts:
2 left
💡 Hint
Check how dependencies are stored in package.json as objects, not arrays.
🔧 Debug
expert
2:00remaining
Why does npm install cypress fail with ERR! code E404?
You run npm install cypress but get this error: npm ERR! 404 Not Found - GET https://registry.npmjs.org/cypress - Not found. What is the most likely cause?
AYour internet connection is down or npm registry is unreachable.
BYou need to run <code>npm init</code> before installing any package.
CYou typed the package name incorrectly or it does not exist in npm registry.
DYour Node.js version is too old to support Cypress installation.
Attempts:
2 left
💡 Hint
Check the error message carefully for clues about the package name or registry.