0
0
Expressframework~20 mins

CI/CD pipeline for Express apps - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Express CI/CD Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this GitHub Actions step?
Given this GitHub Actions step in a CI pipeline for an Express app, what will be the output if the tests fail?
Express
steps:
  - name: Run tests
    run: npm test
AThe pipeline stops and marks the job as failed.
BThe pipeline skips the test step and marks it as successful.
CThe pipeline retries the test step automatically.
DThe pipeline continues to the next step regardless of test results.
Attempts:
2 left
💡 Hint
By default, a failing command in GitHub Actions stops the job.
Configuration
intermediate
2:00remaining
Which Dockerfile snippet correctly sets up an Express app for production?
Choose the Dockerfile snippet that correctly installs dependencies and starts the Express app in production mode.
A
FROM node:18
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]
B
FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["node", "server.js"]
C
FROM node:18
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
CMD ["node", "index.js"]
D
FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm install --only=production
COPY . .
CMD ["node", "server.js"]
Attempts:
2 left
💡 Hint
Production installs only needed packages and uses the correct start file.
🔀 Workflow
advanced
3:00remaining
What is the correct order of steps in a CI/CD pipeline for an Express app?
Arrange these steps in the correct order for a typical CI/CD pipeline deploying an Express app.
A4,2,1,3
B4,1,2,3
C1,4,2,3
D2,4,1,3
Attempts:
2 left
💡 Hint
Code must be pushed before tests run, then build and deploy.
Troubleshoot
advanced
2:00remaining
Why does this GitHub Actions step fail with 'npm: command not found'?
In a GitHub Actions workflow for an Express app, this step fails: - name: Install dependencies run: npm install What is the most likely cause?
AThe npm install command is misspelled.
BThe package.json file is missing in the repository.
CThe runner does not have Node.js installed or the PATH is incorrect.
DThe workflow YAML syntax is invalid.
Attempts:
2 left
💡 Hint
Check if Node.js is available on the runner environment.
Best Practice
expert
3:00remaining
Which practice improves CI/CD pipeline speed for Express apps?
Select the best practice to speed up the CI/CD pipeline when building Docker images for Express apps.
AUse multi-stage Docker builds to separate dependencies installation from app code copying.
BAlways run npm install without caching to ensure fresh dependencies.
CBuild the Docker image on every commit without using any cache.
DPush the Docker image to the registry before running tests.
Attempts:
2 left
💡 Hint
Separating layers helps Docker cache dependencies and avoid reinstalling them every build.