From 4671c4b38329d334164fd05334bcca3a531b8c35 Mon Sep 17 00:00:00 2001
From: Hannah Wolfe <erisds@gmail.com>
Date: Wed, 1 Apr 2020 18:04:14 +0100
Subject: [PATCH] Use tmp directory for files written during tests

- Add spec/tmp directory with .gitkeep file to indicate the folder is intentional
- Add the folder contents to .gitignore
- Use this folder to output the sourcemap file during bin tests. This file is a sideeffect of the main test
---
 .gitignore                        | 1 +
 spec/artifacts/source.map.amd.txt | 1 -
 spec/expected/source.map.amd.js   | 2 +-
 spec/tmp/.gitkeep                 | 1 +
 tasks/test-bin.js                 | 2 +-
 5 files changed, 4 insertions(+), 3 deletions(-)
 delete mode 100644 spec/artifacts/source.map.amd.txt
 create mode 100644 spec/tmp/.gitkeep

diff --git a/.gitignore b/.gitignore
index 59019b37..97e44f88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ lib/handlebars/compiler/parser.js
 /coverage/
 /dist/
 /integration-testing/*/dist/
+/spec/tmp/*
\ No newline at end of file
diff --git a/spec/artifacts/source.map.amd.txt b/spec/artifacts/source.map.amd.txt
deleted file mode 100644
index 88c18f84..00000000
--- a/spec/artifacts/source.map.amd.txt
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["test"],"names":["compiler","main","container","depth0","helpers","partials","data","useData"],"mappings":"kHAAA,CAAAA,SAAA,CAAA,EAAA,YAAAC,KAAA,SAAAC,EAAAC,EAAAC,EAAAC,EAAAC,GAAA,MAAA,gBAAAC,SAAA"}
\ No newline at end of file
diff --git a/spec/expected/source.map.amd.js b/spec/expected/source.map.amd.js
index 1f010db7..cb00a651 100644
--- a/spec/expected/source.map.amd.js
+++ b/spec/expected/source.map.amd.js
@@ -1,2 +1,2 @@
 define(["handlebars.runtime"],function(e){var t=(e=e.default).template;return(e.templates=e.templates||{}).test=t({compiler:[8,">= 4.3.0"],main:function(e,t,a,n,i){return"<div>1</div>"},useData:!0})});
-//# sourceMappingURL=./spec/artifacts/source.map.amd.txt
\ No newline at end of file
+//# sourceMappingURL=./spec/tmp/source.map.amd.txt
\ No newline at end of file
diff --git a/spec/tmp/.gitkeep b/spec/tmp/.gitkeep
new file mode 100644
index 00000000..f534490e
--- /dev/null
+++ b/spec/tmp/.gitkeep
@@ -0,0 +1 @@
+This directory is ignored in .gitignore. It can be used to write temporary files during tests.
\ No newline at end of file
diff --git a/tasks/test-bin.js b/tasks/test-bin.js
index 306dfb23..58dfab04 100644
--- a/tasks/test-bin.js
+++ b/tasks/test-bin.js
@@ -155,7 +155,7 @@ const testCases = [
       '-N',
       'test',
       '--map',
-      './spec/artifacts/source.map.amd.txt'
+      './spec/tmp/source.map.amd.txt'
     ],
     outputLocation: 'stdout',
     expectedOutputSpec: './spec/expected/source.map.amd.js'
