Skip to content

Commit

Permalink
Check more package.json#scripts for matches in node-test-runner plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 7, 2023
1 parent ebbb186 commit dc1f590
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/plugins/node-test-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export const ENABLERS = [''];

export const isEnabled: IsPluginEnabledCallback = ({ manifest }) => {
// TODO Better to scan the entry files until the first `node:test` import, but that's expensive
return Boolean(manifest.scripts?.test && /node.+--test/.test(manifest.scripts?.test));
return Object.keys(manifest.scripts ?? {})
.filter(s => /test/.test(s)) // TODO Checking all script may return false positives to match `node --test`?
.some(s => manifest.scripts && /node (.*)--test/.test(manifest.scripts[s]));
};

/** @public */
Expand Down

0 comments on commit dc1f590

Please sign in to comment.