-
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.
- Loading branch information
1 parent
cbf8a0b
commit 15f0554
Showing
3 changed files
with
2 additions
and
226 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 |
---|---|---|
@@ -1,62 +1,10 @@ | ||
// @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 { | ||
failFast: true, | ||
workerThreads: isOlderThanTwentyDotSix() === false, | ||
workerThreads: false, | ||
require: "global-jsdom/register", | ||
extensions: { | ||
ts: "module", | ||
tsx: "module" | ||
}, | ||
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
Oops, something went wrong.