Skip to content

Commit 7ac7d02

Browse files
committedSep 25, 2023
Change to improve error message
1 parent 034930a commit 7ac7d02

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
 

‎lib/find-repo.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export async function findRepo(file, options) {
3939
}
4040

4141
if (!repo) {
42-
throw new Error('Could not find remote origin')
42+
throw new Error(
43+
'Cannot find remote `origin` of local Git repo; pass `repository: false` if you are not using Git'
44+
)
4345
}
4446
} else {
4547
repo = givenRepo

‎test/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ test('remark-validate-links', async function (t) {
501501
assert.fail()
502502
} catch (error) {
503503
const cause = /** @type {ExecError} */ (error)
504-
assert.ok(/not a git repository/i.test(String(cause)))
504+
assert.match(String(cause), /not a git repository/i)
505505
} finally {
506506
await fs.rename(gitBakUrl, gitUrl)
507507
}
@@ -525,7 +525,10 @@ test('remark-validate-links', async function (t) {
525525
} catch (error) {
526526
const cause = /** @type {ExecError} */ (error)
527527
await fs.rm('./.git', {recursive: true})
528-
assert.ok(/Could not find remote origin/.test(String(cause)))
528+
assert.match(
529+
String(cause),
530+
/Cannot find remote `origin` of local Git repo/
531+
)
529532
}
530533
})
531534

0 commit comments

Comments
 (0)
Please sign in to comment.