How to use globals in Cucumber?


#1

I’m trying to define a file products.js that will just contain nothing but my test data:

testData = {}
testData.products = [
  // ...
];

The problem is, my methods in fixtures.js can’t see this variable for some reason. How do I make it global across all JS files in Cucumber?


#2

You need to assign it to the global variable: global.testData = {}. The Cucumber tests run in a node.js environment and not in a Meteor environment :wink:


#3

Ah, excellent! Thank you :slight_smile: