-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format code w/ Biome and switch from tsx to tsimp for tests
- Loading branch information
1 parent
be3a3df
commit e4540ce
Showing
36 changed files
with
853 additions
and
502 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ node_modules | |
|
||
.DS_Store | ||
|
||
/.tsimp | ||
/@type | ||
/lib | ||
/coverage | ||
|
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,15 +1,63 @@ | ||
// @ts-check | ||
|
||
/** | ||
* @typedef {Object} ParsedVersion | ||
* | ||
* @prop {number} major | ||
* @prop {number?} minor | ||
* @prop {number?} patch | ||
*/ | ||
|
||
/** | ||
* @return {ParsedVersion} | ||
*/ | ||
function parseVersion() { | ||
const parsed = process.version.match( | ||
/^v(?<major>[0-9]+)(?:\.(?<minor>[0-9]+)?)(?:\.(?<patch>[0-9]+))?/ | ||
) | ||
|
||
if (parsed?.groups?.major == null) { | ||
throw new Error("Can't extract Node.js version form process.version") | ||
} | ||
|
||
const major = Number.parseInt(parsed.groups.major, 10) | ||
const [minor, patch] = [parsed.groups.minor, parsed.groups.patch].map( | ||
value => (value ? Number.parseInt(value, 10) : null) | ||
) | ||
|
||
return {major, minor, patch} | ||
} | ||
|
||
/** | ||
* @returns {boolean} | ||
*/ | ||
function isOlderThanTwentyDotSix() { | ||
const {major, minor} = parseVersion() | ||
|
||
if (major > 20 || (major === 20 && minor && minor > 6)) { | ||
return false | ||
} | ||
|
||
return true | ||
} | ||
|
||
/** | ||
* @returns {string[]} | ||
*/ | ||
const getTsimpArgs = () => | ||
isOlderThanTwentyDotSix() | ||
? ["--loader", "tsimp/loader"] | ||
: ["--import", "tsimp"] | ||
|
||
export default { | ||
timeout: "5m", | ||
failFast: true, | ||
workerThreads: false, // Disable to make tsx work | ||
workerThreads: isOlderThanTwentyDotSix() === false, | ||
require: "global-jsdom/register", | ||
environmentVariables: { | ||
TS_NODE_PROJECT: "tsconfig.ava.json" | ||
}, | ||
extensions: { | ||
ts: "module", | ||
tsx: "module" | ||
}, | ||
files: [ | ||
"src/**/*.test.{ts,tsx}" | ||
] | ||
nodeArguments: ["--no-warnings", ...getTsimpArgs()], | ||
files: ["src/**/*.test.{ts,tsx}"] | ||
} |
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.