Instead of creating this file in the test directory, create it in the temporary directory:

```
// At top of file:
const System = require('sdk/system');
const TEMP_DIR = System.pathFor('TmpD');
…
// Then here:
let pathToFile = File.join(TEMP_DIR, filename);
```

Also, delete the temporary file before finishing the tests in this function, so it doesn't affect other test functions, and the file doesn't get left lying around after the tests are done.