@@ -34,21 +34,50 @@ fs.rmSync('./config', { recursive: true, force: true })
3434fs . mkdirSync ( './config' ) 
3535fs . cpSync ( './dist/cjs/config' ,  './config' ,  {  recursive : true  } ) 
3636fs . cpSync ( './dist/cjs/package.json' ,  './config/package.json' ) 
37- // Some background on the two `fs.cpSync` calls below: I've been having problems 
38- // with jest testing in CI sometimes failing to find the jest preset file. I 
39- // don't know why. But after deep-diving into the jest source code I realized it 
40- // was looking for a package.json in the same directory as it first tries to 
41- // find the preset. It's supposed to traverse up the folder tree if it can't 
42- // find one, until it does. I'm not sure if this is sometimes failing, or what 
43- // happens when it finds one much further up the tree. Maybe jest then tries to 
44- // resolve the preset in *that* directory. Anyway, to make things as easy for it 
45- // as possible, I updated the testing package build script to put a package.json 
46- // files in the preset directories for both the api and the web sides. And after 
47- // that CI passed. 
37+ 
38+ // Some background on the package.json related commands below: I've been having 
39+ // problems with jest testing in CI sometimes failing to find the jest preset 
40+ // file. I don't know why. But after deep-diving into the jest source code I 
41+ // realized it was looking for a package.json in the same directory as it first 
42+ // tries to find the preset. It's supposed to traverse up the folder tree if it 
43+ // can't find one, until it does. I'm not sure if this is sometimes failing, or 
44+ // what happens when it finds one much further up the tree. Maybe jest then 
45+ // tries to resolve the preset in *that* directory. Anyway, to make things as 
46+ // easy for it as possible, I updated the testing package build script to put a 
47+ // package.json files in the preset directories for both the api and the web 
48+ // sides. And after that CI passed. 
4849// But since it's been flakey I don't know if this was the actual fix, or if it 
4950// just randomly decided to pass. 
50- fs . cpSync ( './dist/cjs/package.json' ,  './config/jest/api/package.json' ) 
51- fs . cpSync ( './dist/cjs/package.json' ,  './config/jest/web/package.json' ) 
51+ fs . writeFileSync ( 
52+   './config/jest/api/package.json' , 
53+   JSON . stringify ( 
54+     { 
55+       name : 'cedarjs-jest-api-preset' , 
56+       version : '0.0.1' , 
57+       type : 'commonjs' , 
58+       main : 'index.js' , 
59+       license : 'MIT' , 
60+       types : './index.d.ts' , 
61+     } , 
62+     null , 
63+     2 , 
64+   ) , 
65+ ) 
66+ fs . writeFileSync ( 
67+   './config/jest/web/package.json' , 
68+   JSON . stringify ( 
69+     { 
70+       name : 'cedarjs-jest-web-preset' , 
71+       version : '0.0.1' , 
72+       type : 'commonjs' , 
73+       main : 'index.js' , 
74+       license : 'MIT' , 
75+       types : './index.d.ts' , 
76+     } , 
77+     null , 
78+     2 , 
79+   ) , 
80+ ) 
5281
5382// Replace relative imports with absolute @cedarjs /testing/dist/cjs imports in built CJS files 
5483function  replaceImportsInFile ( filePath : string )  { 
0 commit comments