I have a function written in coffeescript that goes like this:
_skip_version = (currentVersion, skippedVersions) ->
if (currentVersion.indexOf(skippedVersions) == -1)
return false
return true
This function is currently located in my archive.spec.coffee
file and is being used as follows:
if (_skip_version(config.version, version))
this.skip 'Skipping test - Not supported on this version'
Now, I want to use the _skip_version
function in other files, so keeping it in archive.spec.coffee
doesn't seem appropriate. I decided to move it to helpers.coffee
. After copying the function to the new file, I added helpers = require('./helpers')
in the archive.spec.coffee
file. However, when I try to call it like this:
if (helpers._skip_version(s3.config.clevOsVersion, version))
this.skip 'Skipping test - Not supported on this version'
I encounter the following error:
TypeError: helpers._skip_version is not a function
What could I have done wrong?
Below is my hooks.coffee
file for reference:
AWS = null
global = null
// Rest of the code in hooks.coffee remains unchanged...