Skip to content

Commit

Permalink
Add error messages to path(Not)StrictEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Sep 8, 2024
1 parent 48c9057 commit 8816be5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/units/08_compile_build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe.only(path.basename(__filename).split('.')[0] + ':', () => {
assert.hasLog('Recipe step 1 The command is bash:["-c","exit 0;#external"].')
})

it('should use the current pwd as external command cwd', async () => {
it.only('should use the current pwd as external command cwd', async () => {
await set.config('latex.external.build.command', 'bash')
await set.config('latex.external.build.args', ['-c', 'echo $PWD'])

Expand Down
6 changes: 4 additions & 2 deletions test/units/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ function getPaths(actual: string | undefined, expected: string | undefined): [st
return [actual, expected]
}
assert.pathStrictEqual = (actual: string | undefined, expected: string | undefined, message?: string | Error) => {
assert.strictEqual(path.relative(...getPaths(actual, expected)), '', message)
[actual, expected] = getPaths(actual, expected)
assert.strictEqual(path.relative(actual, expected), '', message ?? `Paths are not equal: ${actual} !== ${expected} .`)
}
assert.pathNotStrictEqual = (actual: string | undefined, expected: string | undefined, message?: string | Error) => {
assert.notStrictEqual(path.relative(...getPaths(actual, expected)), '', message)
[actual, expected] = getPaths(actual, expected)
assert.notStrictEqual(path.relative(actual, expected), '', message ?? `Paths are equal: ${actual} === ${expected} .`)
}
function hasLog(message: string | RegExp) {
return typeof message === 'string'
Expand Down

0 comments on commit 8816be5

Please sign in to comment.