Skip to content

Commit

Permalink
Remove try/catch block for fs.copyFile.
Browse files Browse the repository at this point in the history
Fix the path for test image file.
  • Loading branch information
worldomonation committed Aug 27, 2021
1 parent 5d4b3c3 commit 9c61b49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions packages/calypso-e2e/src/media-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ export async function createTestFile(
const tempDir = await fs.mkdtemp( path.join( os.tmpdir(), 'e2e' ) );
const targetPath = path.join( tempDir, basename );

try {
await fs.copyFile( sourcePath, targetPath, constants.COPYFILE_EXCL );
} catch {
console.error( `Target file already present at ${ targetPath }` );
}
await fs.copyFile( sourcePath, targetPath, constants.COPYFILE_EXCL );

// Return an object implementing the interface.
return {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';

export const TEST_IMAGE_PATH = path.normalize(
path.join( __dirname, 'image-uploads', 'image0.jpg' )
path.join( __dirname, '..', 'image-uploads', 'image0.jpg' )
);
export const TEST_AUDIO_PATH = path.normalize(
path.join( __dirname, '..', 'image-uploads', 'bees.mp3' )
Expand Down

0 comments on commit 9c61b49

Please sign in to comment.