Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Apr 24, 2024
1 parent 8c19194 commit 6b636a5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
14 changes: 11 additions & 3 deletions tests/integration/run_tests.rs
Expand Up @@ -1694,14 +1694,22 @@ fn type_directives_js_main() {
assert_not_contains!(output.combined_output(), "type_reference.d.ts");
}

itest!(test_import_assertions {
args: "run --reload run/deno_import_assertions.ts",
output: "run/deno_import_assertions.ts.out",
});

// TODO(petamoriken): Need to quit TypeScript transpiling `assert` to `with` in deno_ast
#[test]
fn test_deno_futures_env() {
fn test_import_assertions_with_deno_futures_env() {
let context = TestContextBuilder::new().add_future_env_vars().build();
let output = context
.new_command()
.args("run --quiet --reload run/deno_futures_env.ts")
.args("run --quiet --reload run/deno_import_assertions.ts")
.run();
output.assert_exit_code(0);
output
.assert_exit_code(1)
.assert_matches_file("run/deno_import_assertions.ts.out2");
}

itest!(type_directives_redirect {
Expand Down
3 changes: 0 additions & 3 deletions tests/testdata/run/deno_futures_env.ts

This file was deleted.

3 changes: 3 additions & 0 deletions tests/testdata/run/deno_import_assertions.json
@@ -0,0 +1,3 @@
{
"foo": "foo"
}
2 changes: 2 additions & 0 deletions tests/testdata/run/deno_import_assertions.ts
@@ -0,0 +1,2 @@
import foo from "./deno_import_assertions.json" assert { type: "json" };
console.log(foo);
1 change: 1 addition & 0 deletions tests/testdata/run/deno_import_assertions.ts.out
@@ -0,0 +1 @@
{ foo: "foo" }
4 changes: 4 additions & 0 deletions tests/testdata/run/deno_import_assertions.ts.out2
@@ -0,0 +1,4 @@
error: Uncaught SyntaxError: Unexpected identifier 'assert'
import foo from "./deno_import_assertions.json" assert { type: "json" };
^
at <anonymous> (file:///[WILDCARD]/deno_import_assertions.js:[WILDCARD])

0 comments on commit 6b636a5

Please sign in to comment.