This repository was archived by the owner on Sep 21, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -106,13 +106,14 @@ module.exports = class SuiteCollection {
106106 }
107107
108108 _disableEntity ( obj , browser ) {
109- this . _originalBrowsers [ obj . fullName ] = obj . browsers ;
109+ this . _originalBrowsers [ obj . fullName + obj . file ] = obj . browsers ;
110110 obj . browsers = browser ? _ . without ( obj . browsers , browser ) : [ ] ;
111111 }
112112
113113 _enableEntity ( obj , browser ) {
114- if ( ! browser && this . _originalBrowsers [ obj . fullName ] ) {
115- obj . browsers = _ . union ( obj . browsers , this . _originalBrowsers [ obj . fullName ] ) ;
114+ const suiteKey = obj . fullName + obj . file ;
115+ if ( ! browser && this . _originalBrowsers [ suiteKey ] ) {
116+ obj . browsers = _ . union ( obj . browsers , this . _originalBrowsers [ suiteKey ] ) ;
116117 }
117118
118119 if ( browser ) {
Original file line number Diff line number Diff line change 22
33const proxyquire = require ( 'proxyquire' ) ;
44const mkTree = require ( '../util' ) . makeSuiteTree ;
5+ const mkSuite = require ( '../util' ) . makeSuiteStub ;
56
67describe ( 'suite-collection' , ( ) => {
78 const sandbox = sinon . sandbox . create ( ) ;
@@ -385,6 +386,26 @@ describe('suite-collection', () => {
385386 assert . deepEqual ( tree . child . browsers , [ 'b1' , 'b2' ] ) ;
386387 } ) ;
387388
389+ it ( 'should enable only current suite if there are the same suites exists in the tree' , ( ) => {
390+ const suite1 = mkSuite ( {
391+ name : 'suite' ,
392+ browsers : [ 'b1' , 'b2' ] ,
393+ file : 'some/path.js'
394+ } ) ;
395+ const suite2 = mkSuite ( {
396+ name : 'suite' ,
397+ browsers : [ 'b3' , 'b4' ] ,
398+ file : 'another/path.js'
399+ } ) ;
400+
401+ new SuiteCollection ( [ suite1 , suite2 ] )
402+ . disableAll ( )
403+ . enable ( suite1 ) ;
404+
405+ assert . deepEqual ( suite1 . browsers , [ 'b1' , 'b2' ] ) ;
406+ assert . deepEqual ( suite2 . browsers , [ ] ) ;
407+ } ) ;
408+
388409 it ( 'should fail on attempt to enable unknown suite' , ( ) => {
389410 const tree = mkTree ( {
390411 suite : [ ]
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ function makeSuiteStub(opts) {
4747 suite . addState ( state ) ;
4848 } ) ;
4949 suite . url = opts . url ;
50+ suite . file = opts . file ;
5051
5152 return suite ;
5253}
You can’t perform that action at this time.
0 commit comments