(projectRoot, options = {})
| 171 | } |
| 172 | |
| 173 | function checkVerify(projectRoot, options = {}) { |
| 174 | const scripts = readPackageScripts(projectRoot); |
| 175 | const profile = selectVerificationProfile(projectRoot); |
| 176 | const command = scripts.test ? 'npm run test' : profile.primaryCommand; |
| 177 | const hasCommand = Boolean(command); |
| 178 | const result = options.runVerification && hasCommand ? runCommand(projectRoot, command) : null; |
| 179 | |
| 180 | let status = hasCommand ? 'pass' : 'partial'; |
| 181 | let detail = hasCommand ? `selected ${command}` : 'no verification command was discovered'; |
| 182 | if (result) { |
| 183 | status = result.status === 'pass' ? 'pass' : 'fail'; |
| 184 | detail = `${command} exited ${result.exitCode}`; |
| 185 | } |
| 186 | |
| 187 | return { |
| 188 | id: 'verify', |
| 189 | status, |
| 190 | detail, |
| 191 | evidence: [ |
| 192 | `profile=${profile.id}`, |
| 193 | `primary=${profile.primaryCommand}`, |
| 194 | ...profile.commands.slice(0, 4), |
| 195 | ], |
| 196 | profile, |
| 197 | result, |
| 198 | }; |
| 199 | } |
| 200 | |
| 201 | function checkReport(projectRoot) { |
| 202 | const evidence = listExisting(projectRoot, [ |
no test coverage detected