-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(run): interpret extensionless files as typescript (#5711)
* test * gadsgsagdsa * add better err msg * r * oops * ok
- Loading branch information
1 parent
b65862e
commit b795151
Showing
13 changed files
with
76 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Bun.write("/tmp/bun-write-permission-test.txt", "test", { mode: 0o777 }); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { expect, test } from "bun:test"; | ||
import { mkdirSync, realpathSync } from "fs"; | ||
import { bunEnv, bunExe } from "harness"; | ||
import { writeFileSync } from "fs"; | ||
import { tmpdir } from "os"; | ||
import { join } from "path"; | ||
|
||
test("running extensionless file works", async () => { | ||
const dir = join(realpathSync(tmpdir()), "bun-run-test1"); | ||
mkdirSync(dir, { recursive: true }); | ||
await Bun.write(join(dir, "cool"), "const x: Test = 2; console.log('hello world');"); | ||
let { stdout } = Bun.spawnSync({ | ||
cmd: [bunExe(), join(dir, "./cool")], | ||
cwd: dir, | ||
env: bunEnv, | ||
}); | ||
expect(stdout.toString("utf8")).toEqual("hello world\n"); | ||
}); | ||
|
||
test("running shebang typescript file works", async () => { | ||
const dir = join(realpathSync(tmpdir()), "bun-run-test2"); | ||
mkdirSync(dir, { recursive: true }); | ||
writeFileSync(join(dir, "cool"), `#!${bunExe()}\nconst x: Test = 2; console.log('hello world');`, { mode: 0o777 }); | ||
|
||
let { stdout } = Bun.spawnSync({ | ||
cmd: [join(dir, "./cool")], | ||
cwd: dir, | ||
env: bunEnv, | ||
}); | ||
expect(stdout.toString("utf8")).toEqual("hello world\n"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "yargs-test", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"yargs": "17.7.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
test("yargs/yargs works", () => { | ||
const yargs = require("yargs/yargs"); | ||
expect(yargs).toBeFunction(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters