ava-playback icon indicating copy to clipboard operation
ava-playback copied to clipboard

Ava-playback should create playback dir if it doesn't exist

Open johanbrook opened this issue 7 years ago • 3 comments

Hi! Great package! I just thought I'd document the first run here:

Config:

"ava": {
    "require": ["ava-playback"],
    "playbacks": "tests/fixtures"
}

I ran this:

api→  env NODE_ENV=test AVA_PLAYBACK=record npx ava           22:14:08
fs.js:905
  return binding.mkdir(pathModule.toNamespacedPath(path),
                 ^

Error: ENOENT: no such file or directory, mkdir '/Users/Johan/Projects/Code/stocks/api/tests/fixtures'
    at Object.fs.mkdirSync (fs.js:905:18)
    at Object.<anonymous> (/Users/Johan/Projects/Code/stocks/api/node_modules/ava-playback/dist/index.js:12:8)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at __dirname.forEach.x (/Users/Johan/Projects/Code/stocks/api/node_modules/ava/lib/test-worker.js:30:35)

  1 exception

  ✖ routes/stock.test.js exited with a non-zero exit code: 1

I think it the directory/directories should be created with a mkdirp operation if they don't exist.

johanbrook avatar Nov 29 '17 22:11 johanbrook

Hey @johanbrook. Sorry for inconvenience. I actually didn’t think of this usecase and just used mkdir :) Anyway, I’ll fix this bug and release a new version tomorrow.

dempfi avatar Nov 30 '17 01:11 dempfi

No worries :) Good to catch these edge cases.

johanbrook avatar Nov 30 '17 21:11 johanbrook

I'm guessing this issue could be closed?

taylorjdawson avatar Apr 09 '19 21:04 taylorjdawson