In Jest run one specific test in a file using npm test

Public, Testing / TDD

harrylevine

Created: Feb 07, 2019     Updated: Feb 08, 2019


Circumstances

  "scripts": {
    "test": "jest"
  }
/__test__/td.test.js
describe("parseEntries", () => {
  it("parses 000000000", () => {
    expect(parsedResults).toContain("000000000");
  });
  ...
});

Here is the command to run that one test

$ npm test --  __test__/td.test.js -t 'parses 000000000'

Resource: https://jestjs.io/docs/en/cli.html