Esempio n. 1
0
        public void NoFilesOk()
        {
            using (var fixture = new JSLintTaskFixture())
            {
                fixture.Instance.SourceDirectory = @"C:\Source\";

                var actual = fixture.Instance.Execute();

                I.Expect(actual).ToBeTrue();
            }
        }
Esempio n. 2
0
        public void NoErrorsOk()
        {
            using (var fixture = new JSLintTaskFixture())
            {
                fixture.Instance.SourceDirectory = @"Some Path";
                fixture.AddFile("file1.js", TaskResources.GlobalVariableDef);

                var actual = fixture.Instance.Execute();

                I.Expect(actual).ToBeTrue();
            }
        }
Esempio n. 3
0
        public void OneErrorFail()
        {
            using (var fixture = new JSLintTaskFixture())
            {
                fixture.Instance.SourceDirectory = @"D:\Solution\Project Dir";
                fixture.AddFile("startup.js", TaskResources.WindowGlobalStrict);

                var actual = fixture.Instance.Execute();

                I.Expect(fixture.Instance.ErrorCount).ToBe(1);
                I.Expect(actual).ToBeFalse();
            }
        }
Esempio n. 4
0
        public void ManyErrorsFail()
        {
            using (var fixture = new JSLintTaskFixture())
            {
                fixture.Instance.SourceDirectory = @"D:\Solution\Project Dir";
                fixture.AddFile("first.js", TaskResources.WindowGlobalStrict);
                fixture.AddFile("second.js", TaskResources.AmdNoStrict);

                var actual = fixture.Instance.Execute();

                I.Expect(fixture.Instance.ErrorCount).ToBe(3);
                I.Expect(actual).ToBeFalse();
            }
        }
Esempio n. 5
0
        public void CorrectLineColumn()
        {
            using (var fixture = new JSLintTaskFixture())
            {
                fixture.Instance.SourceDirectory = "Some Path";
                fixture.AddFile("file1.js", TaskResources.WindowGlobalStrict);

                var actual = fixture.Instance.Execute();
                var firstError = fixture.BuildEngine.ErrorEvents[0];

                Assert.False(actual);
                Assert.Equal(3, firstError.LineNumber);
                Assert.Equal(14, firstError.ColumnNumber);
            }
        }
Esempio n. 6
0
        public void TaskErrors()
        {
            using (var fixture = new JSLintTaskFixture())
            {
                fixture.Instance.SourceDirectory = @"\\SHARE\path\";
                fixture.AddFile("first.js", TaskResources.WindowGlobalStrict);
                fixture.AddFile("second.js", TaskResources.AmdNoStrict);

                fixture.Instance.Execute();

                I.Expect(fixture.BuildEngine.ErrorEvents.Count).ToBe(3);
                I.Expect(fixture.BuildEngine.WarningEvents.Count).ToBe(0);
                I.Expect(fixture.BuildEngine.MessageEvents.Count).ToBe(0);
            }
        }
Esempio n. 7
0
        public void WarningsOk()
        {
            using (var fixture = new JSLintTaskFixture())
            {
                fixture.Instance.SourceDirectory = @"Z:\Funky Path\repo-of-doom";
                fixture.AddFile("JSLintNet.json", TaskResources.WarningSettings);
                fixture.AddFile("second.js", TaskResources.AmdNoStrict);

                var actual = fixture.Instance.Execute();

                I.Expect(fixture.Instance.ErrorCount).ToBeGreaterThan(0);
                I.Expect(actual).ToBeTrue();
            }
        }