Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: correctly link types in `package.json` `exports` field * test: add typings tests for node16 module resolution * test: allow to use per-version tsconfig files * chore: add logs to typings tests ts version * chore: use "ts-node" in typings tests Co-authored-by: Artem Zakharchenko <kettanaito@gmail.com>
- Loading branch information
1 parent
dae755d
commit 3902b8c
Showing
7 changed files
with
55 additions
and
4 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,3 @@ | ||
export * from 'msw' | ||
export { setupServer } from 'msw/node' | ||
export { setupServer as setupNativeServer } from 'msw/native' |
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,3 @@ | ||
export * from 'msw' | ||
export { setupServer } from 'msw/node' | ||
export { setupServer as setupNativeServer } from 'msw/native' |
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,31 @@ | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import { spawnSync } from 'child_process' | ||
import { invariant } from 'outvariant' | ||
import tsPackageJson from 'typescript/package.json' | ||
|
||
const tsInstalledVersion = tsPackageJson.version | ||
invariant( | ||
tsInstalledVersion, | ||
'Failed to run typings tests: unable to determine TypeScript version', | ||
) | ||
|
||
const tsVersionMajorMinor = tsInstalledVersion.substring( | ||
0, | ||
tsInstalledVersion.lastIndexOf('.'), | ||
) | ||
|
||
const tsConfigPaths = [ | ||
path.resolve(__dirname, `tsconfig.${tsVersionMajorMinor}.json`), | ||
path.resolve(__dirname, 'tsconfig.json'), | ||
] | ||
const tsConfigPath = tsConfigPaths.find((path) => fs.existsSync(path)) as string | ||
|
||
console.log('Using tsconfig at "%s"', tsConfigPath) | ||
|
||
const { status } = spawnSync('tsc', ['-p', tsConfigPath], { | ||
cwd: path.resolve(__dirname, '../..'), | ||
stdio: 'inherit', | ||
}) | ||
|
||
process.exit(status || 0) |
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,6 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"moduleResolution": "Node16" | ||
} | ||
} |
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,3 @@ | ||
{ | ||
"extends": "./tsconfig.4.7.json" | ||
} |
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 |
---|---|---|
@@ -1,18 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"target": "esnext", | ||
"module": "commonjs", | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"moduleResolution": "Node", | ||
"types": ["node"], | ||
"typeRoots": ["../../node_modules/@types"], | ||
"lib": ["dom"], | ||
"baseUrl": ".", | ||
"typeRoots": ["node_modules/@types"], | ||
"paths": { | ||
"msw": ["../../"], | ||
"msw": ["../.."], | ||
"msw/*": ["../../*"] | ||
} | ||
}, | ||
"include": ["../../global.d.ts", "**/*.test-d.ts"], | ||
"include": ["../../global.d.ts", "**/*.test-d.*"], | ||
"exclude": ["node_modules"] | ||
} |