Skip to content

Commit 735c70d

Browse files
authored
test(melange): promote in source with multiple module systems (#12703)
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
1 parent ae38430 commit 735c70d

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Test multiple module systems with promotion in-source
2+
3+
$ cat > dune-project <<EOF
4+
> (lang dune 3.21)
5+
> (using melange 1.0)
6+
> EOF
7+
8+
$ cat > dune <<EOF
9+
> (melange.emit
10+
> (alias mel)
11+
> (target output)
12+
> (emit_stdlib false)
13+
> (promote (until-clean))
14+
> (module_systems
15+
> (commonjs mel.js)
16+
> (esm mjs)))
17+
> EOF
18+
$ cat > main.ml <<EOF
19+
> let () = Js.log "hello"
20+
> EOF
21+
22+
$ dune build @mel
23+
24+
Outputs both module systems
25+
26+
$ ls _build/default/output
27+
main.mel.js
28+
main.mjs
29+
$ node _build/default/output/main.mel.js
30+
hello
31+
$ node _build/default/output/main.mjs
32+
hello
33+
34+
$ find . -type f -not -path "./_build/*" | sort
35+
./dune
36+
./dune-project
37+
./main.mel.js
38+
./main.mjs
39+
./main.ml
40+
41+
$ dune clean
42+
$ cat > dune <<EOF
43+
> (melange.emit
44+
> (alias mel)
45+
> (target output)
46+
> (emit_stdlib false)
47+
> (promote
48+
> (until-clean)
49+
> (into ./output))
50+
> (module_systems
51+
> (commonjs mel.js)
52+
> (esm mjs)))
53+
> EOF
54+
$ cat > main.ml <<EOF
55+
> let () = Js.log "hello"
56+
> EOF
57+
58+
$ dune build @mel
59+
60+
$ find . -type f -not -path "./_build/*" | sort
61+
./dune
62+
./dune-project
63+
./main.ml
64+
./output/main.mel.js
65+
./output/main.mjs

0 commit comments

Comments
 (0)