Skip to content

Commit 6557767

Browse files
Run tsc --noEmit **/*.d.ts as a part of the test suite
1 parent d14dffb commit 6557767

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed

Diff for: Plugins/PackageToJS/Templates/platforms/browser.js

+2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
import { MODULE_PATH /* #if USE_SHARED_MEMORY */, MEMORY_TYPE /* #endif */} from "../instantiate.js"
33
/* #if IS_WASI */
44
/* #if USE_WASI_CDN */
5+
// @ts-ignore
56
import { WASI, File, OpenFile, ConsoleStdout, PreopenDirectory } from 'https://cdn.jsdelivr.net/npm/@bjorn3/browser_wasi_shim@0.4.1/+esm';
67
/* #else */
8+
// @ts-ignore
79
import { WASI, File, OpenFile, ConsoleStdout, PreopenDirectory } from '@bjorn3/browser_wasi_shim';
810
/* #endif */
911
/* #endif */

Diff for: Plugins/PackageToJS/Templates/tsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"module": "esnext",
4+
"noEmit": true,
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"moduleResolution": "node"
8+
},
9+
"include": ["**/*.d.ts", "**/*.js"]
10+
}

Diff for: Plugins/PackageToJS/Tests/TemplatesTests.swift

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Testing
2+
import Foundation
3+
@testable import PackageToJS
4+
5+
@Suite struct TemplatesTests {
6+
static let templatesPath = URL(fileURLWithPath: #filePath)
7+
.deletingLastPathComponent()
8+
.deletingLastPathComponent()
9+
.appendingPathComponent("Templates")
10+
11+
/// `npx tsc -p Templates/tsconfig.json`
12+
@Test func tscCheck() throws {
13+
let tsc = Process()
14+
tsc.executableURL = try which("npx")
15+
tsc.arguments = ["tsc", "-p", Self.templatesPath.appending(path: "tsconfig.json").path]
16+
try tsc.run()
17+
tsc.waitUntilExit()
18+
#expect(tsc.terminationStatus == 0)
19+
}
20+
}

Diff for: package-lock.json

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"author": "swiftwasm",
3535
"license": "MIT",
3636
"devDependencies": {
37+
"@bjorn3/browser_wasi_shim": "^0.4.1",
3738
"@rollup/plugin-typescript": "^12.1.2",
39+
"@types/node": "^22.13.14",
3840
"playwright": "^1.51.0",
3941
"prettier": "3.5.3",
4042
"rollup": "^4.37.0",

0 commit comments

Comments
 (0)