Skip to content

Commit

Permalink
Build tests with bsb and move them out of jscomp
Browse files Browse the repository at this point in the history
  • Loading branch information
cknitt committed Oct 3, 2024
1 parent 5923f49 commit eae3bcb
Show file tree
Hide file tree
Showing 2,115 changed files with 726 additions and 1,285 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ jobs:

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

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

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

- name: Build playground compiler
if: matrix.build_playground
Expand Down
21 changes: 1 addition & 20 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,8 @@ coverage
.ninja_log
.bsdeps
.bsbuild
lib/prebuilt.ninja
lib/release.ninja
lib/build.ninja
lib/copy.ninja
jscomp/release.ninja
jscomp/build.ninja
jscomp/compiler.ninja
jscomp/runtime/build.ninja
jscomp/others/build.ninja
jscomp/stdlib-406/build.ninja
jscomp/napkin.ninja
jscomp/compilerEnv.ninja
env.ninja
jscomp/cppoVendor.ninja
jscomp/cppoEnv.ninja
jscomp/bin/bsb
jscomp/bin/bsc
lib/ocaml
lib/bs
lib/js/jscomp/test
jscomp/build_tests/*/lib/
tests/build_tests/*/lib/
#ignore temporary directory
*.goog.js
*.jsoo.js
Expand Down
2 changes: 1 addition & 1 deletion .istanbul.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ instrumentation:
extensions:
- .js
default-excludes: false
excludes: ["**/node_modules/**", "jscomp/test/**"]
excludes: ["**/node_modules/**", "tests/tests/**"]
embed-source: false
variable: __coverage__
compact: true
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,26 +146,26 @@ make test

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

This will run our `mocha` unit test suite defined in `jscomp/test`.
This will run our `mocha` unit test suite defined in `tests/tests`.

```
node scripts/ciTest.js -mocha
node scripts/test.js -mocha
```

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

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

```
node scripts/ciTest.js -bsb
node scripts/test.js -bsb
```

**Run ounit tests:**

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

```
node scripts/ciTest.js -ounit
node scripts/test.js -ounit
```

## Contributing to the Runtime
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ node_modules/.bin/semver:
npm install

test: lib
node scripts/ciTest.js -all
node scripts/test.js -all

test-syntax:
bash ./scripts/test_syntax.sh
Expand All @@ -43,7 +43,7 @@ test-syntax-roundtrip:
bash ./scripts/testok.sh

test-gentype:
make -C jscomp/gentype_tests/typescript-react-example clean test
make -C tests/gentype_tests/typescript-react-example clean test

test-all: test test-gentype

Expand Down Expand Up @@ -79,7 +79,7 @@ checkformat:
bash scripts/format_check.sh

clean-gentype:
make -C jscomp/gentype_tests/typescript-react-example clean
make -C tests/gentype_tests/typescript-react-example clean

