* Expect that the workspace has a description, and that it is a non-null * string. If the description is not present, or is null, this will log an * error, and cause the constraint to fail. * * This will also verify that the description does not end with a period. * * @param {Workspace} worksp
(workspace)
| 86 | * @param {Workspace} workspace - The workspace to check. |
| 87 | */ |
| 88 | function expectWorkspaceDescription(workspace) { |
| 89 | expectWorkspaceField(workspace, 'description'); |
| 90 | |
| 91 | const { description } = workspace.manifest; |
| 92 | if (typeof description !== 'string') { |
| 93 | workspace.error( |
| 94 | `Expected description to be a string, but got ${typeof description}.`, |
| 95 | ); |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | if (description.endsWith('.')) { |
| 100 | workspace.set('description', description.slice(0, -1)); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Expect that if a dependency is listed under "dependencies", it is not also |
no test coverage detected
searching dependent graphs…