Skip to content

Commit

Permalink
test: fixes a bug that we could never imitate win32 on other platform
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Aug 14, 2018
1 parent 6559ad0 commit ef2b417
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class Ignore {
return this.add(pattern)
}

// | ignored:unignored
// | ignored : unignored
// negative | 0:0 | 0:1 | 1:0 | 1:1
// -------- | ------- | ------- | ------- | --------
// 0 | TEST | TEST | SKIP | X
Expand All @@ -444,6 +444,7 @@ class Ignore {
// - SKIP: always skip
// - TEST: always test
// - TESTIF: only test if checkUnignored
// - X: that never happen

// @param {boolean} whether should check if the path is unignored,
// setting `checkUnignored` to `false` could reduce additional
Expand Down
10 changes: 6 additions & 4 deletions test/ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ const {test} = require('tap')
const cases = require('./fixtures/cases')

const IS_WINDOWS = process.platform === 'win32'
const SHOULD_TEST_WINDOWS = !process.env.IGNORE_TEST_WIN32
&& IS_WINDOWS
const SHOULD_TEST_WINDOWS = process.env.IGNORE_TEST_WIN32
|| IS_WINDOWS

const make_win32 = path => path.replace(/\//g, '\\')
const ENV_KEYS = [
'IGNORE_ONLY_FILTER',
'IGNORE_ONLY_CREATE_FILTER',
'IGNORE_ONLY_IGNORES'
'IGNORE_ONLY_IGNORES',
'IGNORE_ONLY_WIN32'
]

const envs = {}
Expand Down Expand Up @@ -75,7 +76,8 @@ cases(({
return
}

test(`win32: .filter(): ${description}`, t => {
checkSpec('IGNORE_ONLY_WIN32')
&& test(`win32: .filter(): ${description}`, t => {
const win_paths = paths.map(make_win32)

const ig = ignore()
Expand Down

0 comments on commit ef2b417

Please sign in to comment.