API Docs for: 0.0.9
Show:

Dalek.Config Class

Module: DalekJS

Parses config data & loads config files for DalekJS tests.

This module is a driver plugin for DalekJS. It connects Daleks testsuite with the remote testing environment of Sauce Labs.

The driver can be installed with the following command:

$ npm install dalek-driver-sauce --save-dev

You can use the driver by adding a config option to the your Dalekfile

"driver": ["sauce"]

Or you can tell Dalek that it should run your tests via sauces service via the command line:

$ dalek mytest.js -d sauce

In order to run your tests within the Sauce Labs infrastructure, you must add your sauce username & key to your dalek configuration. Those two parameters must be set in order to get this driver up & running. You can specifiy them within your Dalekfile like so:

"driver.sauce": {
  "user": "dalekjs",
  "key": "aaaaaa-1234-567a-1abc-1br6d9f68689"
}

It is also possible to specify a set of other extra saucy parameters like name & tags:

"driver.sauce": {
  "user": "dalekjs",
  "key": "aaaaaa-1234-567a-1abc-1br6d9f68689",
  "name": "Guineapig",
  "tags": ["dalek", "testproject"]
}

If you would like to have a more control over the browser/OS combinations that are available, you are able to configure you custom combinations:

"browsers": [{
  "chrome": {
    "platform": "OS X 10.6",
    "actAs": "chrome",
    "version": 27
  },
  "chromeWin": {
    "platform": "Windows 7",
    "actAs": "chrome",
    "version": 27
  },
  "chromeLinux": {
    "platform": "Linux",
    "actAs": "chrome",
    "version": 26
  }

You can then call your custom browsers like so:

$ dalek mytest.js -d sauce -b chrome,chromeWin,chromeLinux

or you can define them in your Dalekfile:

"browser": ["chrome", "chromeWin", "chromeLinux"]

A list of all available browser/OS combinations, can be found here.

Methods

_checkDefaultFile

(
  • ext
  • data
)
String private

Iterator function that checks the existance of a the default file

Parameters:

  • ext String

    File extension to check

  • data Object

    File data

Returns:

String:

config File path

_checkFile

(
  • previousValue
  • ext
  • idx
  • data
)
String private

Iterator function that checks the existance of a given file

Parameters:

  • previousValue String

    Last iterations result

  • ext String

    File extension to check

  • idx Integer

    Iteration index

  • data Object

    File data

Returns:

String:

config File path

_verify

(
  • check
  • fn
  • instance
)
Array private

Verifies if a driver is given, exists & is valid

Parameters:

  • check Array

    Data that should be mapped

  • fn String

    Name of the function that should be invoked on the veryify object

  • instance Object

    Object instance where the verify function should be invoked

Returns:

Array:

data List of verified items

_verifyIterator

(
  • fn
  • instance
  • elm
)
String | Null

Verifies if a driver is given, exists & is valid

Parameters:

  • fn String

    Name of the function that should be invoked on the veryify object

  • instance Object

    Object instance where the verify function should be invoked

  • elm String

    Name of the element that should be checked

Returns:

String | Null:

element name of the verified element or false if checked failed

checkAvailabilityOfConfigFile

(
  • pathname
)
String

Checks if a config file is available

Parameters:

  • pathname String

Returns:

String:

config File path

get

(
  • item
)
Mixed | Null

Fetches & returns a config item

Parameters:

  • item String

    Key of the item to load

Returns:

Mixed | Null:

data Requested config data

load

(
  • defaults
  • pathname
  • opts
)
Object

Loads a file & merges the results with the commandline options & the default config

Parameters:

  • defaults Object

    Default config

  • pathname String

    Filename of the config file to load

  • opts Object

    Command line options

Returns:

Object:

config Merged config data

loadFile

(
  • pathname
)
Object

Loads a config file & parses it based on the file extension

Parameters:

  • pathname String

    Filename of the config file to load

Returns:

Object:

data Config data

readcoffee

() Object

Loads a coffescript config file

Returns:

Object:

data Parsed config data

readjs

() Object

Loads a javascript config file

Returns:

Object:

data Parsed config data

readjson

() Object

Loads a json config file

Returns:

Object:

data Parsed config data

readJson5

() Object

Loads a json5 config file

Returns:

Object:

data Parsed config data

readyaml

() Object

Loads a yaml config file

Returns:

Object:

data Parsed config data

verifyDrivers

() Array

Verifies if a driver is given, exists & is valid

Returns:

Array:

data List of verified drivers

verifyReporters

() Array

Verifies if a reporter is given, exists & is valid

Returns:

Array:

data List of verified reporters