Example #1
0
        public IEnumerable <PathInfo> FindScriptFiles(IEnumerable <string> testPaths, TestingMode testingMode)
        {
            if (testPaths == null)
            {
                yield break;
            }

            foreach (var path in testPaths)
            {
                var pathInfo = GetPathInfo(path);

                switch (pathInfo.Type)
                {
                case PathType.Url:
                    if (testingMode == TestingMode.HTML || testingMode == TestingMode.All)
                    {
                        yield return(pathInfo);
                    }
                    break;

                case PathType.Html:
                case PathType.JavaScript:
                case PathType.CoffeeScript:
                case PathType.TypeScript:
                case PathType.TypeScriptDef:
                    if (!testingMode.FileBelongsToTestingMode(path))
                    {
                        break;
                    }
                    yield return(pathInfo);

                    break;

                case PathType.Folder:
                    var query = from file in fileSystem.GetFiles(pathInfo.FullPath, "*.*", SearchOption.AllDirectories)
                                where !IsTemporaryChutzpahFile(file) && testingMode.FileBelongsToTestingMode(file)
                                select file;
                    foreach (var item in query)
                    {
                        yield return(GetPathInfo(item));
                    }

                    break;

                default:
                    ChutzpahTracer.TraceWarning("Ignoring unsupported test path '{0}'", path);
                    break;
                }
            }
        }
Example #2
0
        public IEnumerable<PathInfo> FindScriptFiles(IEnumerable<string> testPaths, TestingMode testingMode)
        {
            if (testPaths == null) yield break;

            foreach (var path in testPaths)
            {
                var pathInfo = GetPathInfo(path);

                switch (pathInfo.Type)
                {
                    case PathType.Url:
                        if (testingMode == TestingMode.HTML || testingMode == TestingMode.All)
                        {
                            yield return pathInfo;
                        }
                        break;
                    case PathType.Html:
                    case PathType.JavaScript:
                    case PathType.CoffeeScript:
                    case PathType.TypeScript:
                    case PathType.TypeScriptDef:
                        if (!testingMode.FileBelongsToTestingMode(path)) break;
                        yield return pathInfo;
                        break;
                    case PathType.Folder:
                        var query = from file in fileSystem.GetFiles(pathInfo.FullPath, "*.*", SearchOption.AllDirectories)
                                    where !IsTemporaryChutzpahFile(file) && testingMode.FileBelongsToTestingMode(file)
                                    select file;
                        foreach (var item in query)
                        {
                            yield return GetPathInfo(item);
                        }

                        break;
                }
            }
        }