Skip to content

Commit 7d07380

Browse files
committed
Migrate tests to use Node.js native .ts runner
1 parent 246048d commit 7d07380

File tree

7 files changed

+74
-59
lines changed

7 files changed

+74
-59
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
"@changesets/cli": "^2.27.11",
1717
"@total-typescript/tsconfig": "^1.0.4",
1818
"pkg-pr-new": "^0.0.20",
19-
"tsx": "^4.19.2",
2019
"turbo": "^2.3.3",
21-
"typescript": "^5.7.3"
20+
"typescript": "^5.8.2"
2221
},
23-
"packageManager": "pnpm@9.7.1"
22+
"packageManager": "pnpm@10.6.4"
2423
}

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"scripts": {
3838
"build": "tsc",
3939
"dev": "tsc --watch",
40-
"test": "node --import tsx --test \"tests/**/*.test.ts\""
40+
"test": "node --test \"tests/**/*.test.ts\""
4141
},
4242
"dependencies": {
43-
"consola": "^3.4.0",
43+
"consola": "^3.4.1",
4444
"jiti": "2.3.3",
4545
"js-yaml": "^4.1.0",
4646
"neotraverse": "^0.6.18",

packages/core/tests/unit/config-validation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { strict as assert } from 'node:assert';
22
import { describe, it } from 'node:test';
33
import { validateFinalConfig, validateInitialConfig } from '../../dist/config/config.js';
4-
import { sampleValidConfig } from '../utils.js';
4+
import { sampleValidConfig } from '../utils.ts';
55

66
describe('Configuration validation', () => {
77
it('should throw when invalid', () => {

packages/core/tests/unit/integrations.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { strict as assert } from 'node:assert';
22
import { describe, it } from 'node:test';
3-
import consola from 'consola';
3+
import { consola } from 'consola';
44
import { runSetupHook } from '../../dist/integrations/integrations.js';
5-
import { validateFinalConfig } from '../../src/config/config.js';
6-
import type { CompleteLunariaUserConfig } from '../../src/integrations/types.js';
7-
import { sampleValidConfig } from '../utils.js';
5+
import { validateFinalConfig } from '../../dist/config/config.js';
6+
import type { CompleteLunariaUserConfig } from '../../dist/integrations/types.js';
7+
import { sampleValidConfig } from '../utils.ts';
88

99
describe('Integration setup hook', async () => {
1010
it("should throw if it tries to update the config's `integrations` field", async () => {
@@ -20,6 +20,7 @@ describe('Integration setup hook', async () => {
2020
...sampleValidConfig,
2121
integrations: [sampleIntegration],
2222
},
23+
// @ts-expect-error: The consola instance has an weird type issue.
2324
consola,
2425
),
2526
{
@@ -63,6 +64,7 @@ describe('Integration setup hook', async () => {
6364
},
6465
integrations: [sampleIntegration],
6566
},
67+
// @ts-expect-error: The consola instance has an weird type issue.
6668
consola,
6769
);
6870

@@ -109,6 +111,7 @@ describe('Integration setup hook', async () => {
109111
...sampleValidConfig,
110112
integrations: [sampleIntegration],
111113
},
114+
// @ts-expect-error: The consola instance has an weird type issue.
112115
consola,
113116
);
114117

packages/core/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"include": ["src"],
44
"compilerOptions": {
55
"rootDir": "src",
6-
"outDir": "dist"
6+
"outDir": "dist",
7+
"erasableSyntaxOnly": true
78
},
89
"references": [{ "path": "./tsconfig.test.json" }]
910
}

packages/core/tsconfig.test.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"references": [{ "path": "./tsconfig.json" }],
44
"compilerOptions": {
55
"composite": true,
6+
"erasableSyntaxOnly": true,
7+
"allowImportingTsExtensions": true,
8+
"emitDeclarationOnly": true,
69
"types": ["@types/node"]
710
}
811
}

0 commit comments

Comments
 (0)