From d16d8bf43aa90b185bf5fe8a40a41d4d7faf1384 Mon Sep 17 00:00:00 2001 From: artem-zakharchenko Date: Thu, 11 Jul 2019 10:53:04 +0200 Subject: [PATCH] test: removes unused Cucumber world utils --- test/cucumber/support/world.js | 63 ---------------------------------- 1 file changed, 63 deletions(-) diff --git a/test/cucumber/support/world.js b/test/cucumber/support/world.js index c02e9a6b..8082f9f1 100644 --- a/test/cucumber/support/world.js +++ b/test/cucumber/support/world.js @@ -41,69 +41,6 @@ class World { this.componentResults = null; } - expectBlockEval(block, expectedReturn, callback) { - const realOutput = this.safeEval(block, callback); - - // I'm terribly sorry, but curly braces not asigned to any - // variable in evaled string are interpreted as code block - // not an Object literal, so I'm wrapping expected code output - // with brackets. - // see: http://stackoverflow.com/questions/8949274/javascript-calling-eval-on-an-object-literal-with-functions - - const expectedOutput = this.safeEval(`(${expectedReturn})`, callback); - - const realOutputInspect = util.inspect(realOutput); - const expectedOutputInspect = util.inspect(expectedOutput); - - try { - assert.deepEqual(realOutput, expectedOutput); - } catch (error) { - callback( - new Error( - 'Output of code buffer does not equal. Expected output:\n' + - expectedOutputInspect + - '\nbut got: \n' + - realOutputInspect + - '\n' + - 'Evaled code block:' + - '\n' + - '- - - \n' + - block + - '\n' + - '- - - ' - ) - ); - } - return callback(); - } - - safeEval(code, callback) { - // I'm terribly sorry, it's no longer possible to manipulate module require/load - // path inside node's process. So I'm prefixing require path by hard - // substitution in code to pretend to 'hit' is packaged module. - // - // further reading on node.js load paths: - // http://nodejs.org/docs/v0.8.23/api/all.html#all_all_together - - const formattedCode = code.replace( - `require('gavel`, - `require('../../../lib` - ); - - try { - return eval(formattedCode); - } catch (error) { - return callback( - new Error( - 'Eval failed. Code buffer: \n\n' + - formattedCode + - '\nWith error: ' + - error - ) - ); - } - } - executeCommands(commands) { const commandsBuffer = commands.join(';'); const cmd =