summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-07-26 20:05:44 +0800
committerGitHub <noreply@github.com>2021-07-26 14:05:44 +0200
commitb2fcd3d01458072265e5ce9bfe9e8ed34fe4c00b (patch)
tree5e43726d056f35bd9e819f2cb0028e3c5fa5c570 /cli/tests
parent9e89fe2fe8061378d2e0d1371f17c5ccc4a351f3 (diff)
fix(cli): side-load test modules (#11515)
This fixes a regression introduced in 1.9 where test modules became main modules by side loading them in a generated module.
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/test_tests.rs6
-rw-r--r--cli/tests/test/meta.out7
-rw-r--r--cli/tests/test/meta.ts2
3 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 64ad29e22..1f9df3fd5 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -19,6 +19,12 @@ fn no_color() {
assert!(out.contains("test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out"));
}
+itest!(meta {
+ args: "test test/meta.ts",
+ exit_code: 0,
+ output: "test/meta.out",
+});
+
itest!(pass {
args: "test test/pass.ts",
exit_code: 0,
diff --git a/cli/tests/test/meta.out b/cli/tests/test/meta.out
new file mode 100644
index 000000000..a8c7acd63
--- /dev/null
+++ b/cli/tests/test/meta.out
@@ -0,0 +1,7 @@
+Check [WILDCARD]/test/meta.ts
+import.meta.main: false
+import.meta.url: [WILDCARD]/test/meta.ts
+running 0 tests from [WILDCARD]/test/meta.ts
+
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
+
diff --git a/cli/tests/test/meta.ts b/cli/tests/test/meta.ts
new file mode 100644
index 000000000..e32fdeea6
--- /dev/null
+++ b/cli/tests/test/meta.ts
@@ -0,0 +1,2 @@
+console.log("import.meta.main: %s", import.meta.main);
+console.log("import.meta.url: %s", import.meta.url);