Skip to content

Commit 861c016

Browse files
Added support for deep file paths
1 parent 8271b5b commit 861c016

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"del": "^3.0.0",
6363
"eslint": "^5.14.1",
6464
"eslint-config-modular": "^7.0.0",
65+
"mkdirp": "^0.5.1",
6566
"mocha": "^6.0.1",
6667
"npm-check": "^5.9.0",
6768
"nyc": "^13.3.0",

test/utils/files.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const fs = require("fs");
44
const path = require("path");
5+
const mkdirp = require("mkdirp");
56

67
const filesDir = path.resolve("test", "fixtures", "files");
78
const tempDir = path.resolve("test", ".tmp");
@@ -17,7 +18,12 @@ const files = module.exports = {
1718
if (typeof contents === "object") {
1819
contents = JSON.stringify(contents, null, 2);
1920
}
20-
fs.writeFileSync(path.join(tempDir, name), contents);
21+
22+
let filePath = path.join(tempDir, name);
23+
let dirPath = path.dirname(filePath);
24+
25+
mkdirp.sync(dirPath);
26+
fs.writeFileSync(filePath, contents);
2127
},
2228

2329
/**

0 commit comments

Comments
 (0)