| 136 | } |
| 137 | |
| 138 | function formatOptions(name: string | MockOptions, options?: MockOptions) { |
| 139 | let baseDir; |
| 140 | if (typeof name === 'string') { |
| 141 | baseDir = name; |
| 142 | } else { |
| 143 | // name is options |
| 144 | options = name; |
| 145 | baseDir = options.baseDir!; |
| 146 | } |
| 147 | if (!baseDir.startsWith('/')) { |
| 148 | baseDir = path.join(__dirname, 'fixtures', baseDir); |
| 149 | } |
| 150 | return { |
| 151 | baseDir, |
| 152 | framework: eggPath, |
| 153 | cache: false, |
| 154 | // change default mockCtxStorage to false because we don't need it in framework test |
| 155 | mockCtxStorage: false, |
| 156 | ...options, |
| 157 | }; |
| 158 | } |