diff options
| author | David Sherret <dsherret@users.noreply.github.com> | 2024-02-19 10:28:41 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-19 15:28:41 +0000 |
| commit | 66424032a2c78c6010c0a1a1b22a26d081166660 (patch) | |
| tree | 610e95beba5685ef1ba322375bf31a3fd6c5a187 /tests/integration | |
| parent | 2b279ad630651e973d5a31586f58809f005bc925 (diff) | |
feat(unstable/lint): no-slow-types for JSR packages (#22430)
1. Renames zap/fast-check to instead be a `no-slow-types` lint rule.
1. This lint rule is automatically run when doing `deno lint` for
packages (deno.json files with a name, version, and exports field)
1. This lint rules still occurs on publish. It can be skipped by running
with `--no-slow-types`
Diffstat (limited to 'tests/integration')
| -rw-r--r-- | tests/integration/lint_tests.rs | 42 | ||||
| -rw-r--r-- | tests/integration/publish_tests.rs | 16 |
2 files changed, 51 insertions, 7 deletions
diff --git a/tests/integration/lint_tests.rs b/tests/integration/lint_tests.rs index f7c9ead36..ae0414262 100644 --- a/tests/integration/lint_tests.rs +++ b/tests/integration/lint_tests.rs @@ -210,3 +210,45 @@ fn lint_with_glob_config_and_flags() { assert_contains!(output, "Found 2 problems"); assert_contains!(output, "Checked 2 files"); } + +itest!(no_slow_types { + args: "lint", + output: "lint/no_slow_types/no_slow_types.out", + cwd: Some("lint/no_slow_types"), + exit_code: 1, +}); + +itest!(no_slow_types_entrypoint { + args: "lint a.ts", + output: "lint/no_slow_types/no_slow_types_entrypoint.out", + cwd: Some("lint/no_slow_types"), + exit_code: 1, +}); + +itest!(no_slow_types_non_entrypoint { + args: "lint d.ts", + output_str: Some("Checked 1 file\n"), + cwd: Some("lint/no_slow_types"), + exit_code: 0, +}); + +itest!(no_slow_types_excluded { + args: "lint --rules-exclude=no-slow-types", + output_str: Some("Checked 4 files\n"), + cwd: Some("lint/no_slow_types"), + exit_code: 0, +}); + +itest!(no_slow_types_non_package { + args: "lint --config=deno.non-package.json", + output_str: Some("Checked 4 files\n"), + cwd: Some("lint/no_slow_types"), + exit_code: 0, +}); + +itest!(no_slow_types_workspace { + args: "lint", + output: "lint/no_slow_types_workspace/output.out", + cwd: Some("lint/no_slow_types_workspace"), + exit_code: 1, +}); diff --git a/tests/integration/publish_tests.rs b/tests/integration/publish_tests.rs index b614005cc..48e62e905 100644 --- a/tests/integration/publish_tests.rs +++ b/tests/integration/publish_tests.rs @@ -22,17 +22,17 @@ itest!(missing_deno_json { exit_code: 1, }); -itest!(invalid_fast_check { +itest!(has_slow_types { args: "publish --token 'sadfasdf'", - output: "publish/invalid_fast_check.out", - cwd: Some("publish/invalid_fast_check"), + output: "publish/has_slow_types.out", + cwd: Some("publish/has_slow_types"), exit_code: 1, }); -itest!(no_zap { - args: "publish --no-zap --token 'sadfasdf'", - output: "publish/no_zap.out", - cwd: Some("publish/invalid_fast_check"), +itest!(allow_slow_types { + args: "publish --allow-slow-types --token 'sadfasdf'", + output: "publish/allow_slow_types.out", + cwd: Some("publish/has_slow_types"), envs: env_vars_for_jsr_tests(), http_server: true, exit_code: 0, @@ -83,7 +83,9 @@ fn publish_non_exported_files_using_import_map() { .new_command() .args("publish --log-level=debug --token 'sadfasdf'") .run(); + output.assert_exit_code(0); let lines = output.combined_output().split('\n').collect::<Vec<_>>(); + eprintln!("{}", output.combined_output()); assert!(lines .iter() .any(|l| l.contains("Unfurling") && l.ends_with("mod.ts"))); |
