Skip to content

Commit

Permalink
Merge pull request #369 from hmanchev/libExclude
Browse files Browse the repository at this point in the history
feat: introduce libExclude in localUI5SpecResolver
  • Loading branch information
hmanchev authored Aug 1, 2022
2 parents 92615b6 + 3a58200 commit dc29942
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/localUI5SpecResolver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,16 @@ describe("LocalUI5SpecResolver", function () {
done();
});
});

it("Should exclude specs only with lib exclude", function(done) {
var specResolver = new LocalUI5SpecResolver(
{branch: 'overwrite',libExclude: 'sap.m'},{suiteRootPath: __dirname + '/localUI5SpecResolver'},logger);
specResolver.resolve().then(function(specs){
expect(specs.length).toEqual(1);
done();
}).catch(function(error){
fail(error);
done();
});
});
});
2 changes: 2 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var argv = require('yargs').
'confFile defaults to conf.js if presented in current working directory.').
string('libFilter').
describe('libFilter', 'Comma separated list of lib suites to execute, defaults to all').
string('libExclude').
describe('libExclude', 'Comma separated list of lib suites to exclude, defaults to nothing').
string('specFilter').
describe('specFilter', 'Comma separated list of specs to execute, defaults to all').
string('specExclude').
Expand Down
11 changes: 11 additions & 0 deletions src/resolver/localUI5SpecResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var CONTENT_ROOT_URI = 'test-resources';
* @type {Object}
* @property {string} baseUrl - base url to reference, falsy disables page loading, defaults to: 'http://localhost:8080'
* @property {string} libFilter - comma separated list of libraries, '*' means all, defaults to: '*'
* @property {string} libExclude - comma separated list of libraries, '' means nothing to be excluded
* @property {string} specFilter - comma separated list of spec names, '*' means all, defaults to '*'
* @property {string} specExclude - comma separated list of spec names, '' means nothing to be excluded
* @property {string} branch - branch, overwrites automatically derived by git
Expand Down Expand Up @@ -47,6 +48,7 @@ function LocalUI5SpecResolver(config,instanceConfig,logger){

this.baseUrl = config.baseUrl || BASE_URL;
this.libFilter = config.libFilter || '*';
this.libExclude = config.libExclude || '';
this.specFilter = config.specFilter || '*';
this.specExclude = config.specExclude || '';
this.suitesGlob = instanceConfig.suitesGlob || DEFAULT_SUITES_GLOB;
Expand Down Expand Up @@ -121,6 +123,9 @@ LocalUI5SpecResolver.prototype.resolve = function(){
//resolve lib filter
var libFilters = that.libFilter !== '*' ? that.libFilter.split(',') : [];

//resolve lib exclude
var libExclude = that.libExclude !== '' ? that.libExclude.split(',') : [];

// resolve specs from each suite
suitePaths.forEach(function (suitePath) {

Expand All @@ -144,6 +149,12 @@ LocalUI5SpecResolver.prototype.resolve = function(){
that.logger.debug('Drop lib: ' + libName + ' that does not match lib filter: ' + that.libFilter);
return;
}

// exclude lib filter
if(libExclude.length > 0 && that._isInArray(libExclude, libName)) {
that.logger.debug('Drop lib: ' + libName + ' that does match lib exclude: ' + that.libExclude);
return;
}

// resolve spec names from this suite
var specFileNames = [];
Expand Down

0 comments on commit dc29942

Please sign in to comment.