65 lines
1.7 KiB
JavaScript
65 lines
1.7 KiB
JavaScript
|
'use strict'
|
||
|
|
||
|
import ignore from '../src/ignore'
|
||
|
import { expect } from 'chai'
|
||
|
import { it } from 'mocha'
|
||
|
// pause = require('@uci/utils').pPause
|
||
|
|
||
|
describe (
|
||
|
'Build Ignore Array',
|
||
|
function () {
|
||
|
// hooks()
|
||
|
buildIgnoreList()
|
||
|
// someothertests()
|
||
|
})
|
||
|
|
||
|
//****************** TESTS **********************
|
||
|
function buildIgnoreList() {
|
||
|
it('==> can create array for multiple files of ignore lines', async function () {
|
||
|
const shouldbe = [ 'tests/',
|
||
|
'test/',
|
||
|
'*.test.js',
|
||
|
'testing/',
|
||
|
'example/',
|
||
|
'/node_modules/',
|
||
|
'/coverage/',
|
||
|
'foo/**',
|
||
|
'bar/*.js' ]
|
||
|
let result = await ignore(__dirname+'/repo')
|
||
|
//console.log('returned to test',result, shouldbe)
|
||
|
expect(result, 'list build failed').to.deep.equal(shouldbe)
|
||
|
})
|
||
|
it('==> can create array with additional passed in file and relative repo path', async function () {
|
||
|
const shouldbe = [ 'tests/',
|
||
|
'test/',
|
||
|
'*.test.js',
|
||
|
'testing/',
|
||
|
'example/',
|
||
|
'/node_modules/',
|
||
|
'/coverage/',
|
||
|
'foo/**',
|
||
|
'bar/*.js',
|
||
|
'bah/*/*.js'
|
||
|
]
|
||
|
let result = await ignore('./test/repo','.testignore')
|
||
|
//console.log('returned to test',result, shouldbe)
|
||
|
expect(result, 'list build failed').to.deep.equal(shouldbe)
|
||
|
})
|
||
|
it('==> can handle file in other than repo path', async function () {
|
||
|
const shouldbe = [ 'tests/',
|
||
|
'test/',
|
||
|
'*.test.js',
|
||
|
'testing/',
|
||
|
'example/',
|
||
|
'/node_modules/',
|
||
|
'/coverage/',
|
||
|
'foo/**',
|
||
|
'bar/*.js',
|
||
|
'wtf/'
|
||
|
]
|
||
|
let result = await ignore(__dirname+'/repo','./test/anotherignorefile')
|
||
|
//console.log('returned to test',result, shouldbe)
|
||
|
expect(result, 'list build failed').to.deep.equal(shouldbe)
|
||
|
})
|
||
|
}
|