Skip to content

Commit 8c9f0f9

Browse files
gintsgintsDaftMonk
authored andcommitted
test(gen): use path.normalize to be windows aware
- change function assertOnlyFiles to use a different local variable from global module name - path. - show expected files when a test fails - use path.normalize before search in the array Closes angular-fullstack#601
1 parent f29e907 commit 8c9f0f9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: test/test-file-creation.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,28 @@ describe('angular-fullstack generator', function () {
4242
*
4343
* @param {Array} expectedFiles - array of files
4444
* @param {Function} done - callback(error{Error})
45-
* @param {String} path - top level path to assert files at (optional)
45+
* @param {String} topLevelPath - top level path to assert files at (optional)
4646
* @param {Array} skip - array of paths to skip/ignore (optional)
4747
*
4848
*/
49-
function assertOnlyFiles(expectedFiles, done, path, skip) {
50-
path = path || './';
49+
function assertOnlyFiles(expectedFiles, done, topLevelPath, skip) {
50+
topLevelPath = topLevelPath || './';
5151
skip = skip || ['node_modules', 'client/bower_components'];
5252

53-
recursiveReadDir(path, skip, function(err, actualFiles) {
53+
recursiveReadDir(topLevelPath, skip, function(err, actualFiles) {
5454
if (err) { return done(err); }
5555
var files = actualFiles.concat();
5656

5757
expectedFiles.forEach(function(file, i) {
58-
var index = files.indexOf(file);
58+
var index = files.indexOf(path.normalize(file));
5959
if (index >= 0) {
6060
files.splice(index, 1);
6161
}
6262
});
6363

6464
if (files.length !== 0) {
6565
err = new Error('unexpected files found');
66-
err.expected = '';
66+
err.expected = expectedFiles.join('\n');
6767
err.actual = files.join('\n');
6868
return done(err);
6969
}

0 commit comments

Comments
 (0)