Option to overwrite artifacts if they exist
See original GitHub issueDescribe your idea
It would be great if we overwrite artifacts such as screenshots or videos by passing through a flag e.g. --overwrite-artifacts
.
I’ve managed to get this working locally by adding the following patch to node_modules/detox/src/artifacts/templates/artifact/FileArtifact.js
-> moveTemporaryFile
method:
diff --git a/node_modules/detox/src/artifacts/templates/artifact/FileArtifact.js b/node_modules/detox/src/artifacts/templates/artifact/FileArtifact.js
index 7f07040..593662d 100644
--- a/node_modules/detox/src/artifacts/templates/artifact/FileArtifact.js
+++ b/node_modules/detox/src/artifacts/templates/artifact/FileArtifact.js
@@ -87,6 +87,12 @@ class FileArtifact extends Artifact {
return true;
}
+ if (await fs.exists(destination)) {
+ logger.debug({ event: 'MOVE_FILE_OVERWRITE' }, `moving "${source}" to ${destination}`);
+ await fs.move(source, destination, { overwrite: true });
+ return true;
+ }
+
logger.warn({ event: 'MOVE_FILE_EXISTS' }, `cannot overwrite: "${source}" => "${destination}"`);
await fs.remove(source);
return false;
It checks if the file exists at the destination and then passes through the flag option overwrite: true
to fs.move
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Overwriting Artifactory artifacts (and history)? - Stack Overflow
The only option that you have will be to remove "Delete/Overwrite" permission to the users. Then, once they will try to write a...
Read more >[#HAP-208] Build fails on deploy if artifact already exists - JFrog
I believe there should be an option to not fail the build if the user is unable to overwrite a 'release' artifact.
Read more >Artifacts with the same name from different jobs overwrite each ...
Either a warning should be produced, or the artifacts should be preserved separately - perhaps under a job name.
Read more >How to avoid overwriting a previous artifact on Artifactory with ...
Hi, I would like to know how avoid the case of you overwrite a artifact published previously by error. Researching on Internet, I...
Read more >AW: Don't overwrite existing artifact - Apache Mail Archives
Same if I include the build number into the version. ... overwrite of an existing remote artifact, you can use the exists-maven-plugin ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah, hehe, interesting… I’ll think. 😃
The issue has been closed for inactivity.