Function toSettings

Parses the content of a trial.json file into Settings

Settings toSettings(
  string json
);

Example

toSettings returns the default settings for an empty object

toSettings("{}").should.equal(Settings());

Example

toSettings returns the reporters ["tap", "xunit"] from the reporters key

toSettings(`{"reporters": ["tap", "xunit"]}`).reporters.should.equal(["tap", "xunit"]);

Example

toSettings returns the executor "parallel" from the executor key

toSettings(`{"executor": "parallel"}`).executor.should.equal("parallel");

Example

toSettings returns the maxThreads 4 from the maxThreads key

toSettings(`{"maxThreads": 4}`).maxThreads.should.equal(4u);

Example

toSettings returns artifactsLocation "out", warningTestDuration 5 and dangerTestDuration 50 from their keys

Settings expected;
expected.artifactsLocation = "out";
expected.warningTestDuration = 5;
expected.dangerTestDuration = 50;

toSettings(`{"artifactsLocation": "out", "warningTestDuration": 5, "dangerTestDuration": 50}`).should.equal(expected);