Skip to content

Commit 66cc218

Browse files
committed
Replace ts-node with swc-node
1 parent 48a756a commit 66cc218

File tree

5 files changed

+204
-13
lines changed

5 files changed

+204
-13
lines changed

.swcrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"jsc": {
4+
"parser": {
5+
"syntax": "typescript"
6+
},
7+
"target": "es2020"
8+
}
9+
}

ava.config.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
export default {
22
environmentVariables: {
3-
TS_NODE_PREFER_TS_EXTS: "true"
3+
TS_NODE_PREFER_TS_EXTS: "true",
4+
SWC_NODE_PROJECT: "./tsconfig.ava.json",
5+
SWCRC: "true"
46
},
57
extensions: {
68
ts: "module"
79
},
8-
nodeArguments: [
9-
"--no-warnings",
10-
"--experimental-fetch",
11-
"--loader=ts-node/esm/transpile-only"
12-
],
1310
files: [
1411
"src/**/*.test.ts"
1512
]

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"ci": "c8 pnpm test && c8 report --reporter=json",
3737
"build:types": "tsc --project tsconfig.d.ts.json",
3838
"build": "tsc && pnpm run build:types",
39-
"test": "ava --fail-fast",
39+
"test": "cross-env NODE_OPTIONS=\"--no-warnings --experimental-fetch --loader=@swc-node/register/esm\" ava --fail-fast",
4040
"cleanup": "del-cli @type lib",
4141
"postinstall": "husky install",
4242
"prepublishOnly": "pnpm run cleanup && pnpm run build && pinst --disable",
@@ -46,13 +46,15 @@
4646
"license": "MIT",
4747
"devDependencies": {
4848
"@octetstream/eslint-config": "7.2.1",
49+
"@swc-node/register": "^1.6.5",
4950
"@types/mime-types": "2.1.1",
5051
"@types/node": "20.2.1",
5152
"@types/sinon": "^10.0.15",
5253
"@typescript-eslint/eslint-plugin": "5.59.6",
5354
"@typescript-eslint/parser": "5.59.6",
5455
"ava": "5.2.0",
5556
"c8": "7.13.0",
57+
"cross-env": "^7.0.3",
5658
"del-cli": "5.0.0",
5759
"eslint": "8.40.0",
5860
"eslint-config-airbnb-typescript": "17.0.0",
@@ -66,7 +68,6 @@
6668
"lint-staged": "13.2.2",
6769
"pinst": "3.0.0",
6870
"sinon": "^15.0.4",
69-
"ts-node": "10.9.1",
7071
"ttypescript": "1.5.15",
7172
"typescript": "5.0.4",
7273
"web-streams-polyfill": "4.0.0-beta.3"

pnpm-lock.yaml

Lines changed: 184 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.ava.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src/**/*.ts"],
4+
"exclude": ["node_modules"]
5+
}

0 commit comments

Comments
 (0)