From fa65e49bc689b2b84a3fa2dd123fa616f430f7fe Mon Sep 17 00:00:00 2001 From: Yusuke Tanaka Date: Mon, 31 Aug 2020 20:53:42 +0900 Subject: feat(lint): Add support for reading input from stdin (#7263) --- cli/tests/integration_tests.rs | 14 ++++++++++++++ cli/tests/lint/expected_from_stdin.out | 2 ++ cli/tests/lint/expected_from_stdin_json.out | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 cli/tests/lint/expected_from_stdin.out create mode 100644 cli/tests/lint/expected_from_stdin_json.out (limited to 'cli/tests') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index c0dcdb606..bf532e404 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2253,6 +2253,20 @@ itest!(deno_lint_glob { exit_code: 1, }); +itest!(deno_lint_from_stdin { + args: "lint --unstable -", + input: Some("let a: any;"), + output: "lint/expected_from_stdin.out", + exit_code: 1, +}); + +itest!(deno_lint_from_stdin_json { + args: "lint --unstable --json -", + input: Some("let a: any;"), + output: "lint/expected_from_stdin_json.out", + exit_code: 1, +}); + itest!(deno_doc_builtin { args: "doc", output: "deno_doc_builtin.out", diff --git a/cli/tests/lint/expected_from_stdin.out b/cli/tests/lint/expected_from_stdin.out new file mode 100644 index 000000000..02b9d917c --- /dev/null +++ b/cli/tests/lint/expected_from_stdin.out @@ -0,0 +1,2 @@ +[WILDCARD] +Found 1 problem diff --git a/cli/tests/lint/expected_from_stdin_json.out b/cli/tests/lint/expected_from_stdin_json.out new file mode 100644 index 000000000..bec566841 --- /dev/null +++ b/cli/tests/lint/expected_from_stdin_json.out @@ -0,0 +1,16 @@ +{ + "diagnostics": [ + { + "location": { + "line": 1, + "col": 7 + }, + "filename": "_stdin.ts", + "message": "`any` type is not allowed", + "code": "no-explicit-any", + "line_src": "let a: any;", + "snippet_length": 3 + } + ], + "errors": [] +} -- cgit v1.2.3