Skip to content

Commit

Permalink
#144: test: adds a specific test case for "path should be a `path.rel…
Browse files Browse the repository at this point in the history
…ative()d` string"
  • Loading branch information
kaelzhang committed Dec 18, 2024
1 parent a8efe85 commit a44c2a7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/others.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ IGNORE_TEST_CASES.forEach(([d, patterns, path, [ignored, unignored]]) => {
})
})

_test('options.allowRelativePaths', t => {
_test('options.allowRelativePaths = true', t => {
const ig = ignore({
allowRelativePaths: true
})
Expand All @@ -241,3 +241,14 @@ _test('options.allowRelativePaths', t => {

t.end()
})

_test('options.allowRelativePaths = false (default value)', t => {
const ig = ignore()

ig.add('foo')

t.throws(() => ig.ignores('../foo/bar.js'), 'path.relative')
t.throws(() => ig.ignores('/foo/bar.js'), 'path.relative')

t.end()
})

0 comments on commit a44c2a7

Please sign in to comment.