Support ignore scenarios
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/700cc68c Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/700cc68c Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/700cc68c Branch: refs/heads/TINKERPOP-1489 Commit: 700cc68cb8c6a342a5f65653f712aa9a38a7cb54 Parents: 4f432c6 Author: Jorge Bay Gondra <jorgebaygon...@gmail.com> Authored: Tue Nov 28 13:14:26 2017 +0100 Committer: Jorge Bay Gondra <jorgebaygon...@gmail.com> Committed: Wed Jan 17 16:16:21 2018 +0100 ---------------------------------------------------------------------- .../test/cucumber/feature-steps.js | 20 ++++++++++++++------ .../gremlin-javascript/test/cucumber/world.js | 4 +++- 2 files changed, 17 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/700cc68c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js ---------------------------------------------------------------------- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js index 99e2ec8..06a3283 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js @@ -52,8 +52,20 @@ const parsers = [ [ 'c\\[(.+)\\]', toLambda ] ].map(x => [ new RegExp('^' + x[0] + '$'), x[1] ]); +const ignoreReason = { + lambdaNotSupported: 'Lambdas are not supported on gremlin-javascript', +}; + +const ignoredScenarios = { + // An associative array containing the scenario name as key, for example: + // 'g_V_branchXlabel_eq_person': new IgnoreError(ignoreReason.lambdaNotSupported), +}; + defineSupportCode(function(methods) { methods.Given(/^the (.+) graph$/, function (graphName) { + if (ignoredScenarios[this.scenario]) { + return 'skipped'; + } this.graphName = graphName; const data = this.getData(); this.g = new Graph().traversal().withRemote(data.connection); @@ -282,7 +294,7 @@ function parseMapValue(value) { } function toLambda() { - throw new IgnoreError(IgnoreError.reason.lambdaNotSupported); + throw new IgnoreError(ignoreReason.lambdaNotSupported); } /** @@ -310,8 +322,4 @@ function IgnoreError(reason) { Error.captureStackTrace(this, IgnoreError); } -util.inherits(IgnoreError, Error); - -IgnoreError.reason = { - lambdaNotSupported: 'Lambdas are not supported on gremlin-javascript', -}; \ No newline at end of file +util.inherits(IgnoreError, Error); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/700cc68c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js ---------------------------------------------------------------------- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js index 03febd1..ae3f9a6 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js @@ -33,6 +33,7 @@ defineSupportCode(function (methods) { const cache = {}; function TinkerPopWorld(){ + this.scenario = null; this.g = null; this.traversal = null; this.result = null; @@ -91,7 +92,8 @@ defineSupportCode(function (methods) { return Promise.all(Object.keys(cache).map(graphName => cache[graphName].connection.close())); }); - methods.Before(function () { + methods.Before(function (info) { + this.scenario = info.pickle.name; this.cache = cache; }); });