Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Audit Silently Succeeds When No Tests Run #22

Open
Kurt-von-Laven opened this issue Jun 22, 2022 · 0 comments
Open

Audit Silently Succeeds When No Tests Run #22

Kurt-von-Laven opened this issue Jun 22, 2022 · 0 comments
Labels
good first issue Good for newcomers

Comments

@Kurt-von-Laven
Copy link
Contributor

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:

  1. 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 };
  2. Run yarn set version 3.0.0 to install Yarn 3.0.0.
  3. Run yarn add --dev [email protected].
  4. Run yarn licenses audit --output-file=reports/junit/licenses.xml --config=.licenses.config.ts --loose.
  5. Run echo $? to see that the audit succeeded, exiting with code 0.
  6. reports/junit/licenses.xml contains:
    <?xml version="1.0" encoding="UTF-8"?>
    <testsuites>
      <testsuite name="Dependency Licenses Audit" tests="0" failures="0" errors="0" skipped="0"/>
    </testsuites>

Expected behavior

I expected the audit to fail because the license validator function itself was invalid.

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Plugin Version: f2d2e09
  • Node Version: 16.15.0
@noahnu noahnu added the good first issue Good for newcomers label Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants