0
0
Expressframework~10 mins

Jest or Vitest setup for Express - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import Express in a test file.

Express
const express = require('[1]');
Drag options to blanks, or click blank then click option'
Apath
Bhttp
Cfs
Dexpress
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'http' instead of 'express' for import.
2fill in blank
medium

Complete the code to import the testing function from Vitest.

Express
const { [1] } = require('vitest');
Drag options to blanks, or click blank then click option'
Adescribe
Brun
Ctest
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'start' which are not test functions.
3fill in blank
hard

Fix the error in importing the supertest library for HTTP testing.

Express
const request = require('[1]');
Drag options to blanks, or click blank then click option'
Asupertest
Bsupertest-express
Csupertestjs
Dsupertest-http
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect package names like 'supertest-express'.
4fill in blank
hard

Fill both blanks to create a simple test that checks the Express app response status.

Express
test('GET / responds with 200', async () => {
  const response = await request([1]).get('/');
  expect(response.status).toBe([2]);
});
Drag options to blanks, or click blank then click option'
Aapp
Bserver
C404
D200
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'server' instead of 'app' or wrong status codes.
5fill in blank
hard

Fill all three blanks to setup a Vitest test file with Express and supertest.

Express
const express = require('[1]');
const request = require('[2]');
const { test, expect } = require('[3]');
Drag options to blanks, or click blank then click option'
Aexpress
Bsupertest
Cvitest
Djest
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing Jest with Vitest imports or wrong package names.