Skip to content

Commit

Permalink
fix: don't run if env is false
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Oct 6, 2021
1 parent f1390a7 commit 98bf77d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ function istanbulPlugin(opts: IstanbulPluginOptions = {}): Plugin {
const env = opts.cypress ? process.env.CYPRESS_COVERAGE : process.env.VITE_COVERAGE;
const requireEnv = opts.requireEnv ?? false;

if (process.env.NODE_ENV == 'production' && requireEnv && env?.toLowerCase() === 'false') {
if (
process.env.NODE_ENV == 'production' ||
env?.toLowerCase() === 'false' ||
(requireEnv && env?.toLowerCase() !== 'true')
) {
return { name: PLUGIN_NAME };
}

Expand Down

1 comment on commit 98bf77d

@nightah
Copy link

@nightah nightah commented on 98bf77d Oct 7, 2021

Choose a reason for hiding this comment

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

This is a breaking change for existing setups. It now means that we cannot instrument code with a mode of production because it will bail out after the first conditional is met.

Please sign in to comment.