vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

Question: Is there a way to add `pretest` and `posttest` hooks?

Open dashmug opened this issue 5 years ago • 1 comments

My Jest tests require setup and teardown procedures that I currently configure in yarn pretest and yarn posttest respectively. Is there a way to make this plugin respect that?

dashmug avatar Mar 12 '19 02:03 dashmug

This is documented in jestCommandLine

if you uses npm, add an additional "--" at the end (e.g. "npm run test --")

At least with npm, assuming you have your pretest script defined, this would effectively configure vscode-jest to run the pretest script.

.vscode/settings.json:

{
  "jest.jestCommandLine": "npm test --"
}

While I'm not as familiar with yarn, I expect there's a similar analog here

hkiang01 avatar Mar 15 '23 23:03 hkiang01