summaryrefslogtreecommitdiff
path: root/tests/integration/run_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-25 09:07:59 -0400
committerGitHub <noreply@github.com>2024-07-25 09:07:59 -0400
commit763f05e74dfd0032b238603f625893a52e363591 (patch)
treec6a71559472755919358afa53eecac206cad80a9 /tests/integration/run_tests.rs
parentef78d317f084ffe633253acd138a48a425113fa7 (diff)
fix(unstable): move sloppy-import warnings to lint rule (#24710)
Adds a new `no-sloppy-imports` lint rule and cleans up the lint code. Closes #22844 Closes https://github.com/denoland/deno_lint/issues/1293
Diffstat (limited to 'tests/integration/run_tests.rs')
-rw-r--r--tests/integration/run_tests.rs80
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs
index 73d98aff5..7a6ee61cf 100644
--- a/tests/integration/run_tests.rs
+++ b/tests/integration/run_tests.rs
@@ -4851,86 +4851,6 @@ itest!(unsafe_proto_flag {
exit_code: 0,
});
-#[test]
-fn test_unstable_sloppy_imports() {
- let context = TestContextBuilder::new().use_temp_cwd().build();
- let temp_dir = context.temp_dir();
- temp_dir.write("a.ts", "export class A {}");
- temp_dir.write("b.js", "export class B {}");
- temp_dir.write("c.mts", "export class C {}");
- temp_dir.write("d.mjs", "export class D {}");
- temp_dir.write("e.tsx", "export class E {}");
- temp_dir.write("f.jsx", "export class F {}");
- let dir = temp_dir.path().join("dir");
- dir.create_dir_all();
- dir.join("index.tsx").write("export class G {}");
- temp_dir.write(
- "main.ts",
- r#"import * as a from "./a.js";
-import * as b from "./b";
-import * as c from "./c";
-import * as d from "./d";
-import * as e from "./e";
-import * as e2 from "./e.js";
-import * as f from "./f";
-import * as g from "./dir";
-console.log(a.A);
-console.log(b.B);
-console.log(c.C);
-console.log(d.D);
-console.log(e.E);
-console.log(e2.E);
-console.log(f.F);
-console.log(g.G);
-"#,
- );
-
- // run without sloppy imports
- context
- .new_command()
- .args("run main.ts")
- .run()
- .assert_matches_text(r#"error: Module not found "file:///[WILDCARD]/a.js". Maybe change the extension to '.ts' or run with --unstable-sloppy-imports
- at file:///[WILDCARD]/main.ts:1:20
-"#)
- .assert_exit_code(1);
-
- // now run with sloppy imports
- temp_dir.write("deno.json", r#"{ "unstable": ["sloppy-imports"] }"#);
- context
- .new_command()
- .args("run main.ts")
- .run()
- .assert_matches_text(
- "Warning Sloppy imports are not recommended and have a negative impact on performance.
-Warning Sloppy module resolution (hint: update .js extension to .ts)
- at file:///[WILDCARD]/main.ts:1:20
-Warning Sloppy module resolution (hint: add .js extension)
- at file:///[WILDCARD]/main.ts:2:20
-Warning Sloppy module resolution (hint: add .mts extension)
- at file:///[WILDCARD]/main.ts:3:20
-Warning Sloppy module resolution (hint: add .mjs extension)
- at file:///[WILDCARD]/main.ts:4:20
-Warning Sloppy module resolution (hint: add .tsx extension)
- at file:///[WILDCARD]/main.ts:5:20
-Warning Sloppy module resolution (hint: update .js extension to .tsx)
- at file:///[WILDCARD]/main.ts:6:21
-Warning Sloppy module resolution (hint: add .jsx extension)
- at file:///[WILDCARD]/main.ts:7:20
-Warning Sloppy module resolution (hint: specify path to index.tsx file in directory instead)
- at file:///[WILDCARD]/main.ts:8:20
-[class A]
-[class B]
-[class C]
-[class D]
-[class E]
-[class E]
-[class F]
-[class G]
-",
- );
-}
-
itest!(unstable_temporal_api {
args: "run --no-config --unstable-temporal --check run/unstable_temporal_api/main.ts",
output: "run/unstable_temporal_api/main.out",