(test: Test)
| 65 | } |
| 66 | |
| 67 | _getCache(test: Test): Cache { |
| 68 | const {context} = test; |
| 69 | if (!this._cache.has(context) && context.config.cache) { |
| 70 | const cachePath = this._getCachePath(context); |
| 71 | if (fs.existsSync(cachePath)) { |
| 72 | try { |
| 73 | this._cache.set( |
| 74 | context, |
| 75 | JSON.parse(fs.readFileSync(cachePath, 'utf8')) as Cache, |
| 76 | ); |
| 77 | } catch {} |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | let cache = this._cache.get(context); |
| 82 | if (!cache) { |
| 83 | cache = {}; |
| 84 | this._cache.set(context, cache); |
| 85 | } |
| 86 | |
| 87 | return cache; |
| 88 | } |
| 89 | |
| 90 | private _shardPosition(options: ShardPositionOptions): number { |
| 91 | const shardRest = options.suiteLength % options.shardCount; |
no test coverage detected