Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

Commit

Permalink
feat(cli): extend glob to cover subdirectories
Browse files Browse the repository at this point in the history
* Extend globbing spec files to subdirectories

* Update test cases
  • Loading branch information
radmen authored and thetutlage committed Oct 29, 2017
1 parent 2952d39 commit cce2055
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Cli {
constructor (Env, Helpers) {
this.projectRoot = Helpers.appRoot()
this._testGroups = {
unit: 'test/unit/*.spec.js',
functional: 'test/functional/*.spec.js'
unit: 'test/unit/**/*.spec.js',
functional: 'test/functional/**/*.spec.js'
}
this._ignoreTests = Env.get('IGNORE_TESTS', [])
this._filterCallback = null
Expand Down
8 changes: 4 additions & 4 deletions test/unit/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ test.group('Cli', (group) => {
})

test('set correct global for unit tests', (assert) => {
assert.equal(this.cli._testGroups.unit, 'test/unit/*.spec.js')
assert.equal(this.cli._testGroups.unit, 'test/unit/**/*.spec.js')
})

test('set correct global for functional tests', (assert) => {
assert.equal(this.cli._testGroups.functional, 'test/functional/*.spec.js')
assert.equal(this.cli._testGroups.functional, 'test/functional/**/*.spec.js')
})

test('set correct global for test files to be ignored', (assert) => {
Expand Down Expand Up @@ -61,13 +61,13 @@ test.group('Cli', (group) => {

test('set proper glob for loading tests', (assert) => {
const glob = this.cli._getGlob([this.cli._testGroups.unit])
assert.deepEqual(glob, [path.join(this.helpers.appRoot(), 'test/unit/*.spec.js')])
assert.deepEqual(glob, [path.join(this.helpers.appRoot(), 'test/unit/**/*.spec.js')])
})

test('exclude tests using glob', (assert) => {
const glob = this.cli._getGlob([this.cli._testGroups.unit], ['test/unit/_skip.spec.js'])
assert.deepEqual(glob, [
path.join(this.helpers.appRoot(), 'test/unit/*.spec.js'),
path.join(this.helpers.appRoot(), 'test/unit/**/*.spec.js'),
`!${path.join(this.helpers.appRoot(), 'test/unit/_skip.spec.js')}`
])
})
Expand Down

0 comments on commit cce2055

Please sign in to comment.