unifiedjs / unified-engine

Engine to process multiple files with unified
https://unifiedjs.com
MIT License
56 stars 23 forks source link

Test doesnt run on windows #35

Closed StarpTech closed 5 years ago

StarpTech commented 5 years ago

Paths, Symbols, Colors aren't tested for windows.

TAP version 13
# engine
# engine
ok 1 should throw w/o `callback`
ok 2 should fail when w/o options
ok 3 should fail when w/o processor
# should fail w/ `output` and w/ `out`
ok 4 should fail
# should fail w/ `detectConfig` w/o `rcName`
ok 5 should fail
# should fail w/ `detectIgnore` w/o `ignoreName`
ok 6 should fail
# input
# should fail without input
ok 7 should fail
# should not fail on empty input stream
ok 8 should report
# should not fail on unmatched given globs
ok 9 should work
# should report unfound given files
not ok 10 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'readme.md\n  1:1  error  No such file or directory\n\nΓ£û 1 error\n' ]
    actual: |-
      [ null, 1, 'readme.md\n  1:1  error  No such file or directory\n\n× 1 error\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:106:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:106:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not report unfound given directories
ok 11 should be equivalent
# should search for extensions
not ok 12 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'bar.text: no issues found\nfoo.txt: no issues found\nnested/quux.text: no issues found\nnested/qux.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'bar.text: no issues found\nfoo.txt: no issues found\nnested\\quux.text: no issues found\nnested\\qux.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:155:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:155:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should search a directory for extensions
not ok 13 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/quux.text: no issues found\nnested/qux.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\quux.text: no issues found\nnested\\qux.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:182:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:182:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should search for globs matching files (#1)
ok 14 should report
# should search for globs matching files (#2)
ok 15 should report
# should search for globs matching dirs
not ok 16 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/no-3.txt: no issues found\nnested/no-4.text: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\no-3.txt: no issues found\nnested\\no-4.text: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:263:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:263:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should search vfileΓÇÖs pointing to directories
not ok 17 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/three.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\three.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:285:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:285:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not ignore implicitly ignored files in globs
ok 18 should report
# should include given ignored files (#1)
not ok 19 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'nested/three.txt: no issues found\nnested/two.txt\n  1:1  error  Cannot process specified file: itΓÇÖs ignored\n\none.txt: no issues found\n\nΓ£û 1 error\n' ]
    actual: |-
      [ null, 1, 'nested\\three.txt: no issues found\nnested\\two.txt\n  1:1  error  Cannot process specified file: it’s ignored\n\none.txt: no issues found\n\n× 1 error\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:355:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:355:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not atempt to read files with `contents` (1)
not ok 20 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'not-existing.txt\n  1:1  error  Cannot process specified file: itΓÇÖs ignored\n\nΓ£û 1 error\n' ]
    actual: |-
      [ null, 1, 'not-existing.txt\n  1:1  error  Cannot process specified file: it’s ignored\n\n× 1 error\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:386:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:386:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not atempt to read files with `contents` (2)
ok 21 should report
# should include given ignored files (#2)
not ok 22 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'nested/three.txt: no issues found\nnested/two.txt\n  1:1  error  Cannot process specified file: itΓÇÖs ignored\n\none.txt: no issues found\n\nΓ£û 1 error\n' ]
    actual: |-
      [ null, 1, 'nested/three.txt: no issues found\nnested/two.txt\n  1:1  error  Cannot process specified file: it’s ignored\n\none.txt: no issues found\n\n× 1 error\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:445:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:445:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# silentlyIgnore: skip detected ignored files (#1)
not ok 23 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/three.txt: no issues found\none.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\three.txt: no issues found\none.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:478:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:478:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# silentlyIgnore: skip detected ignored files (#2)
ok 24 should report
# should search if given files
not ok 25 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/three.txt: no issues found\nnested/two.txt: no issues found\none.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\three.txt: no issues found\nnested\\two.txt: no issues found\none.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\input.js:535:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\input.js:535:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# ignore
# should fail fatally when given ignores are not found
ok 26 should fail
# should support custom ignore files
not ok 27 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/three.txt: no issues found\none.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\three.txt: no issues found\none.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\ignore.js:75:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\ignore.js:75:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should support searching ignore files
not ok 28 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/three.txt: no issues found\none.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\three.txt: no issues found\none.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\ignore.js:104:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\ignore.js:104:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not look into hidden files
ok 29 should report
# should support no ignore files
not ok 30 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/three.txt: no issues found\nnested/two.txt: no issues found\none.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\three.txt: no issues found\nnested\\two.txt: no issues found\none.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\ignore.js:160:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\ignore.js:160:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# configuration
# should fail fatally when custom rc files are missing
ok 31 should fail
# should fail fatally when custom rc files are empty
ok 32 should fail
# should fail fatally when custom rc files are invalid
ok 33 should fail
# should support `.rc.js` modules (1)
ok 34 should fail
# should support `.rc.js` modules (2)
ok 35 should support valid .rc modules
# should support `.rc.js` modules (3)
ok 36 should use NodeΓÇÖs module caching (coverage)
# should support `.rc.yaml` modules
ok 37 should fail fatally when custom .rc files are malformed
# should support custom rc files
not ok 38 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/four.txt: no issues found\nnested/three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\four.txt: no issues found\nnested\\three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\configuration.js:261:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\configuration.js:261:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should support searching package files
ok 39 should report
# should support custom rc files
not ok 40 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/four.txt: no issues found\nnested/three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\four.txt: no issues found\nnested\\three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\configuration.js:324:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\configuration.js:324:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should support no config files
not ok 41 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/three.txt: no issues found\nnested/two.txt: no issues found\none.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\three.txt: no issues found\nnested\\two.txt: no issues found\none.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\configuration.js:354:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\configuration.js:354:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not search if `detectConfig` is `false`
ok 42 should not search for config if `detectConfig` is set to `false`
# should cascade `settings`
ok 43 should configure
ok 44 should report
# configuration
# should cascade `plugins`
ok 45 (unnamed assert)
not ok 46 should work
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'nested/one.txt: no issues found\n' ]
    actual: |-
      [ null, 0, 'nested\\one.txt: no issues found\n' ]
    at: onrun (D:\Repositories\unified-engine\test\configuration-plugins.js:36:10)
    stack: |-
      Error: should work
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\configuration-plugins.js:36:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should handle failing plugins
ok 47 should work
# should handle missing plugins
ok 48 should work
# should handle invalid plugins
ok 49 should work
# should handle throwing plugins
ok 50 should work
# should handle injected plugins
ok 51 should support a plug-in
ok 52 should support a plug-in--options tuple
ok 53 should work
# configuration-presets
# should fail on invalid `presets`
ok 54 should fail
# should support plugins with the same name
ok 55 should pass the correct options to the deep plugin
ok 56 should pass the correct options to the local plugin
ok 57 should succeed
# should handle missing plugins in presets
ok 58 should succeed
# should reconfigure plugins
ok 59 should pass the correct options to the preset plugin
ok 60 should succeed
# should reconfigure required plugins
ok 61 should pass the correct options to the preset plugin
ok 62 should succeed
# Should reconfigure: turn plugins off
ok 63 should succeed
# should reconfigure settings
ok 64 should configure
ok 65 should succeed
# should reconfigure settings (2)
ok 66 should configure
ok 67 should succeed
# `configTransform`
# should work
ok 68 should pass the correct options to plugin `test`
ok 69 should have one cache entry
ok 70 should set the correct settings
ok 71 should pass the correct options to plugins
ok 72 should succeed
# `defaultConfig`
# should use default config if no config file is found
ok 73 should set the correct configuration
ok 74 should pass the correct options to plugin `test-defaults`
ok 75 should work
# should use found otherwise
ok 76 should set the correct configuration
ok 77 should pass the correct options to plugin `test-found`
ok 78 should work
# stdin
# should support stdin
ok 79 should report
# should not output if `out: false`
ok 80 should report
# should support config files on stdin
ok 81 should configure
ok 82 should work
# output
# should not write to stdout on dirs
ok 83 should report
# should write to stdout on one file
ok 84 should report
# should not write to stdout without `out`
ok 85 should report
# should not write multiple files to stdout
ok 86 should report
# should output files
ok 87 should report
# should write to a path
ok 88 should report
# should write to directories
not ok 89 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, '', 'two', 'one.txt > nested/one.txt: written\n' ]
    actual: |-
      [ null, 0, '', 'two', 'one.txt > nested\\one.txt: written\n' ]
    at: onrun (D:\Repositories\unified-engine\test\output.js:269:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\output.js:269:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not create intermediate directories
ok 90 should report
# should write injected files
ok 91 should report
# should not write without file-path
not ok 92 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, '', '<stdin>\n  1:1  error  Error: Cannot write file without an output path ' ]
    actual: |-
      [ null, 1, '', '<stdin>\n  1:1  error  Error: Cannot write file without an output path' ]
    at: onrun (D:\Repositories\unified-engine\test\output.js:388:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\output.js:388:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should fail when writing files to one path
not ok 93 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'one.txt\n  1:1  error  Error: Cannot write multiple files to single output' ]
    actual: |-
      [ null, 1, 'one.txt\n  1:1  error  Error: Cannot write multiple files to single output: D' ]
    at: onrun (D:\Repositories\unified-engine\test\output.js:437:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\output.js:437:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should fail when writing to non-existent dirs
not ok 94 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'one.txt\n  1:1  error  Error: Cannot read output directory. Error:' ]
    actual: |-
      [ null, 1, 'one.txt\n  1:1  error  Error: Cannot write multiple files to single output: D:\\Repositories\\unified-engine\\test\\fixtures\\two-files\\three' ]
    at: onrun (D:\Repositories\unified-engine\test\output.js:470:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\output.js:470:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# tree
# should fail on malformed input
ok 95 should report
# should read and write JSON when `tree` is given
ok 96 should report
# should read JSON when `treeIn` is given
ok 97 should report
# should write JSON when `treeOut` is given
ok 98 should report
# should support `treeOut` for stdin
ok 99 should work
# should support `treeIn` for stdin
ok 100 should work
# should write injected files
ok 101 should work
# inspect
# should write text when `inspect` is given
ok 102 should work
# should support `inspect` for stdin
ok 103 should work
# should support `inspect` with colour
ok 104 should work
# file-path
# should throw on `file-path` with files
ok 105 should fail
# should support `file-path`
ok 106 should report
# color
not ok 107 should support color
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, '\x1b[4m\x1b[31mreadme.md\x1b[39m\x1b[24m\n  1:1  \x1b[31merror\x1b[39m  No such file or directory\n\n\x1b[31mΓ£û\x1b[39m 1 error\n' ]
    actual: |-
      [ null, 1, '\x1b[4m\x1b[31mreadme.md\x1b[39m\x1b[24m\n  1:1  \x1b[31merror\x1b[39m  No such file or directory\n\n\x1b[31m×\x1b[39m 1 error\n' ]
    at: onrun (D:\Repositories\unified-engine\test\color.js:38:7)
    stack: |-
      Error: should support color
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\color.js:38:7)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# reporting
# should fail for warnings with `frail`
not ok 108 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'one.txt\n  1:1  warning  Warning\n\nΓÜá 1 warning\n' ]
    actual: |-
      [ null, 1, 'one.txt\n  1:1  warning  Warning\n\n‼ 1 warning\n' ]
    at: onrun (D:\Repositories\unified-engine\test\reporting.js:43:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\reporting.js:43:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not report succesful files when `quiet` (#1)
not ok 109 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, 'two.txt\n  1:1  warning  Warning\n\nΓÜá 1 warning\n' ]
    actual: |-
      [ null, 0, 'two.txt\n  1:1  warning  Warning\n\n‼ 1 warning\n' ]
    at: onrun (D:\Repositories\unified-engine\test\reporting.js:77:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\reporting.js:77:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should not report succesful files when `quiet` (#2)
ok 110 should not report
# should not report succesful files when `silent`
not ok 111 should report
  ---
    operator: deepEqual
    expected: |-
      [ null, 1, 'two.txt\n  1:1  error  Error\n\nΓ£û 1 error\n' ]
    actual: |-
      [ null, 1, 'two.txt\n  1:1  error  Error\n\n× 1 error\n' ]
    at: onrun (D:\Repositories\unified-engine\test\reporting.js:135:10)
    stack: |-
      Error: should report
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\reporting.js:135:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# should support custom reporters (without prefix)
ok 112 should be equivalent
# should support custom reporters (with prefix)
ok 113 should be equivalent
# should fail on an unfound reporter
ok 114 should be equal
# completers
# should pass `fileSet` to plug-ins
ok 115 should pass a set
ok 116 should have a `use` method
ok 117 should have an `add` method
ok 118 should be able to `use` a completer
ok 119 should be able to `add` a file
ok 120 should pass a set
ok 121 should have a `use` method
ok 122 should have an `add` method
ok 123 should be able to `use` a completer
ok 124 should be able to `add` a file
ok 125 should expose the files and set to `completer` (1)
ok 126 should expose the files and set to `completer` (2)
ok 127 should work
# should pass `fileSet` to plug-ins
not ok 128 should work
  ---
    operator: deepEqual
    expected: |-
      [ null, 0, '', 'foo.txt > nested/foo.txt: written\n' ]
    actual: |-
      [ null, 0, '', 'foo.txt > nested\\foo.txt: written\n' ]
    at: onrun (D:\Repositories\unified-engine\test\completers.js:118:10)
    stack: |-
      Error: should work
          at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
          at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
          at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
          at onrun (D:\Repositories\unified-engine\test\completers.js:118:10)
          at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
          at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
          at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
          at runCallback (timers.js:705:18)
          at tryOnImmediate (timers.js:676:5)
  ...
# settings
# should use `settings`
ok 129 should configure
ok 130 should report
# should cascade `settings`
ok 131 should configure
ok 132 should report
# plugins
# should use `plugins` as list of functions
ok 133 transformer
ok 134 transformer
ok 135 should report
# should use `plugins` as list of strings
ok 136 should pass the correct options to the preset plugin
ok 137 should report
# should use `plugins` as list of objects
ok 138 should pass the correct options to the preset plugin
ok 139 should report

1..139
# tests 139
# pass  113
# fail  26

ERROR: Coverage for lines (99.87%) does not meet global threshold (100%)
ERROR: Coverage for branches (99.75%) does not meet global threshold (100%)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! unified-engine@6.0.1 test-coverage: `nyc --reporter lcov tape test/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the unified-engine@6.0.1 test-coverage script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\deusd\AppData\Roaming\npm-cache\_logs\2018-12-15T17_07_15_619Z-debug.log
npm ERR! Test failed.  See above for more details.
wooorm commented 5 years ago

Thanks for opening this! Two thoughts: paths seem like a doable, albeit tedious, fix. Symbols and colours are harder, as I don’t have access to a Windows computer. could you help work on this?

StarpTech commented 5 years ago

Hi @wooorm,

I spend little time on it and come to the following conclusion.

On windows, the common codepage is 437 (USA) or 850 (Europe) and it doesn't support the icons. Therefore the package which choose the correct one is not unifiedjs but vfile-reporter. When I manually change the codepage to 65001 (utf8) the icons represent the state in vfile-reporter. The reason is well explained in pinojs and we should add such a help section as well. Finally, due to the nodejs limitation there is only one good solution

Even with codepage 437 or 850 the fallback icons “×” (U+00D7) looks wrong and this points to the node.js limitation.

On Windows, if the file descriptor is connected to the console (e.g. fd == 1 or stdout) a string containing non-ASCII characters will not be rendered properly by default, regardless of the encoding used. It is possible to configure the console to render UTF-8 properly by changing the active codepage with the chcp 65001 command. See the chcp docs for more details.

Reference: https://nodejs.org/api/fs.html#fs_fs_write_fd_string_position_encoding_callback

wooorm commented 5 years ago

Hmm, could we alternatively use vfile-reporter-json in most cases, and parse that, instead of rewriting everything for both windows and non-windows?

StarpTech commented 5 years ago

It looks like it is much easier to fix. The tap output doesn't represent the real value. When I replace all figures with windows compatible symbols it works but the package vfile-reporter-pretty rely on log-symbols which use utf8 symbols when the CI env variable is set. In the test the env is overwritten manually. The next issue is absolute path handling of the vfile-reporter-pretty reporter on windows.

I created https://github.com/unifiedjs/unified-engine/pull/36 which illustrate my way.

Feel free to work on that PR as well because I won't have time to fix all issues.