new RunResult()
Methods
-
assertEqualsFileContent(file, expectedContent)
-
Assert that a file's content is the same as the given string
Parameters:
Name Type Description file
String path to a file
expectedContent
String the expected content of the file
Example
result.assertEqualsFileContent( 'data.js', 'const greeting = "Hello";\nexport default { greeting }' );
-
assertEqualsFileContent(pairs)
-
Assert that each file in an array of file-string pairs equals its corresponding string
Parameters:
Name Type Description pairs
Array an array of arrays, where each subarray is a [String, String] pair
Example
result.assertEqualsFileContent([ ['data.js', 'const greeting = "Hello";\nexport default { greeting }'], ['user.js', 'export default {\n name: 'Coleman',\n age: 0\n}'] ]);
-
assertFile(path)
-
Assert that a file exists
Parameters:
Name Type Description path
String path to a file
Example
result.assertFile('templates/user.hbs');
-
assertFile(paths)
-
Assert that each files in the array exists
Parameters:
Name Type Description paths
Array an array of paths to files
Example
result.assertFile(['templates/user.hbs', 'templates/user/edit.hbs']);
-
assertFileContent(file, reg)
-
Assert that a file's content matches a regex or string
Parameters:
Name Type Description file
String path to a file
reg
Regex | String regex / string that will be used to search the file
Example
result.assertFileContent('models/user.js', /App\.User = DS\.Model\.extend/); result.assertFileContent('models/user.js', 'App.User = DS.Model.extend');
-
assertFileContent(pairs)
-
Assert that each file in an array of file-regex pairs matches its corresponding regex
Parameters:
Name Type Description pairs
Array an array of arrays, where each subarray is a [String, RegExp] pair
Example
var arg = [ [ 'models/user.js', /App\.User = DS\.Model\.extend/ ], [ 'controllers/user.js', /App\.UserController = Ember\.ObjectController\.extend/ ] ] result.assertFileContent(arg);
-
assertJsonFileContent(filename, content)
-
Assert a JSON file contains the provided keys
Parameters:
Name Type Description filename
String content
Object An object of key/values the file should contains
-
assertNoFile(file)
-
Assert that a file doesn't exist
Parameters:
Name Type Description file
String path to a file
Example
result.assertNoFile('templates/user.hbs');
-
assertNoFile(pairs)
-
Assert that each of an array of files doesn't exist
Parameters:
Name Type Description pairs
Array an array of paths to files
Example
result.assertNoFile(['templates/user.hbs', 'templates/user/edit.hbs']);
-
assertNoFileContent(file, reg)
-
Assert that a file's content does not match a regex / string
Parameters:
Name Type Description file
String path to a file
reg
Regex | String regex / string that will be used to search the file
Example
result.assertNoFileContent('models/user.js', /App\.User = DS\.Model\.extend/); result.assertNoFileContent('models/user.js', 'App.User = DS.Model.extend');
-
assertNoFileContent(pairs)
-
Assert that each file in an array of file-regex pairs does not match its corresponding regex
Parameters:
Name Type Description pairs
Array an array of arrays, where each subarray is a [String, RegExp] pair var arg = [ [ 'models/user.js', /App.User \ DS.Model.extend/ ], [ 'controllers/user.js', /App.UserController = Ember.ObjectController.extend/ ] ] result.assertNoFileContent(arg);
-
assertNoJsonFileContent(filename, content)
-
Assert a JSON file does not contain the provided keys
Parameters:
Name Type Description filename
String content
Object An object of key/values the file should not contain
-
assertNoObjectContent(obj, content)
-
Assert an object does not contain the provided keys
Parameters:
Name Type Description obj
Object Object that should not match the given pattern
content
Object An object of key/values the object should not contain
-
assertObjectContent(obj, content)
-
Assert an object contains the provided keys
Parameters:
Name Type Description obj
Object Object that should match the given pattern
content
Object An object of key/values the object should contains
-
assertTextEqual(value, expected)
-
Assert that two strings are equal after standardization of newlines
Parameters:
Name Type Description value
String a string
expected
String the expected value of the string
Example
result.assertTextEqual('I have a yellow cat', 'I have a yellow cat');
-
cleanup() → {RunResult}
-
Deletes the test directory recursively.
-
create()
-
Create another RunContext reusing the settings. See helpers.create api
-
dumpFilenames() → {RunResult}
-
Prints every file from mem-fs
-
dumpFiles(…files) → {RunResult}
-
Prints files names and contents from mem-fs
Parameters:
Name Type Attributes Description files
string <repeatable> Files to print or empty for entire mem-fs
-
getSnapshot(filter) → {Object}
-
Return an object with fs changes.
Parameters:
Name Type Description filter
function parameter forwarded to mem-fs-editor#dump
Returns:
Object -
getStateSnapshot(filter) → {Object}
-
Return an object with filenames with state.
Parameters:
Name Type Description filter
function parameter forwarded to mem-fs-editor#dump
Returns:
Object -
restore() → {RunResult}
-
Reverts to old cwd.