summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deno_dir.go6
-rw-r--r--integration_test.go11
-rw-r--r--main.go2
3 files changed, 15 insertions, 4 deletions
diff --git a/deno_dir.go b/deno_dir.go
index 5db85cf41..49d1e0696 100644
--- a/deno_dir.go
+++ b/deno_dir.go
@@ -90,7 +90,11 @@ func UserHomeDir() string {
}
func createDirs() {
- DenoDir = path.Join(UserHomeDir(), ".deno")
+ if *flagRoot == "" {
+ DenoDir = path.Join(UserHomeDir(), ".deno")
+ } else {
+ DenoDir = *flagRoot
+ }
CacheDir = path.Join(DenoDir, "cache")
err := os.MkdirAll(CacheDir, 0700)
check(err)
diff --git a/integration_test.go b/integration_test.go
index a646c4553..4c525544c 100644
--- a/integration_test.go
+++ b/integration_test.go
@@ -45,7 +45,7 @@ func listTestFiles() []string {
return out
}
-func CheckOutput(t *testing.T, outFile string, denoFn string) {
+func checkOutput(t *testing.T, outFile string, denoFn string) {
outFile = path.Join("testdata", outFile)
jsFile := strings.TrimSuffix(outFile, ".out")
@@ -54,7 +54,12 @@ func CheckOutput(t *testing.T, outFile string, denoFn string) {
t.Fatal(err.Error())
}
- cmd := exec.Command(denoFn, jsFile, "--reload")
+ dir, err := ioutil.TempDir("", "TestIntegration")
+ if err != nil {
+ panic(err)
+ }
+
+ cmd := exec.Command(denoFn, "--root="+dir, jsFile)
var out bytes.Buffer
cmd.Stdout = &out
err = cmd.Run()
@@ -80,7 +85,7 @@ func TestIntegration(t *testing.T) {
outFiles := listTestFiles()
for _, outFile := range outFiles {
t.Run(outFile, func(t *testing.T) {
- CheckOutput(t, outFile, denoFn)
+ checkOutput(t, outFile, denoFn)
})
}
}
diff --git a/main.go b/main.go
index d557ab204..c7b92f17e 100644
--- a/main.go
+++ b/main.go
@@ -13,6 +13,8 @@ var flagReload = flag.Bool("reload", false, "Reload cached remote source code.")
var flagV8Options = flag.Bool("v8-options", false, "Print V8 command line options.")
var flagDebug = flag.Bool("debug", false, "Enable debug output.")
var flagGoProf = flag.String("goprof", "", "Write golang cpu profile to file.")
+var flagRoot = flag.String("root", "",
+ "Where to cache compilation artifacts. Default: ~/.deno")
func stringAsset(path string) string {
data, err := Asset("dist/" + path)