Repository navigation
handle scenario where the JSON data isn't available - #849
Conversation
|
Ready for review |
| @@ -87,26 +87,34 @@ export class EmojiStore { | |||
| const basePath = process.env.TEST_ENV ? Path.join(__dirname, '..', '..', '..', '..', 'gemoji', 'db') : __dirname | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| Fs.readFile(Path.join(basePath, 'emoji.json'), 'utf8', (err, data) => { | ||
|
|
||
| const db: IGemojiDb = JSON.parse(data) | ||
| const path = Path.join(rootDir, 'emoji.json') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| if (err) { | ||
| reject(err) | ||
| return |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
🍎 |
|
Anyway, I'm pretty sure the root cause of this issue:
|
| } | ||
|
|
||
| public read(): Promise<void> { | ||
| public read(rootDir: string): Promise<void> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| if (err) { | ||
| reject(err) | ||
| return |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| }) | ||
|
|
||
| this.emojiStore.read().then(() => this.emitUpdate()) | ||
| const rootDir = remote.app.getAppPath() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
🐶 |
As part of implementing #833 I found some clues as to why the integration test might be failing on CI:
The section in bold maps to this bit of code:
desktop/app/src/lib/dispatcher/emoji-store.ts
Line 90 in 41e60c6
The simplest repro seems to be:
~/Library/Application Support/GitHub Desktop/(where Electron stores the local files and caches for Desktop:TNG)npm run build:prodnpm run test:integrationWhich then gives this test output:
I've also spotted a similar error on Appveyor recently, so hopefully #833 will uncover more of these sorts of issues.
I'm sure there are some flow-on effects from this, but rejecting here is better than suppressing the error...