@@ -20,9 +20,7 @@ function _Test_runThunk(thunk)
2020
2121const fs = require ( 'node:fs' ) ;
2222const path = require ( 'node:path' ) ;
23- const os = require ( 'node:os' ) ;
2423const process = require ( 'node:process' ) ;
25- const crypto = require ( 'node:crypto' ) ;
2624
2725function _Test_readFile ( filePath )
2826{
@@ -69,6 +67,16 @@ function WriteFile(root, filePath, contents)
6967 return __Result_Err ( __File_PathEscapesDirectory ) ;
7068 }
7169
70+ // Remove failed file if it exists
71+ var failedPath = null ;
72+ if ( ! fullPath . endsWith ( ".failed.html" ) && fullPath . endsWith ( ".html" ) )
73+ failedPath = fullPath . slice ( 0 , - 5 ) + ".failed.html" ;
74+ else if ( ! fullPath . endsWith ( ".failed" ) )
75+ failedPath = fullPath + ".failed" ;
76+
77+ if ( failedPath )
78+ fs . unlinkSync ( failedPath ) ;
79+
7280 const fullDir = path . dirname ( fullPath ) ;
7381
7482 // Note that this does not throw an error if the directory exists
@@ -89,18 +97,6 @@ var _Test_writeFile = F2(function(filePath, contents)
8997 return WriteFile ( path . resolve ( "tests" ) , filePath , contents ) ;
9098} )
9199
92- var tempDir = null ;
93- var _Test_writeTempFile = F2 ( function ( filePath , contents )
94- {
95- if ( tempDir === null )
96- {
97- tempDir = os . tmpdir ( ) + "/" + crypto . randomUUID ( ) ;
98- fs . mkdirSync ( tempDir ) ;
99- }
100-
101- return WriteFile ( tempDir , filePath , contents ) ;
102- } )
103-
104100var overwriteGoldenFiles = null ;
105101function _Test_overwriteGoldenFiles ( unused )
106102{
0 commit comments