FixturesLoader

extensions/fixtures/FixturesLoader~ FixturesLoader

Fixtures loader extension.

Constructor

new FixturesLoader(fixturesDiropt)

Source:
Parameters:
Name Type Attributes Default Description
fixturesDir string <optional>
'fixtures' The name of the fixtures directory relative to feature

Methods

configure(fixturesDiropt)

Configures the loader
Source:
Parameters:
Name Type Attributes Default Description
fixturesDir string <optional>
'fixtures' The name of the fixtures directory relative to feature

load(fixture) → {Promise.<(Object|string)>}

Tries to load a fixture from current feature directory. Will search for the following file extensions: - yaml - yml - js - json - txt
Source:
Parameters:
Name Type Description
fixture string Fixture file name without extension
Returns:
Type:
Promise.<(Object|string)>
Fixture content

loadJson(file) → {Promise.<Object>}

Loads content from json file.
Source:
Parameters:
Name Type Description
file string File path
Returns:
Type:
Promise.<Object>
Json data

loadModule(file) → {Promise.<*>}

Loads content from javascript module.
Source:
Parameters:
Name Type Description
file string File path
Returns:
Type:
Promise.<*>
Data generated from the module

loadText(file) → {Promise.<string>}

Loads content from file.
Source:
Parameters:
Name Type Description
file string File path
Returns:
Type:
Promise.<string>
File content

loadYaml(file) → {Promise.<(Object|Array)>}

Loads content from yaml file.
Source:
Parameters:
Name Type Description
file string File path
Returns:
Type:
Promise.<(Object|Array)>
Parsed yaml data

reset()

Resets fixtures loader.
Source:

setFeatureUri(featureUri)

Sets feature uri, used to resolve fixtures files. When trying to load a fixture file the path will be comprised of: - feature uri - fixturesDir - fixture name
Source:
Parameters:
Name Type Description
featureUri string Feature uri