Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Deprecate eval itests #25382

Merged
merged 14 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions tests/integration/eval_tests.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use test_util as util;
use test_util::itest;

#[test]
fn eval_p() {
let output = util::deno_cmd()
.arg("eval")
.arg("-p")
.arg("1+2")
.stdout_piped()
.spawn()
.unwrap()
.wait_with_output()
.unwrap();
assert!(output.status.success());
let stdout_str =
util::strip_ansi_codes(std::str::from_utf8(&output.stdout).unwrap().trim());
assert_eq!("3", stdout_str);
}

// Make sure that snapshot flags don't affect runtime.
#[test]
Expand All @@ -43,48 +25,3 @@ fn eval_randomness() {
numbers.dedup();
assert!(numbers.len() > 1);
}

itest!(eval_basic {
args: "eval console.log(\"hello\")",
output_str: Some("hello\n"),
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ./tools/lint.js needs to be updated to have the new number though. Probably linting will fail on the ci


// Ugly parentheses due to whitespace delimiting problem.
itest!(eval_ts {
args: "eval --quiet --ext=ts console.log((123)as(number))", // 'as' is a TS keyword only
output_str: Some("123\n"),
});

itest!(dyn_import_eval {
args: "eval import('./subdir/mod4.js').then(console.log)",
output: "eval/dyn_import_eval.out",
});

// Cannot write the expression to evaluate as "console.log(typeof gc)"
// because itest! splits args on whitespace.
itest!(v8_flags_eval {
args: "eval --v8-flags=--expose-gc console.log(typeof(gc))",
output: "run/v8_flags.js.out",
});

itest!(check_local_by_default {
args: "eval --quiet import('http://localhost:4545/subdir/type_error.ts').then(console.log);",
output: "eval/check_local_by_default.out",
http_server: true,
});

itest!(check_local_by_default2 {
args: "eval --quiet import('./eval/check_local_by_default2.ts').then(console.log);",
output: "eval/check_local_by_default2.out",
http_server: true,
});

itest!(env_file {
args: "eval --env=env console.log(Deno.env.get(\"ANOTHER_FOO\"))",
output_str: Some("ANOTHER_BAR\n"),
});

itest!(env_file_missing {
args: "eval --env=missing console.log(Deno.env.get(\"ANOTHER_FOO\"))",
output: "eval/env_file_missing.out",
});
4 changes: 4 additions & 0 deletions tests/specs/eval/check_local/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval --quiet import('http://localhost:4545/subdir/type_error.ts').then(console.log);",
"output": "main.out"
}
4 changes: 4 additions & 0 deletions tests/specs/eval/check_local_by_default2/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval --quiet import('./check_local_by_default2.ts').then(console.log);",
"output": "main.out"
}
4 changes: 4 additions & 0 deletions tests/specs/eval/dyn_import_eval/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval import('./mod4.js').then(console.log)",
"output": "main.out"
}
1 change: 1 addition & 0 deletions tests/specs/eval/dyn_import_eval/mod4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isMod4 = true;
4 changes: 4 additions & 0 deletions tests/specs/eval/env_file/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval --env=env console.log(Deno.env.get(\"Another_FOO\"))",
"output": "main.out"
}
4 changes: 4 additions & 0 deletions tests/specs/eval/env_file/env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FOO=BAR
ANOTHER_FOO=ANOTHER_${FOO}
MULTILINE="First Line
Second Line"
1 change: 1 addition & 0 deletions tests/specs/eval/env_file/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ANOTHER_BAR
4 changes: 4 additions & 0 deletions tests/specs/eval/env_file_missing/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval --env=missing console.log(Deno.env.get(\"Another_FOO\"))",
"output": "main.out"
}
2 changes: 1 addition & 1 deletion tests/specs/eval/env_unparsable_file/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"args": "eval --env=../../../testdata/env_unparsable console.log(Deno.env.get(\"Another_FOO\"))",
"args": "eval --env=env_unparsable console.log(Deno.env.get(\"Another_FOO\"))",
"output": "main.out"
}
4 changes: 4 additions & 0 deletions tests/specs/eval/env_unparsable_file/env_unparsable
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FOO=valid
ANOTHER_FOO=c:\path
MULTILINE="First Line
Second Line"
2 changes: 1 addition & 1 deletion tests/specs/eval/env_unparsable_file/main.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Warning Parsing failed within the specified environment file: ../../../testdata/env_unparsable at index: 3 of the value: c:\path
Warning Parsing failed within the specified environment file: env_unparsable at index: 3 of the value: c:\path
undefined
4 changes: 4 additions & 0 deletions tests/specs/eval/eval_basic/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval console.log(\"hello\")",
"output": "main.out"
}
1 change: 1 addition & 0 deletions tests/specs/eval/eval_basic/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello
4 changes: 4 additions & 0 deletions tests/specs/eval/eval_p/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval -p 1+2",
"output": "main.out"
}
1 change: 1 addition & 0 deletions tests/specs/eval/eval_p/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
4 changes: 4 additions & 0 deletions tests/specs/eval/eval_ts/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval --quiet --ext=ts console.log((123)as(number))",
"output": "main.out"
}
1 change: 1 addition & 0 deletions tests/specs/eval/eval_ts/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
123
4 changes: 4 additions & 0 deletions tests/specs/eval/v8_flags_eval/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "eval --v8-flags=--expose-gc console.log(typeof(gc))",
"output": "main.out"
}
1 change: 1 addition & 0 deletions tests/specs/eval/v8_flags_eval/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function
Loading