Skip to content

Commit

Permalink
feat(testing): add --force-exit to jest executor (#17790)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbados-clemens authored Jun 26, 2023
1 parent 37eda46 commit 836cd34
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/generated/packages/jest/executors/jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
"description": "Find and run the tests that cover a comma separated list of source files that were passed in as arguments. (https://jestjs.io/docs/cli#--findrelatedtests-spaceseparatedlistofsourcefiles)",
"type": "string"
},
"forceExit": {
"description": "Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot be adequately cleaned up.This feature is an escape-hatch. If Jest doesn't exit at the end of a test run, it means external resources are still being held on to or timers are still pending in your code. It is advised to tear down external resources after each test to make sure Jest can shut down cleanly. You can use --detectOpenHandles to help track it down.",
"type": "boolean"
},
"json": {
"description": "Prints the test results in `JSON`. This mode will send all other test output and user messages to `stderr`. (https://jestjs.io/docs/cli#--json)",
"type": "boolean"
Expand Down
1 change: 1 addition & 0 deletions packages/jest/src/executors/jest/jest.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export async function jestConfigParser(
ci: options.ci,
color: options.color,
detectOpenHandles: options.detectOpenHandles,
forceExit: options.forceExit,
logHeapUsage: options.logHeapUsage,
detectLeaks: options.detectLeaks,
json: options.json,
Expand Down
1 change: 1 addition & 0 deletions packages/jest/src/executors/jest/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface JestExecutorOptions {
color?: boolean;
clearCache?: boolean;
findRelatedTests?: string;
forceExit?: boolean;
json?: boolean;
maxWorkers?: number | string;
onlyChanged?: boolean;
Expand Down
4 changes: 4 additions & 0 deletions packages/jest/src/executors/jest/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
"description": "Find and run the tests that cover a comma separated list of source files that were passed in as arguments. (https://jestjs.io/docs/cli#--findrelatedtests-spaceseparatedlistofsourcefiles)",
"type": "string"
},
"forceExit": {
"description": "Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot be adequately cleaned up.This feature is an escape-hatch. If Jest doesn't exit at the end of a test run, it means external resources are still being held on to or timers are still pending in your code. It is advised to tear down external resources after each test to make sure Jest can shut down cleanly. You can use --detectOpenHandles to help track it down.",
"type": "boolean"
},
"json": {
"description": "Prints the test results in `JSON`. This mode will send all other test output and user messages to `stderr`. (https://jestjs.io/docs/cli#--json)",
"type": "boolean"
Expand Down

1 comment on commit 836cd34

@vercel
Copy link

@vercel vercel bot commented on 836cd34 Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.