From 62450a3ef33e5f46aa517e47b581bc59d9e08e72 Mon Sep 17 00:00:00 2001 From: gintsgints Date: Sun, 28 Sep 2014 12:33:35 +0300 Subject: [PATCH] test(gen): use path.normalize to be winodows 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 #601 --- test/test-file-creation.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test-file-creation.js b/test/test-file-creation.js index 99f5c28f8..2fef6a3c9 100644 --- a/test/test-file-creation.js +++ b/test/test-file-creation.js @@ -42,20 +42,20 @@ describe('angular-fullstack generator', function () { * * @param {Array} expectedFiles - array of files * @param {Function} done - callback(error{Error}) - * @param {String} path - top level path to assert files at (optional) + * @param {String} topLevelPath - top level path to assert files at (optional) * @param {Array} skip - array of paths to skip/ignore (optional) * */ - function assertOnlyFiles(expectedFiles, done, path, skip) { - path = path || './'; + function assertOnlyFiles(expectedFiles, done, topLevelPath, skip) { + topLevelPath = topLevelPath || './'; skip = skip || ['node_modules', 'client/bower_components']; - recursiveReadDir(path, skip, function(err, actualFiles) { + recursiveReadDir(topLevelPath, skip, function(err, actualFiles) { if (err) { return done(err); } var files = actualFiles.concat(); expectedFiles.forEach(function(file, i) { - var index = files.indexOf(file); + var index = files.indexOf(path.normalize(file)); if (index >= 0) { files.splice(index, 1); } @@ -63,7 +63,7 @@ describe('angular-fullstack generator', function () { if (files.length !== 0) { err = new Error('unexpected files found'); - err.expected = ''; + err.expected = expectedFiles.join('\n'); err.actual = files.join('\n'); return done(err); }