Skip to content

Commit

Permalink
resolve environments in a single expression
Browse files Browse the repository at this point in the history
  • Loading branch information
tryggvigy committed Nov 13, 2024
1 parent 839f679 commit b80e392
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/knip/src/plugins/jest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ const resolveDependencies = async (config: JestInitialOptions, options: PluginOp

const runner = config.runner ? [config.runner] : [];
const runtime = config.runtime && config.runtime !== 'jest-circus' ? [config.runtime] : [];

let environments: Array<string> = [];
if (config.testEnvironment === 'jsdom') {
environments = ['jest-environment-jsdom'];
} else if (config.testEnvironment) {
environments = [config.testEnvironment];
}

const environments =
config.testEnvironment === 'jsdom'
? ['jest-environment-jsdom']
: config.testEnvironment
? [config.testEnvironment]
: [];
const resolvers = config.resolver ? [config.resolver] : [];
const reporters = config.reporters
? config.reporters
Expand Down

0 comments on commit b80e392

Please sign in to comment.