Skip to content

Commit 274ef72

Browse files
committed
Fix TS types and test paths
1 parent 2220894 commit 274ef72

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"CHANGELOG.md"
1919
],
2020
"scripts": {
21-
"build": "tsc -p tsconfig.json",
21+
"build": "pnpm exec tsc -p tsconfig.json",
2222
"test": "pnpm build && node --test tests/*.js"
2323
},
2424
"author": {
@@ -43,6 +43,7 @@
4343
"esbuild": "^0.27.0"
4444
},
4545
"devDependencies": {
46+
"@types/node": "^22.13.0",
4647
"esbuild": "^0.27.0",
4748
"typescript": "^5.7.3"
4849
},

pnpm-lock.yaml

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

tests/basic.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ const __dirname = path.dirname(__filename);
1616
process.chdir(path.resolve(__dirname));
1717

1818
test("simplest case", async () => {
19-
fs.rmSync(".output", { recursive: true, force: true });
19+
const outputDir = path.join(__dirname, ".output");
20+
fs.rmSync(outputDir, { recursive: true, force: true });
21+
fs.mkdirSync(outputDir, { recursive: true });
2022

2123
await esbuild.build({
22-
entryPoints: ["basic/index.js"],
24+
entryPoints: [path.join(__dirname, "basic/index.js")],
2325
bundle: true,
24-
outfile: ".output/bundle.js",
26+
outfile: path.join(outputDir, "bundle.js"),
2527
plugins: [
2628
postCssPlugin({
2729
plugins: [autoPrefixerPlugin],
@@ -30,10 +32,12 @@ test("simplest case", async () => {
3032
});
3133
esbuild.stop();
3234

33-
assert.ok(fs.existsSync("./.output/bundle.js"));
34-
assert.ok(fs.existsSync("./.output/bundle.css"));
35+
assert.ok(fs.existsSync(path.join(outputDir, "bundle.js")));
36+
assert.ok(fs.existsSync(path.join(outputDir, "bundle.css")));
3537

36-
const fileContent = fs.readFileSync("./.output/bundle.css").toString();
38+
const fileContent = fs
39+
.readFileSync(path.join(outputDir, "bundle.css"))
40+
.toString();
3741

3842
assert.ok(fileContent.includes("-webkit-border-radius"));
3943
assert.ok(fileContent.includes("display: flex"));

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"declaration": true,
99
"strict": true,
1010
"esModuleInterop": true,
11+
"types": ["node"],
1112
"forceConsistentCasingInFileNames": true,
1213
"skipLibCheck": true
1314
},

0 commit comments

Comments
 (0)