UNPKG

mocha-headless-chrome

Version:

Run client-side mocha tests in the command line through headless Chrome

13 lines (9 loc) 303 B
const { writeFileSync, mkdirSync, existsSync } = require('node:fs'); const { dirname } = require('node:path'); module.exports = function (filePath, content) { let dir = dirname(filePath); if (!existsSync(dir)) { mkdirSync(dir, { recursive: true }); } writeFileSync(filePath, content); };