File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ function relativeToWorkshopRoot(dir) {
48
48
}
49
49
50
50
await updatePkgNames ( )
51
+ await copyTestFiles ( )
51
52
52
53
async function updatePkgNames ( ) {
53
54
for ( const file of appsWithPkgJson ) {
@@ -64,6 +65,26 @@ async function updatePkgNames() {
64
65
}
65
66
}
66
67
68
+ async function copyTestFiles ( ) {
69
+ for ( const app of exerciseApps ) {
70
+ if ( app . includes ( 'problem' ) ) {
71
+ const solutionApp = app . replace ( 'problem' , 'solution' )
72
+ const testDir = path . join ( solutionApp , 'tests' )
73
+ const destTestDir = path . join ( app , 'tests' )
74
+
75
+ if ( exists ( testDir ) ) {
76
+ // Remove existing test directory in problem app if it exists
77
+ if ( exists ( destTestDir ) ) {
78
+ await fs . promises . rm ( destTestDir , { recursive : true , force : true } )
79
+ }
80
+
81
+ // Copy the entire test directory from solution to problem
82
+ await fs . promises . cp ( testDir , destTestDir , { recursive : true } )
83
+ }
84
+ }
85
+ }
86
+ }
87
+
67
88
async function writeIfNeeded ( filepath , content ) {
68
89
const oldContent = await fs . promises . readFile ( filepath , 'utf8' )
69
90
if ( oldContent !== content ) {
You can’t perform that action at this time.
0 commit comments