public icon indicating copy to clipboard operation
public copied to clipboard

feature request: enable write back from cache

Open unional opened this issue 6 years ago • 2 comments

Tests and code can create artifacts when they run. For example:

  • https://github.com/unional/komondor creates spec records in the __komondor__ folder
  • https://github.com/unional/fixture creates result and baseline files

When running in wallaby, the tests run fine because the files are saved in the cache.

But that means the tests fail when running again from CLI because the actual files were not written.

Is it possible to specify writeback: true in the file object?

i.e.:

{
  'files': [
    { pattern: '...', writeback: true }
  ]
}

🌷

unional avatar Apr 02 '18 01:04 unional

I like the idea of providing such a flag.

Also, even though it's not a one flag solution, but before the feature is implemented, you may write any files back to the local project dir by intercepting and extending the function that writes the files. An example may be found here.

ArtemGovorov avatar Apr 02 '18 01:04 ArtemGovorov

I notice two things:

file.replace(wallaby.projectCacheDir, wallaby.localProjectDir) creates an incorrect path. e.g. /Users/hwong/code/project-a//__komondor/.... Note the double // there.

Doing path.join(wallaby.localProjectDir, file.replace(wallaby.projectCacheDir, '')) solves the issue, but it is ugly.

Another thing probably also needs to patch fs.mkdirSync() because it is giving me:

Failed: ENOENT: no such file or directory, open 
'/Users/hwong/code/project-a/__komondor__/specs/objects/addresses/move/before.json'​

unional avatar Apr 02 '18 02:04 unional