Exemple #1
0
        public IEnumerable <ITestContainer> GetTestContainers(IVsProject project)
        {
            if (!project.IsTestProject(Guids.NodejsBaseProjectFactory))
            {
                if (EqtTrace.IsVerboseEnabled)
                {
                    EqtTrace.Verbose("TestContainerDiscoverer: Ignoring project {0} as it is not a Node.js project.", project.GetProjectName());
                }

                yield break;
            }

            string path;

            project.GetMkDocument(VSConstants.VSITEMID_ROOT, out path);

            if (_detectingChanges)
            {
                SaveModifiedFiles(project);
            }

            ProjectInfo projectInfo;

            if (!_knownProjects.TryGetValue(path, out projectInfo))
            {
                // Don't return any containers for projects we don't know about.
                yield break;
            }
            projectInfo.HasRequestedContainers = true;

            var latestWrite = project.GetProjectItemPaths().Aggregate(
                _lastWrite,
                (latest, filePath) =>
            {
                try
                {
                    var ft = File.GetLastWriteTimeUtc(filePath);
                    return((ft > latest) ? ft : latest);
                }
                catch (UnauthorizedAccessException)
                {
                }
                catch (ArgumentException)
                {
                }
                catch (IOException)
                {
                }
                return(latest);
            });

            var architecture = Architecture.X86;

            // TODO: Read the architecture from the project

            yield return(new TestContainer(this, path, latestWrite, architecture));
        }
        public IEnumerable <ITestContainer> GetTestContainers(IVsProject project)
        {
            if (!project.TryGetProjectPath(out var path))
            {
                yield break;
            }

            // No need to search for tests in not supported projects.
            if (!TypeScriptHelpers.IsSupportedTestProjectFile(path))
            {
                yield break;
            }

            if (this.detectingChanges)
            {
                this.SaveModifiedFiles(project);
            }

            if (!this.knownProjects.TryGetValue(path, out var projectInfo) || !TryGetProjectUnitTestProperties(projectInfo.Project, out _, out _))
            {
                // Don't return any containers for projects we don't know about or that we know that they are not configured for JavaScript unit tests.
                yield break;
            }
            projectInfo.HasRequestedContainers = true;

            var latestWrite = project.GetProjectItemPaths().Aggregate(
                this.lastWrite,
                (latest, filePath) =>
            {
                try
                {
                    var ft = File.GetLastWriteTimeUtc(filePath);
                    return((ft > latest) ? ft : latest);
                }
                catch (Exception exc) when(exc is UnauthorizedAccessException || exc is ArgumentException || exc is IOException)
                {
                }
                return(latest);
            });

            yield return(new TestContainer(this, path, latestWrite));
        }
        public IEnumerable <ITestContainer> GetTestContainers(IVsProject project)
        {
            if (ErrorHandler.Failed(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out var path)) || string.IsNullOrEmpty(path))
            {
                yield break;
            }

            if (this.detectingChanges)
            {
                this.SaveModifiedFiles(project);
            }

            if (!this.knownProjects.TryGetValue(path, out var projectInfo))
            {
                // Don't return any containers for projects we don't know about.
                yield break;
            }
            projectInfo.HasRequestedContainers = true;

            var latestWrite = project.GetProjectItemPaths().Aggregate(
                this.lastWrite,
                (latest, filePath) =>
            {
                try
                {
                    var ft = File.GetLastWriteTimeUtc(filePath);
                    return((ft > latest) ? ft : latest);
                }
                catch (Exception exc) when(exc is UnauthorizedAccessException || exc is ArgumentException || exc is IOException)
                {
                }
                return(latest);
            });

            yield return(new TestContainer(this, path, latestWrite));
        }
        public IEnumerable<ITestContainer> GetTestContainers(IVsProject project) {
            if (!project.IsTestProject(GuidList.guidPythonProjectGuid)) {
                if (EqtTrace.IsVerboseEnabled) {
                    EqtTrace.Verbose("TestContainerDiscoverer: Ignoring project {0} as it is not a test project.", project.GetProjectName());
                }

                yield break;
            }

            string path;
            project.GetMkDocument(VSConstants.VSITEMID_ROOT, out path);

            if (_detectingChanges) {
                SaveModifiedFiles(project);
            }

            ProjectInfo projectInfo;
            if (!_knownProjects.TryGetValue(path, out projectInfo)) {
                // Don't return any containers for projects we don't know about.
                yield break;
            }
            projectInfo.HasRequestedContainers = true;
            
            var latestWrite = project.GetProjectItemPaths().Aggregate(
                _lastWrite,
                (latest, filePath) => {
                    try {
                        var ft = File.GetLastWriteTimeUtc(filePath);
                        return (ft > latest) ? ft : latest;
                    } catch (UnauthorizedAccessException) {
                    } catch (ArgumentException) {
                    } catch (IOException) {
                    }
                    return latest;
                });
            
            var architecture = Architecture.X86;
            // TODO: Read the architecture from the project

            yield return new TestContainer(this, path, latestWrite, architecture);
        }