clean-rewatch:
cargo clean --manifest-path rewatch/Cargo.toml && rm -f rewatch/rewatch
Expand Down
6 changes: 3 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"lineWidth": 80,
"attributePosition": "auto",
"ignore": [
"jscomp/build_tests/**/lib/**",
"jscomp/build_tests/**/src/**",
"jscomp/test/**",
"tests/build_tests/**",
"tests/tests/**",
"tests/tests_esmodule/**",
"lib/**",
"ninja/**",
"playground/**",
Expand Down
7 changes: 0 additions & 7 deletions bsconfig.json

This file was deleted.

4 changes: 0 additions & 4 deletions jscomp/bsb/bsb_package_specs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ let bs_package_output = "-bs-package-output"

[@@@warning "+9"]

(* Assume input is valid
coordinate with command line flag
{[ -bs-package-output commonjs:lib/js/jscomp/test:.js ]}
*)
let package_flag ({ format; in_source; suffix } : Bsb_spec_set.spec) dir =
Ext_string.inter2 bs_package_output
(Ext_string.concat5 (string_of_format format) Ext_string.single_colon
Expand Down
3 changes: 0 additions & 3 deletions jscomp/bsb/bsb_package_specs.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ val from_map : cwd:string -> Ext_json_types.t Map_string.t -> t
val get_list_of_output_js : t -> string -> string list

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

(* used to ensure each dir does exist *)
val list_dirs_by : t -> (string -> unit) -> unit
2 changes: 1 addition & 1 deletion jscomp/bsb_helper/bsb_helper_depfile_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ let oc_cmi buf namespace source =
When ns is turned on, `B` is interprted as `Ns-B` which is a cyclic dependency,
it can be errored out earlier
#5368: It turns out there are many false positives on detecting self-cycles (see: `jscomp/build_tests/zerocycle`)
#5368: It turns out there are many false positives on detecting self-cycles (see: `tests/build_tests/zerocycle`)
To properly solve this, we would need to `jscomp/ml/depend.ml` because
cmi and cmj is broken in the first place (same problem as in ocaml/ocaml#4618).
So we will just ignore the self-cycles. Even if there is indeed a self-cycle, it should fail to compile anyway.
Expand Down
4 changes: 1 addition & 3 deletions jscomp/bsc/rescript_compiler_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,7 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
"-runtime",string_call setup_runtime_path,
"*internal* Set the runtime directory";
"-make-runtime", unit_call Js_packages_state.make_runtime,
"*internal* make runtime library";
"-make-runtime-test", unit_call Js_packages_state.make_runtime_test,
"*internal* make runtime test library";
"*internal* make runtime library";

|]

Expand Down
1 change: 0 additions & 1 deletion jscomp/build_tests/scoped_ppx/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions jscomp/build_tests/super_errors/README.md

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions jscomp/core/js_dump_program.ml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ let es6_program ~output_dir fmt f (x : J.deps_program) =
let cxt = Js_dump.statements true cxt f x.program.block in
Js_dump_import_export.es6_export cxt f x.program.exports

(** Make sure github linguist happy
{[
require('Linguist')
Linguist::FileBlob.new('jscomp/test/test_u.js').generated?
]}
*)

let pp_deps_program ~(output_prefix : string)
(kind : Js_packages_info.module_system) (program : J.deps_program)
(f : Ext_pp.t) =
Expand Down
5 changes: 0 additions & 5 deletions jscomp/core/js_packages_info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ let runtime_package_specs : t =
];
}

(**
populated by the command line
*)
let runtime_test_package_specs : t = { name = Pkg_runtime; module_systems = [] }

let same_package_by_name (x : t) (y : t) =
match x.name with
| Pkg_empty -> y.name = Pkg_empty
Expand Down
2 changes: 0 additions & 2 deletions jscomp/core/js_packages_info.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ type t

val runtime_package_specs : t

val runtime_test_package_specs : t

val is_runtime_package : t -> bool

val same_package_by_name : t -> t -> bool
Expand Down
3 changes: 0 additions & 3 deletions jscomp/core/js_packages_state.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ let make_runtime () : unit =
make_runtime := true;
packages_info := Js_packages_info.runtime_package_specs

let make_runtime_test () : unit =
packages_info := Js_packages_info.runtime_test_package_specs

let set_package_map module_name =
(* set_package_name name ;
let module_name = Ext_namespace.namespace_of_package_name name in *)
Expand Down
2 changes: 0 additions & 2 deletions jscomp/core/js_packages_state.mli
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ val set_package_name : string -> unit

val make_runtime : unit -> unit

val make_runtime_test : unit -> unit

val set_package_map : string -> unit

val get_packages_info : unit -> Js_packages_info.t
Expand Down
17 changes: 0 additions & 17 deletions jscomp/test/ImportAttributes.js

This file was deleted.

7 changes: 0 additions & 7 deletions jscomp/test/acyc/a0_a1.js

This file was deleted.

8 changes: 0 additions & 8 deletions jscomp/test/acyc/a1_a2.js

This file was deleted.

8 changes: 0 additions & 8 deletions jscomp/test/acyc/a2_a3.js

This file was deleted.

8 changes: 0 additions & 8 deletions jscomp/test/acyc/a3_a4.js

This file was deleted.

10 changes: 0 additions & 10 deletions jscomp/test/acyc/a4_a5.js

This file was deleted.

21 changes: 0 additions & 21 deletions jscomp/test/acyc/x.js

This file was deleted.

Loading

0 comments on commit eae3bcb

Please sign in to comment.