-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test about rate limit warnings in tests
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/node | ||
|
||
/* eslint n/no-process-exit: "off" -- WIP */ | ||
import * as fsp from 'node:fs/promises'; | ||
import * as path from 'node:path'; | ||
import {fileURLToPath} from 'node:url'; | ||
import {glob} from 'tinyglobby'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const SNAPSHOTS = path.join(__dirname, 'run-snapshots'); | ||
|
||
const snapshotFiles = await glob('**/*.txt', { | ||
caseSensitiveMatch: true, | ||
ignore: [`**/elm-stuff/**`], | ||
cwd: SNAPSHOTS | ||
}); | ||
|
||
for await (const file of snapshotFiles) { | ||
const filePath = path.join(SNAPSHOTS, file); | ||
const fileHandle = await fsp.readFile(filePath); | ||
const content = fileHandle.toString(); | ||
if (content.includes('RATE LIMIT')) { | ||
console.error('INCORRECT SNAPSHOT\n'); | ||
console.error('This file contains a rate limit error:\n'); | ||
console.error(filePath); | ||
console.error( | ||
'\nThis likely means you hit a GitHub rate limit error while re-generating snapshots.' | ||
); | ||
process.exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
"tsc", | ||
"eslint-check", | ||
"prettier-check", | ||
"test-check-rate-limit-snapshots", | ||
"test-sync" | ||
] | ||
}, | ||
|