Skip to content

Commit 6d88e98

Browse files
authored
Build tests with bsb and move them out of jscomp (#7068)
* Build tests with bsb and move them out of jscomp * Fix Windows build * CHANGELOG
1 parent 5923f49 commit 6d88e98

File tree

2,116 files changed

+731
-1285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,116 files changed

+731
-1285
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,15 @@ jobs:
327327

328328
- name: Run tests
329329
if: runner.os != 'Windows'
330-
run: node scripts/ciTest.js -all
330+
run: node scripts/test.js -all
331331

332332
- name: Run gentype tests
333333
if: runner.os != 'Windows'
334-
run: make -C jscomp/gentype_tests/typescript-react-example clean test
334+
run: make -C tests/gentype_tests/typescript-react-example clean test
335335

336336
- name: Run tests (Windows)
337337
if: runner.os == 'Windows'
338-
run: node scripts/ciTest.js -mocha -theme -format
338+
run: node scripts/test.js -mocha -theme -format
339339

340340
- name: Build playground compiler
341341
if: matrix.build_playground

.gitignore

+1-20
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,8 @@ coverage
5151
.ninja_log
5252
.bsdeps
5353
.bsbuild
54-
lib/prebuilt.ninja
55-
lib/release.ninja
56-
lib/build.ninja
57-
lib/copy.ninja
58-
jscomp/release.ninja
59-
jscomp/build.ninja
60-
jscomp/compiler.ninja
61-
jscomp/runtime/build.ninja
62-
jscomp/others/build.ninja
63-
jscomp/stdlib-406/build.ninja
64-
jscomp/napkin.ninja
65-
jscomp/compilerEnv.ninja
66-
env.ninja
67-
jscomp/cppoVendor.ninja
68-
jscomp/cppoEnv.ninja
69-
jscomp/bin/bsb
70-
jscomp/bin/bsc
7154
lib/ocaml
72-
lib/bs
73-
lib/js/jscomp/test
74-
jscomp/build_tests/*/lib/
55+
tests/build_tests/*/lib/
7556
#ignore temporary directory
7657
*.goog.js
7758
*.jsoo.js

.istanbul.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ instrumentation:
44
extensions:
55
- .js
66
default-excludes: false
7-
excludes: ["**/node_modules/**", "jscomp/test/**"]
7+
excludes: ["**/node_modules/**", "tests/tests/**"]
88
embed-source: false
99
variable: __coverage__
1010
compact: true

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
- Remove uncurried flag from bsb. https://github.com/rescript-lang/rescript-compiler/pull/7049
4545
- Build runtime/stdlib files with rescript/bsb instead of ninja.js. https://github.com/rescript-lang/rescript-compiler/pull/7063
46+
- Build tests with bsb and move them out of jscomp. https://github.com/rescript-lang/rescript-compiler/pull/7068
4647

4748
# 12.0.0-alpha.3
4849

CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -146,26 +146,26 @@ make test
146146

147147
**Run Mocha tests only (for our runtime code):**
148148

149-
This will run our `mocha` unit test suite defined in `jscomp/test`.
149+
This will run our `mocha` unit test suite defined in `tests/tests`.
150150

151151
```
152-
node scripts/ciTest.js -mocha
152+
node scripts/test.js -mocha
153153
```
154154

155155
**Run build system test (integration tests):**
156156

157-
This will run the whole build system test suite defined in `jscomp/build_tests`.
157+
This will run the whole build system test suite defined in `tests/build_tests`.
158158

159159
```
160-
node scripts/ciTest.js -bsb
160+
node scripts/test.js -bsb
161161
```
162162

163163
**Run ounit tests:**
164164

165165
This will run unit tests for compiler related modules. The tests can be found in `jscomp/ounit_tests`.
166166

167167
```
168-
node scripts/ciTest.js -ounit
168+
node scripts/test.js -ounit
169169
```
170170

171171
## Contributing to the Runtime

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ node_modules/.bin/semver:
3030
npm install
3131

3232
test: lib
33-
node scripts/ciTest.js -all
33+
node scripts/test.js -all
3434

3535
test-syntax:
3636
bash ./scripts/test_syntax.sh
@@ -43,7 +43,7 @@ test-syntax-roundtrip:
4343
bash ./scripts/testok.sh
4444

4545
test-gentype:
46-
make -C jscomp/gentype_tests/typescript-react-example clean test
46+
make -C tests/gentype_tests/typescript-react-example clean test
4747

4848
test-all: test test-gentype
4949

@@ -79,7 +79,7 @@ checkformat:
7979
bash scripts/format_check.sh
8080

8181
clean-gentype:
82-
make -C jscomp/gentype_tests/typescript-react-example clean
82+
make -C tests/gentype_tests/typescript-react-example clean
8383

8484
clean-rewatch:
8585
cargo clean --manifest-path rewatch/Cargo.toml && rm -f rewatch/rewatch

biome.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"lineWidth": 80,
2222
"attributePosition": "auto",
2323
"ignore": [
24-
"jscomp/build_tests/**/lib/**",
25-
"jscomp/build_tests/**/src/**",
26-
"jscomp/test/**",
24+
"tests/build_tests/**",
25+
"tests/tests/**",
26+
"tests/tests_esmodule/**",
2727
"lib/**",
2828
"ninja/**",
2929
"playground/**",

bsconfig.json

-7
This file was deleted.

jscomp/bsb/bsb_package_specs.ml

-4
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ let bs_package_output = "-bs-package-output"
131131

132132
[@@@warning "+9"]
133133

134-
(* Assume input is valid
135-
coordinate with command line flag
136-
{[ -bs-package-output commonjs:lib/js/jscomp/test:.js ]}
137-
*)
138134
let package_flag ({ format; in_source; suffix } : Bsb_spec_set.spec) dir =
139135
Ext_string.inter2 bs_package_output
140136
(Ext_string.concat5 (string_of_format format) Ext_string.single_colon

jscomp/bsb/bsb_package_specs.mli

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ val from_map : cwd:string -> Ext_json_types.t Map_string.t -> t
2929
val get_list_of_output_js : t -> string -> string list
3030

3131
val package_flag_of_package_specs : t -> dirname:string -> string
32-
(**
33-
Sample output: {[ -bs-package-output commonjs:lib/js/jscomp/test]}
34-
*)
3532

3633
(* used to ensure each dir does exist *)
3734
val list_dirs_by : t -> (string -> unit) -> unit

jscomp/bsb_helper/bsb_helper_depfile_gen.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ let oc_cmi buf namespace source =
106106
When ns is turned on, `B` is interprted as `Ns-B` which is a cyclic dependency,
107107
it can be errored out earlier
108108
109-
#5368: It turns out there are many false positives on detecting self-cycles (see: `jscomp/build_tests/zerocycle`)
109+
#5368: It turns out there are many false positives on detecting self-cycles (see: `tests/build_tests/zerocycle`)
110110
To properly solve this, we would need to `jscomp/ml/depend.ml` because
111111
cmi and cmj is broken in the first place (same problem as in ocaml/ocaml#4618).
112112
So we will just ignore the self-cycles. Even if there is indeed a self-cycle, it should fail to compile anyway.

jscomp/bsc/rescript_compiler_main.ml

+1-3
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
438438
"-runtime",string_call setup_runtime_path,
439439
"*internal* Set the runtime directory";
440440
"-make-runtime", unit_call Js_packages_state.make_runtime,
441-
"*internal* make runtime library";
442-
"-make-runtime-test", unit_call Js_packages_state.make_runtime_test,
443-
"*internal* make runtime test library";
441+
"*internal* make runtime library";
444442

445443
|]
446444

jscomp/build_tests/scoped_ppx/.gitignore

-1
This file was deleted.

jscomp/build_tests/super_errors/README.md

-5
This file was deleted.

jscomp/build_tests/transitive_pinned_dependency1/.gitignore

-1
This file was deleted.

jscomp/build_tests/transitive_pinned_dependency2/.gitignore

-1
This file was deleted.

jscomp/core/js_dump_program.ml

-7
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ let es6_program ~output_dir fmt f (x : J.deps_program) =
101101
let cxt = Js_dump.statements true cxt f x.program.block in
102102
Js_dump_import_export.es6_export cxt f x.program.exports
103103

104-
(** Make sure github linguist happy
105-
{[
106-
require('Linguist')
107-
Linguist::FileBlob.new('jscomp/test/test_u.js').generated?
108-
]}
109-
*)
110-
111104
let pp_deps_program ~(output_prefix : string)
112105
(kind : Js_packages_info.module_system) (program : J.deps_program)
113106
(f : Ext_pp.t) =

jscomp/core/js_packages_info.ml

-5
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ let runtime_package_specs : t =
6666
];
6767
}
6868

69-
(**
70-
populated by the command line
71-
*)
72-
let runtime_test_package_specs : t = { name = Pkg_runtime; module_systems = [] }
73-
7469
let same_package_by_name (x : t) (y : t) =
7570
match x.name with
7671
| Pkg_empty -> y.name = Pkg_empty

jscomp/core/js_packages_info.mli

-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ type t
3838

3939
val runtime_package_specs : t
4040

41-
val runtime_test_package_specs : t
42-
4341
val is_runtime_package : t -> bool
4442

4543
val same_package_by_name : t -> t -> bool

jscomp/core/js_packages_state.ml

-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ let make_runtime () : unit =
3434
make_runtime := true;
3535
packages_info := Js_packages_info.runtime_package_specs
3636

37-
let make_runtime_test () : unit =
38-
packages_info := Js_packages_info.runtime_test_package_specs
39-
4037
let set_package_map module_name =
4138
(* set_package_name name ;
4239
let module_name = Ext_namespace.namespace_of_package_name name in *)

jscomp/core/js_packages_state.mli

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ val set_package_name : string -> unit
2626

2727
val make_runtime : unit -> unit
2828

29-
val make_runtime_test : unit -> unit
30-
3129
val set_package_map : string -> unit
3230

3331
val get_packages_info : unit -> Js_packages_info.t

jscomp/test/ImportAttributes.js

-17
This file was deleted.

jscomp/test/acyc/a0_a1.js

-7
This file was deleted.

jscomp/test/acyc/a1_a2.js

-8
This file was deleted.

jscomp/test/acyc/a2_a3.js

-8
This file was deleted.

jscomp/test/acyc/a3_a4.js

-8
This file was deleted.

jscomp/test/acyc/a4_a5.js

-10
This file was deleted.

jscomp/test/acyc/x.js

-21
This file was deleted.

0 commit comments

Comments
 (0)