feat(component-testing): Expose CT through CLI module API (#16368)

* Added testingType CLI module option

* Removed isComponentTesting custom arg and replaced with testingType

* Added default value to docstring

* Removed mutating of args

* Added Module API manual testing docs
This commit is contained in:
Adam Gastineau
2021-05-07 09:44:15 -07:00
committed by GitHub
parent 3f31f09448
commit b8527a2a7f
11 changed files with 137 additions and 29 deletions
+22
View File
@@ -122,5 +122,27 @@ describe('exec open', function () {
expect(spawn.start).to.be.calledWith([])
})
})
it('spawns without --testing-type when not specified', () => {
return open.start().then(() => {
expect(spawn.start).to.be.calledWith([])
})
})
it('spawns with --testing-type e2e', () => {
return open.start({ testingType: 'e2e' }).then(() => {
expect(spawn.start).to.be.calledWith(['--testing-type', 'e2e'])
})
})
it('spawns with --testing-type component', () => {
return open.start({ testingType: 'component' }).then(() => {
expect(spawn.start).to.be.calledWith(['--testing-type', 'component'])
})
})
it('throws if --testing-type is invalid', () => {
expect(() => open.start({ testingType: 'randomTestingType' })).to.throw()
})
})
})
+22
View File
@@ -82,6 +82,28 @@ describe('exec run', function () {
snapshot(args)
})
it('defaults to e2e testingType', () => {
const args = run.processRunOptions()
snapshot(args)
})
it('passes e2e testingType', () => {
expect(run.processRunOptions({ testingType: 'e2e' })).to.deep.eq([
'--run-project', undefined, '--testing-type', 'e2e',
])
})
it('passes component testingType', () => {
expect(run.processRunOptions({ testingType: 'component' })).to.deep.eq([
'--run-project', undefined, '--testing-type', 'component',
])
})
it('throws if testingType is invalid', () => {
expect(() => run.processRunOptions({ testingType: 'randomTestingType' })).to.throw()
})
})
context('.start', function () {