summaryrefslogtreecommitdiff
path: root/tests/testdata/compile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testdata/compile')
-rw-r--r--tests/testdata/compile/args.ts3
-rw-r--r--tests/testdata/compile/check_local_by_default.ts3
-rw-r--r--tests/testdata/compile/check_local_by_default2.ts6
-rw-r--r--tests/testdata/compile/dynamic_imports/import1.ts3
-rw-r--r--tests/testdata/compile/dynamic_imports/import2.ts1
-rw-r--r--tests/testdata/compile/dynamic_imports/import_path1
-rw-r--r--tests/testdata/compile/dynamic_imports/main.out5
-rw-r--r--tests/testdata/compile/dynamic_imports/main.ts6
-rw-r--r--tests/testdata/compile/dynamic_imports/main_unanalyzable.ts18
-rw-r--r--tests/testdata/compile/dynamic_imports_tmp_lit/main.info.out10
-rw-r--r--tests/testdata/compile/dynamic_imports_tmp_lit/main.js14
-rw-r--r--tests/testdata/compile/dynamic_imports_tmp_lit/other/data.json3
-rw-r--r--tests/testdata/compile/dynamic_imports_tmp_lit/other/sub/data2.json3
-rw-r--r--tests/testdata/compile/dynamic_imports_tmp_lit/sub/a.js1
-rw-r--r--tests/testdata/compile/dynamic_imports_tmp_lit/sub/b.ts1
-rw-r--r--tests/testdata/compile/node_modules_symlink_outside/main.out2
-rw-r--r--tests/testdata/compile/node_modules_symlink_outside/main.ts6
-rw-r--r--tests/testdata/compile/node_modules_symlink_outside/main_compile_file.out2
-rw-r--r--tests/testdata/compile/node_modules_symlink_outside/main_compile_folder.out6
-rw-r--r--tests/testdata/compile/npm_fs/main.out1
-rw-r--r--tests/testdata/compile/npm_fs/main.ts259
-rw-r--r--tests/testdata/compile/standalone_error.ts9
-rw-r--r--tests/testdata/compile/standalone_error_module_with_imports_1.ts1
-rw-r--r--tests/testdata/compile/standalone_error_module_with_imports_2.ts2
-rw-r--r--tests/testdata/compile/standalone_follow_redirects.ts2
-rw-r--r--tests/testdata/compile/standalone_follow_redirects_2.js5
-rw-r--r--tests/testdata/compile/standalone_import_datauri.ts4
-rw-r--r--tests/testdata/compile/standalone_import_map.json5
-rw-r--r--tests/testdata/compile/standalone_import_map.ts1
-rw-r--r--tests/testdata/compile/standalone_import_map_config.json3
-rw-r--r--tests/testdata/compile/standalone_runtime_flags.ts3
-rw-r--r--tests/testdata/compile/unstable_features.ts2
-rw-r--r--tests/testdata/compile/vfs_implicit_read_permission/main.out8
-rw-r--r--tests/testdata/compile/vfs_implicit_read_permission/main.ts3
-rw-r--r--tests/testdata/compile/workers/basic.out5
-rw-r--r--tests/testdata/compile/workers/basic.ts11
-rw-r--r--tests/testdata/compile/workers/not_in_module_map.ts11
-rw-r--r--tests/testdata/compile/workers/worker.ts14
38 files changed, 443 insertions, 0 deletions
diff --git a/tests/testdata/compile/args.ts b/tests/testdata/compile/args.ts
new file mode 100644
index 000000000..ec41d52f9
--- /dev/null
+++ b/tests/testdata/compile/args.ts
@@ -0,0 +1,3 @@
+Deno.args.forEach((arg) => {
+ console.log(arg);
+});
diff --git a/tests/testdata/compile/check_local_by_default.ts b/tests/testdata/compile/check_local_by_default.ts
new file mode 100644
index 000000000..2ae8c2692
--- /dev/null
+++ b/tests/testdata/compile/check_local_by_default.ts
@@ -0,0 +1,3 @@
+import * as a from "http://localhost:4545/subdir/type_error.ts";
+
+console.log(a.a);
diff --git a/tests/testdata/compile/check_local_by_default2.ts b/tests/testdata/compile/check_local_by_default2.ts
new file mode 100644
index 000000000..5177ff944
--- /dev/null
+++ b/tests/testdata/compile/check_local_by_default2.ts
@@ -0,0 +1,6 @@
+import * as a from "http://localhost:4545/subdir/type_error.ts";
+
+const b: "b" = 12;
+
+console.log(a.a);
+console.log(b);
diff --git a/tests/testdata/compile/dynamic_imports/import1.ts b/tests/testdata/compile/dynamic_imports/import1.ts
new file mode 100644
index 000000000..2d9dde2a4
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports/import1.ts
@@ -0,0 +1,3 @@
+import "./import2.ts";
+
+console.log("import1.ts");
diff --git a/tests/testdata/compile/dynamic_imports/import2.ts b/tests/testdata/compile/dynamic_imports/import2.ts
new file mode 100644
index 000000000..22321a5a7
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports/import2.ts
@@ -0,0 +1 @@
+console.log("import2.ts");
diff --git a/tests/testdata/compile/dynamic_imports/import_path b/tests/testdata/compile/dynamic_imports/import_path
new file mode 100644
index 000000000..98222a208
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports/import_path
@@ -0,0 +1 @@
+./import1.ts
diff --git a/tests/testdata/compile/dynamic_imports/main.out b/tests/testdata/compile/dynamic_imports/main.out
new file mode 100644
index 000000000..4304fb06f
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports/main.out
@@ -0,0 +1,5 @@
+Starting the main module
+Dynamic importing
+import2.ts
+import1.ts
+Dynamic import done.
diff --git a/tests/testdata/compile/dynamic_imports/main.ts b/tests/testdata/compile/dynamic_imports/main.ts
new file mode 100644
index 000000000..b889e2203
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports/main.ts
@@ -0,0 +1,6 @@
+console.log("Starting the main module");
+
+setTimeout(() => {
+ console.log("Dynamic importing");
+ import("./import1.ts").then(() => console.log("Dynamic import done."));
+}, 0);
diff --git a/tests/testdata/compile/dynamic_imports/main_unanalyzable.ts b/tests/testdata/compile/dynamic_imports/main_unanalyzable.ts
new file mode 100644
index 000000000..7880fa4a6
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports/main_unanalyzable.ts
@@ -0,0 +1,18 @@
+import { join } from "../../../../test_util/std/path/mod.ts";
+
+console.log("Starting the main module");
+
+// We load the dynamic import path from the file system, to make sure any
+// improvements in static analysis can't defeat the purpose of this test, which
+// is to make sure the `--include` flag works to add non-analyzed imports to the
+// module graph.
+const IMPORT_PATH_FILE_PATH = join(
+ Deno.cwd(),
+ "tests/testdata/compile/dynamic_imports/import_path",
+);
+
+setTimeout(async () => {
+ console.log("Dynamic importing");
+ const importPath = (await Deno.readTextFile(IMPORT_PATH_FILE_PATH)).trim();
+ import(importPath).then(() => console.log("Dynamic import done."));
+}, 0);
diff --git a/tests/testdata/compile/dynamic_imports_tmp_lit/main.info.out b/tests/testdata/compile/dynamic_imports_tmp_lit/main.info.out
new file mode 100644
index 000000000..57d730a64
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports_tmp_lit/main.info.out
@@ -0,0 +1,10 @@
+local: [WILDCARD]main.js
+type: JavaScript
+dependencies: 4 unique
+size: [WILDCARD]
+
+file:///[WILDCARD]/dynamic_imports_tmp_lit/main.js ([WILDCARD])
+├── file:///[WILDCARD]/dynamic_imports_tmp_lit/sub/a.js ([WILDCARD])
+├── file:///[WILDCARD]/dynamic_imports_tmp_lit/sub/b.ts ([WILDCARD])
+├── file:///[WILDCARD]/dynamic_imports_tmp_lit/other/data.json ([WILDCARD])
+└── file:///[WILDCARD]/dynamic_imports_tmp_lit/other/sub/data2.json ([WILDCARD])
diff --git a/tests/testdata/compile/dynamic_imports_tmp_lit/main.js b/tests/testdata/compile/dynamic_imports_tmp_lit/main.js
new file mode 100644
index 000000000..3bda59772
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports_tmp_lit/main.js
@@ -0,0 +1,14 @@
+const fileNames = [
+ "a.js",
+ "b.ts",
+];
+
+for (const fileName of fileNames) {
+ await import(`./sub/${fileName}`);
+}
+
+const jsonFileNames = ["data.json", "sub/data2.json"];
+for (const fileName of jsonFileNames) {
+ const mod = await import(`./other/${fileName}`, { with: { type: "json" } });
+ console.log(mod.default);
+}
diff --git a/tests/testdata/compile/dynamic_imports_tmp_lit/other/data.json b/tests/testdata/compile/dynamic_imports_tmp_lit/other/data.json
new file mode 100644
index 000000000..0131e01e4
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports_tmp_lit/other/data.json
@@ -0,0 +1,3 @@
+{
+ "data": 5
+}
diff --git a/tests/testdata/compile/dynamic_imports_tmp_lit/other/sub/data2.json b/tests/testdata/compile/dynamic_imports_tmp_lit/other/sub/data2.json
new file mode 100644
index 000000000..858a13cdd
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports_tmp_lit/other/sub/data2.json
@@ -0,0 +1,3 @@
+{
+ "data": 1
+}
diff --git a/tests/testdata/compile/dynamic_imports_tmp_lit/sub/a.js b/tests/testdata/compile/dynamic_imports_tmp_lit/sub/a.js
new file mode 100644
index 000000000..7b2a34601
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports_tmp_lit/sub/a.js
@@ -0,0 +1 @@
+console.log("a");
diff --git a/tests/testdata/compile/dynamic_imports_tmp_lit/sub/b.ts b/tests/testdata/compile/dynamic_imports_tmp_lit/sub/b.ts
new file mode 100644
index 000000000..6d012e7f1
--- /dev/null
+++ b/tests/testdata/compile/dynamic_imports_tmp_lit/sub/b.ts
@@ -0,0 +1 @@
+console.log("b");
diff --git a/tests/testdata/compile/node_modules_symlink_outside/main.out b/tests/testdata/compile/node_modules_symlink_outside/main.out
new file mode 100644
index 000000000..61c83cba4
--- /dev/null
+++ b/tests/testdata/compile/node_modules_symlink_outside/main.out
@@ -0,0 +1,2 @@
+4
+5
diff --git a/tests/testdata/compile/node_modules_symlink_outside/main.ts b/tests/testdata/compile/node_modules_symlink_outside/main.ts
new file mode 100644
index 000000000..45f681f7c
--- /dev/null
+++ b/tests/testdata/compile/node_modules_symlink_outside/main.ts
@@ -0,0 +1,6 @@
+import { getValue, setValue } from "npm:@denotest/esm-basic";
+
+setValue(4);
+
+console.log(getValue());
+console.log(Deno.readTextFileSync("./node_modules/test.txt"));
diff --git a/tests/testdata/compile/node_modules_symlink_outside/main_compile_file.out b/tests/testdata/compile/node_modules_symlink_outside/main_compile_file.out
new file mode 100644
index 000000000..1154c3256
--- /dev/null
+++ b/tests/testdata/compile/node_modules_symlink_outside/main_compile_file.out
@@ -0,0 +1,2 @@
+Compile file:///[WILDCARD]/node_modules_symlink_outside/main.ts to [WILDCARD]
+Warning Symlink target is outside '[WILDCARD]node_modules_symlink_outside[WILDCARD]node_modules'. Inlining symlink at '[WILDCARD]node_modules_symlink_outside[WILDCARD]node_modules[WILDCARD]test.txt' to '[WILDCARD]node_modules_symlink_outside[WILDCARD]test.txt' as file.
diff --git a/tests/testdata/compile/node_modules_symlink_outside/main_compile_folder.out b/tests/testdata/compile/node_modules_symlink_outside/main_compile_folder.out
new file mode 100644
index 000000000..e88b95834
--- /dev/null
+++ b/tests/testdata/compile/node_modules_symlink_outside/main_compile_folder.out
@@ -0,0 +1,6 @@
+Download http://localhost:4545/npm/registry/@denotest/esm-basic
+Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
+Check file:///[WILDCARD]/node_modules_symlink_outside/main.ts
+Compile file:///[WILDCARD]/node_modules_symlink_outside/main.ts to [WILDCARD]
+Warning Symlink target is outside '[WILDCARD]node_modules_symlink_outside[WILDCARD]node_modules'. Excluding symlink at '[WILDCARD]node_modules_symlink_outside[WILDCARD]node_modules[WILDCARD]some_folder' with target '[WILDCARD]node_modules_symlink_outside[WILDCARD]some_folder'.
diff --git a/tests/testdata/compile/npm_fs/main.out b/tests/testdata/compile/npm_fs/main.out
new file mode 100644
index 000000000..2e9ba477f
--- /dev/null
+++ b/tests/testdata/compile/npm_fs/main.out
@@ -0,0 +1 @@
+success
diff --git a/tests/testdata/compile/npm_fs/main.ts b/tests/testdata/compile/npm_fs/main.ts
new file mode 100644
index 000000000..6361610a9
--- /dev/null
+++ b/tests/testdata/compile/npm_fs/main.ts
@@ -0,0 +1,259 @@
+import { url } from "npm:@denotest/esm-basic";
+import { fileURLToPath } from "node:url";
+import path from "node:path";
+import assert from "node:assert/strict";
+
+// will be at node_modules\.deno\@denotest+esm-basic@1.0.0\node_modules\@denotest\esm-basic
+const dirPath = path.dirname(fileURLToPath(url));
+const nodeModulesPath = path.join(dirPath, "../../../../../");
+const packageJsonText = `{
+ "name": "@denotest/esm-basic",
+ "version": "1.0.0",
+ "type": "module",
+ "main": "main.mjs",
+ "types": "main.d.mts"
+}
+`;
+const vfsPackageJsonPath = path.join(dirPath, "package.json");
+
+// reading a file in vfs
+{
+ const text = Deno.readTextFileSync(vfsPackageJsonPath);
+ assert.equal(text, packageJsonText);
+}
+
+// reading a file async in vfs
+{
+ const text = await Deno.readTextFile(vfsPackageJsonPath);
+ assert.equal(text, packageJsonText);
+}
+
+// copy file from vfs to real fs
+{
+ Deno.copyFileSync(vfsPackageJsonPath, "package.json");
+ assert.equal(Deno.readTextFileSync("package.json"), packageJsonText);
+}
+
+// copy to vfs
+assert.throws(
+ () => Deno.copyFileSync("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+Deno.removeSync("package.json");
+
+// copy file async from vfs to real fs
+{
+ await Deno.copyFile(vfsPackageJsonPath, "package.json");
+ assert.equal(Deno.readTextFileSync("package.json"), packageJsonText);
+}
+
+// copy to vfs async
+await assert.rejects(
+ () => Deno.copyFile("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+Deno.removeSync("package.json");
+
+// open
+{
+ const file = Deno.openSync(vfsPackageJsonPath);
+ const bytes = new Uint8Array(10);
+ file.seekSync(2, Deno.SeekMode.Start);
+ assert.equal(file.readSync(bytes), 10);
+ const text = new TextDecoder().decode(bytes);
+ assert.equal(text, packageJsonText.slice(2, 12));
+}
+{
+ const file = await Deno.open(vfsPackageJsonPath);
+ const bytes = new Uint8Array(10);
+ await file.seek(2, Deno.SeekMode.Start);
+ assert.equal(await file.read(bytes), 10);
+ const text = new TextDecoder().decode(bytes);
+ assert.equal(text, packageJsonText.slice(2, 12));
+}
+
+// chdir
+assert.throws(() => Deno.chdir(dirPath), Deno.errors.NotSupported);
+
+// mkdir
+assert.throws(
+ () => Deno.mkdirSync(path.join(dirPath, "subDir")),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.mkdir(path.join(dirPath, "subDir")),
+ Deno.errors.NotSupported,
+);
+
+// chmod
+assert.throws(
+ () => Deno.chmodSync(vfsPackageJsonPath, 0o777),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.chmod(vfsPackageJsonPath, 0o777),
+ Deno.errors.NotSupported,
+);
+
+// chown
+assert.throws(
+ () => Deno.chownSync(vfsPackageJsonPath, 1000, 1000),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.chown(vfsPackageJsonPath, 1000, 1000),
+ Deno.errors.NotSupported,
+);
+
+// remove
+assert.throws(
+ () => Deno.removeSync(vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.remove(vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+
+// stat
+{
+ const result = Deno.statSync(vfsPackageJsonPath);
+ assert(result.isFile);
+}
+{
+ const result = await Deno.stat(vfsPackageJsonPath);
+ assert(result.isFile);
+}
+
+// lstat
+{
+ const result = Deno.lstatSync(
+ path.join(nodeModulesPath, "@denotest", "esm-basic"),
+ );
+ assert(result.isSymlink);
+}
+{
+ const result = await Deno.lstat(
+ path.join(nodeModulesPath, "@denotest", "esm-basic"),
+ );
+ assert(result.isSymlink);
+}
+
+// realpath
+{
+ const result = Deno.realPathSync(
+ path.join(nodeModulesPath, "@denotest", "esm-basic", "package.json"),
+ );
+ assert.equal(result, vfsPackageJsonPath);
+}
+{
+ const result = await Deno.realPath(
+ path.join(nodeModulesPath, "@denotest", "esm-basic", "package.json"),
+ );
+ assert.equal(result, vfsPackageJsonPath);
+}
+
+// read dir
+const readDirNames = ["main.d.mts", "main.mjs", "other.mjs", "package.json"];
+{
+ const names = Array.from(Deno.readDirSync(dirPath))
+ .map((e) => e.name);
+ assert.deepEqual(readDirNames, names);
+}
+{
+ const names = [];
+ for await (const entry of Deno.readDir(dirPath)) {
+ names.push(entry.name);
+ }
+ assert.deepEqual(readDirNames, names);
+}
+
+// rename
+assert.throws(
+ () => Deno.renameSync("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+assert.throws(
+ () => Deno.renameSync(vfsPackageJsonPath, "package.json"),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.rename("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.rename(vfsPackageJsonPath, "package.json"),
+ Deno.errors.NotSupported,
+);
+
+// link
+assert.throws(
+ () => Deno.linkSync("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+assert.throws(
+ () => Deno.linkSync(vfsPackageJsonPath, "package.json"),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.link("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.link(vfsPackageJsonPath, "package.json"),
+ Deno.errors.NotSupported,
+);
+
+// symlink
+assert.throws(
+ () => Deno.symlinkSync("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+assert.throws(
+ () => Deno.symlinkSync(vfsPackageJsonPath, "package.json"),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.symlink("package.json", vfsPackageJsonPath),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.symlink(vfsPackageJsonPath, "package.json"),
+ Deno.errors.NotSupported,
+);
+
+// read link
+{
+ const result = Deno.readLinkSync(
+ path.join(nodeModulesPath, "@denotest", "esm-basic"),
+ );
+ assert.equal(result, dirPath);
+}
+{
+ const result = await Deno.readLink(
+ path.join(nodeModulesPath, "@denotest", "esm-basic"),
+ );
+ assert.equal(result, dirPath);
+}
+
+// truncate
+assert.throws(
+ () => Deno.truncateSync(vfsPackageJsonPath, 0),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.truncate(vfsPackageJsonPath, 0),
+ Deno.errors.NotSupported,
+);
+
+// utime
+assert.throws(
+ () => Deno.utimeSync(vfsPackageJsonPath, 0, 0),
+ Deno.errors.NotSupported,
+);
+await assert.rejects(
+ () => Deno.utime(vfsPackageJsonPath, 0, 0),
+ Deno.errors.NotSupported,
+);
+
+console.log("success");
diff --git a/tests/testdata/compile/standalone_error.ts b/tests/testdata/compile/standalone_error.ts
new file mode 100644
index 000000000..279398113
--- /dev/null
+++ b/tests/testdata/compile/standalone_error.ts
@@ -0,0 +1,9 @@
+function boom() {
+ throw new Error("boom!");
+}
+
+function foo() {
+ boom();
+}
+
+foo();
diff --git a/tests/testdata/compile/standalone_error_module_with_imports_1.ts b/tests/testdata/compile/standalone_error_module_with_imports_1.ts
new file mode 100644
index 000000000..bf38f7263
--- /dev/null
+++ b/tests/testdata/compile/standalone_error_module_with_imports_1.ts
@@ -0,0 +1 @@
+import "./standalone_error_module_with_imports_2.ts";
diff --git a/tests/testdata/compile/standalone_error_module_with_imports_2.ts b/tests/testdata/compile/standalone_error_module_with_imports_2.ts
new file mode 100644
index 000000000..ef052b512
--- /dev/null
+++ b/tests/testdata/compile/standalone_error_module_with_imports_2.ts
@@ -0,0 +1,2 @@
+console.log("hello");
+throw new Error("boom!");
diff --git a/tests/testdata/compile/standalone_follow_redirects.ts b/tests/testdata/compile/standalone_follow_redirects.ts
new file mode 100644
index 000000000..f0957bc3d
--- /dev/null
+++ b/tests/testdata/compile/standalone_follow_redirects.ts
@@ -0,0 +1,2 @@
+import "./standalone_follow_redirects_2.js";
+console.log("Hello");
diff --git a/tests/testdata/compile/standalone_follow_redirects_2.js b/tests/testdata/compile/standalone_follow_redirects_2.js
new file mode 100644
index 000000000..765dda153
--- /dev/null
+++ b/tests/testdata/compile/standalone_follow_redirects_2.js
@@ -0,0 +1,5 @@
+// unversioned import redirects with dependencies.
+import {
+ assertNotEquals as _a,
+ assertStrictEquals as _b,
+} from "../../../test_util/std/assert/mod.ts";
diff --git a/tests/testdata/compile/standalone_import_datauri.ts b/tests/testdata/compile/standalone_import_datauri.ts
new file mode 100644
index 000000000..68f348828
--- /dev/null
+++ b/tests/testdata/compile/standalone_import_datauri.ts
@@ -0,0 +1,4 @@
+const c = await import(
+ "data:text/javascript;base64,ZXhwb3J0IGRlZmF1bHQgJ0hlbGxvIERlbm8hJw=="
+);
+console.log(c.default); // Output: "Hello Deno!"
diff --git a/tests/testdata/compile/standalone_import_map.json b/tests/testdata/compile/standalone_import_map.json
new file mode 100644
index 000000000..9e5b90bd7
--- /dev/null
+++ b/tests/testdata/compile/standalone_import_map.json
@@ -0,0 +1,5 @@
+{
+ "imports": {
+ "hello": "../run/001_hello.js"
+ }
+}
diff --git a/tests/testdata/compile/standalone_import_map.ts b/tests/testdata/compile/standalone_import_map.ts
new file mode 100644
index 000000000..097b96356
--- /dev/null
+++ b/tests/testdata/compile/standalone_import_map.ts
@@ -0,0 +1 @@
+import "hello";
diff --git a/tests/testdata/compile/standalone_import_map_config.json b/tests/testdata/compile/standalone_import_map_config.json
new file mode 100644
index 000000000..4959827f4
--- /dev/null
+++ b/tests/testdata/compile/standalone_import_map_config.json
@@ -0,0 +1,3 @@
+{
+ "importMap": "./standalone_import_map.json"
+}
diff --git a/tests/testdata/compile/standalone_runtime_flags.ts b/tests/testdata/compile/standalone_runtime_flags.ts
new file mode 100644
index 000000000..0154c7f4e
--- /dev/null
+++ b/tests/testdata/compile/standalone_runtime_flags.ts
@@ -0,0 +1,3 @@
+console.log(Math.random());
+await Deno.stat(".");
+await Deno.create("foo.txt");
diff --git a/tests/testdata/compile/unstable_features.ts b/tests/testdata/compile/unstable_features.ts
new file mode 100644
index 000000000..819a3d187
--- /dev/null
+++ b/tests/testdata/compile/unstable_features.ts
@@ -0,0 +1,2 @@
+const db = await Deno.openKv();
+console.log(db);
diff --git a/tests/testdata/compile/vfs_implicit_read_permission/main.out b/tests/testdata/compile/vfs_implicit_read_permission/main.out
new file mode 100644
index 000000000..17d05159c
--- /dev/null
+++ b/tests/testdata/compile/vfs_implicit_read_permission/main.out
@@ -0,0 +1,8 @@
+ __________________
+< Hello from Deno! >
+ ------------------
+ \ ^__^
+ \ (oo)\_______
+ (__)\ )\/\
+ ||----w |
+ || ||
diff --git a/tests/testdata/compile/vfs_implicit_read_permission/main.ts b/tests/testdata/compile/vfs_implicit_read_permission/main.ts
new file mode 100644
index 000000000..56ad1e095
--- /dev/null
+++ b/tests/testdata/compile/vfs_implicit_read_permission/main.ts
@@ -0,0 +1,3 @@
+// this will read a file from the package
+import { say } from "npm:cowsay@1.5.0";
+console.log(say({ text: "Hello from Deno!" }));
diff --git a/tests/testdata/compile/workers/basic.out b/tests/testdata/compile/workers/basic.out
new file mode 100644
index 000000000..9cf9aa18f
--- /dev/null
+++ b/tests/testdata/compile/workers/basic.out
@@ -0,0 +1,5 @@
+worker.js imported from main thread
+Starting worker
+Hello from worker!
+Received 42
+Closing
diff --git a/tests/testdata/compile/workers/basic.ts b/tests/testdata/compile/workers/basic.ts
new file mode 100644
index 000000000..8edf58de9
--- /dev/null
+++ b/tests/testdata/compile/workers/basic.ts
@@ -0,0 +1,11 @@
+import "./worker.ts";
+
+console.log("Starting worker");
+const worker = new Worker(
+ new URL("./worker.ts", import.meta.url),
+ { type: "module" },
+);
+
+setTimeout(() => {
+ worker.postMessage(42);
+}, 500);
diff --git a/tests/testdata/compile/workers/not_in_module_map.ts b/tests/testdata/compile/workers/not_in_module_map.ts
new file mode 100644
index 000000000..b43f8cb1f
--- /dev/null
+++ b/tests/testdata/compile/workers/not_in_module_map.ts
@@ -0,0 +1,11 @@
+// This time ./worker.ts is not in the module map, so the worker
+// initialization will fail unless worker.js is passed as a side module.
+
+const worker = new Worker(
+ new URL("./worker.ts", import.meta.url),
+ { type: "module" },
+);
+
+setTimeout(() => {
+ worker.postMessage(42);
+}, 500);
diff --git a/tests/testdata/compile/workers/worker.ts b/tests/testdata/compile/workers/worker.ts
new file mode 100644
index 000000000..a1c357ab1
--- /dev/null
+++ b/tests/testdata/compile/workers/worker.ts
@@ -0,0 +1,14 @@
+/// <reference no-default-lib="true" />
+/// <reference lib="deno.worker" />
+
+if (import.meta.main) {
+ console.log("Hello from worker!");
+
+ addEventListener("message", (evt) => {
+ console.log(`Received ${evt.data}`);
+ console.log("Closing");
+ self.close();
+ });
+} else {
+ console.log("worker.js imported from main thread");
+}