-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exercises with type-tests (#1520)
* Bump packages * Sync * Add mini test runner * Add basics exericse * Fix author field * Add exercise to config.json * Format files * Regenerate locks * Seed with content from JavaScript * Fix package name * Add TypeScript specific content * They see me wip, they see me nae nae * Use admonitions
- Loading branch information
1 parent
475ea7f
commit bd55d5c
Showing
326 changed files
with
9,605 additions
and
2,472 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { execSync } from 'node:child_process' | ||
// Experimental: import config from './config.json' with { type: 'json' } | ||
|
||
import { readFileSync } from 'node:fs' | ||
import { exit } from 'node:process' | ||
|
||
/** @type {import('./config.json') } */ | ||
const config = JSON.parse( | ||
readFileSync(new URL('./config.json', import.meta.url)) | ||
) | ||
|
||
const jest = !config.custom || config.custom['flag.tests.jest'] | ||
const tstyche = config.custom?.['flag.tests.tstyche'] | ||
|
||
console.log( | ||
`[tests] tsc: ✅, tstyche: ${tstyche ? '✅' : '❌'}, jest: ${jest ? '✅' : '❌'}, ` | ||
) | ||
|
||
console.log('[tests] tsc (compile)') | ||
|
||
try { | ||
execSync('corepack yarn lint:types', { | ||
stdio: 'inherit', | ||
cwd: process.cwd(), | ||
}) | ||
} catch { | ||
exit(-1) | ||
} | ||
|
||
if (tstyche) { | ||
console.log('[tests] tstyche (type tests)') | ||
|
||
try { | ||
execSync('corepack yarn test:types', { | ||
stdio: 'inherit', | ||
cwd: process.cwd(), | ||
}) | ||
} catch { | ||
exit(-2) | ||
} | ||
} | ||
|
||
if (jest) { | ||
console.log('[tests] tstyche (implementation tests)') | ||
|
||
try { | ||
execSync('corepack yarn test:implementation', { | ||
stdio: 'inherit', | ||
cwd: process.cwd(), | ||
}) | ||
} catch { | ||
exit(-3) | ||
} | ||
} |
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
Oops, something went wrong.