🐛 Bug Report
Jest cannot find unit tests in file when using supertest inside. Example from the Jest for web frameworks example.
To Reproduce
createServer returns Promise<Express>, an express app.
This snippet currently passes when running jest
import request from "supertest";
import assert from "assert";
import { createServer } from "./server";
describe("/diag/json", async () => {
it("should get sample json", async () => {
assert.equal(1, 1);
});
});
This snippet (almost identical to docs and blogs) fails because jest can't find any tests in the file.
import request from "supertest";
import { createServer } from "./server";
describe("/diag/json", async () => {
const app = await createServer();
it("should get sample json", async () => {
const response = await request(app).get("/diag/json");
expect(response.status).toBe(200);
});
});
Error
● Test suite failed to run
Your test suite must contain at least one test.
at node_modules/jest-cli/build/TestScheduler.js:256:22
Expected behavior
Jest either passes running my unit tests or it fails from running my unit tests. (It currently fails from not running my unit tests)
Run npx envinfo --preset jest
System:
OS: Linux 4.18 Ubuntu 18.10 (Cosmic Cuttlefish)
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Binaries:
Node: 10.14.1 - ~/.nvm/versions/node/v10.14.1/bin/node
Yarn: 1.13.0 - ~/.nvm/versions/node/v10.14.1/bin/yarn
npm: 6.5.0 - ~/.nvm/versions/node/v10.14.1/bin/npm
npmPackages:
jest: * => 23.6.0
🐛 Bug Report
Jest cannot find unit tests in file when using supertest inside. Example from the Jest for web frameworks example.
To Reproduce
createServerreturnsPromise<Express>, an express app.This snippet currently passes when running
jestThis snippet (almost identical to docs and blogs) fails because
jestcan't find any tests in the file.Error
Expected behavior
Jest either passes running my unit tests or it fails from running my unit tests. (It currently fails from not running my unit tests)
Run
npx envinfo --preset jestSystem: OS: Linux 4.18 Ubuntu 18.10 (Cosmic Cuttlefish) CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz Binaries: Node: 10.14.1 - ~/.nvm/versions/node/v10.14.1/bin/node Yarn: 1.13.0 - ~/.nvm/versions/node/v10.14.1/bin/yarn npm: 6.5.0 - ~/.nvm/versions/node/v10.14.1/bin/npm npmPackages: jest: * => 23.6.0