The audit should fail when the license auditor is configured with a malformed validator function.
To reproduce
Steps to reproduce the behavior:
Create .licenses.config.ts with the following contents:
const VALID_LICENSES =
"(MIT|Apache-2.0|0BSD|BSD-[2-3]-Clause|ISC)";
const VALIDATOR = new RegExp(
`^(${VALID_LICENSES}|\\(${VALID_LICENSES}( OR ${VALID_LICENSES})*\\))$`
);
/* Test what happens when the auditor is misconfigured. The correct configuration would be:
* module.exports = { isValidLicense: (license) => VALIDATOR.test(license) };
*/
module.exports = { isValidLicense: VALIDATOR.test };
Run yarn set version 3.0.0 to install Yarn 3.0.0.
Run yarn add --dev ts-node@10.8.1.
Run yarn licenses audit --output-file=reports/junit/licenses.xml --config=.licenses.config.ts --loose.
Run echo $? to see that the audit succeeded, exiting with code 0.
Describe the bug
The audit should fail when the license auditor is configured with a malformed validator function.
To reproduce
Steps to reproduce the behavior:
Create
.licenses.config.ts
with the following contents:yarn set version 3.0.0
to install Yarn 3.0.0.yarn add --dev ts-node@10.8.1
.yarn licenses audit --output-file=reports/junit/licenses.xml --config=.licenses.config.ts --loose
.echo $?
to see that the audit succeeded, exiting with code 0.reports/junit/licenses.xml
contains:Expected behavior
I expected the audit to fail because the license validator function itself was invalid.
Environment (please complete the following information):