Skip to content

Commit b3721f7

Browse files
committed
Add pnpm monorepo test
1 parent 7acedb3 commit b3721f7

File tree

4 files changed

+82
-2
lines changed

4 files changed

+82
-2
lines changed

repos/pnpm/monorepo/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2-
"name": "monorepo",
2+
"name": "pnpm-monorepo",
33
"version": "1.0.0",
44
"private": true,
55
"description": "",
66
"main": "index.js",
77
"scripts": {
8-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"test": "echo \"Error: no test specified\" && exit 1",
9+
"build": "rescript",
10+
"clean": "rescript clean"
911
},
1012
"keywords": [],
1113
"author": "",

repos/pnpm/monorepo/packages/a/src/A.res.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
let a = 1;
55

6+
let x = "e";
7+
68
export {
79
a,
10+
x,
811
}
912
/* No side effect */

tests/PnpmMonorepo.test.js

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

tests/PnpmMonorepo.test.res

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
open RescriptBun.Test
2+
3+
/*
4+
5+
6+
7+
*/
8+
9+
let repo = Path.resolve([import.meta.dir, "../repos/pnpm/monorepo"])
10+
11+
describe("A monorepo ReScript project using pnpm as package manager", () => {
12+
let orginalCwd: string = Process.cwd(Process.process)
13+
14+
beforeAllAsync(async () => {
15+
await changeCwdToRepository(
16+
repo,
17+
async () => {
18+
let _ = await sh`pnpm install`
19+
},
20+
)
21+
})
22+
23+
afterAllAsync(async () => {
24+
Process.chdir(Process.process, orginalCwd)
25+
})
26+
27+
testAsync("should clean", async () => {
28+
let _ = await sh`pnpm run clean`
29+
})
30+
31+
testAsync("should build", async () => {
32+
let _ = await sh`pnpm run build`
33+
})
34+
35+
testAsync("should clean/build individual project", async () => {
36+
let packageAPath = Path.resolve([repo, "packages", "a"])
37+
let _ = await (sh`npx rescript clean`)->ShellPromise.cwd(packageAPath)
38+
let _ = await (sh`npx rescript build`)->ShellPromise.cwd(packageAPath)
39+
})
40+
})

0 commit comments

Comments
 (0)