File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 52
52
//! // FLAGS: --target=web
53
53
//! // FLAGS: --target=nodejs
54
54
//! ```
55
+ //!
56
+ //! ## Testing only types
57
+ //!
58
+ //! In some cases, we are only interested in testing the generated `.d.ts` file.
59
+ //! In this case, add a comment at the top of the test file:
60
+ //!
61
+ //! ```rust
62
+ //! // TYPES ONLY
63
+ //! ```
55
64
56
65
use anyhow:: { bail, Result } ;
57
66
use assert_cmd:: prelude:: * ;
@@ -119,6 +128,8 @@ fn runtest(test: &Path) -> Result<()> {
119
128
let root = repo_root ( ) ;
120
129
let root = root. display ( ) ;
121
130
131
+ let types_only = contents. contains ( "// TYPES ONLY" ) ;
132
+
122
133
// parse target declarations
123
134
let mut all_flags: Vec < _ > = contents
124
135
. lines ( )
@@ -215,7 +226,7 @@ fn runtest(test: &Path) -> Result<()> {
215
226
_ => "reference_test.js" ,
216
227
} ;
217
228
218
- if !contents . contains ( "async" ) {
229
+ if !types_only {
219
230
let js = fs:: read_to_string ( out_dir. join ( main_js_file) ) ?;
220
231
assert_same ( & js, & test. with_extension ( "js" ) ) ?;
221
232
let wat = sanitize_wasm ( & out_dir. join ( "reference_test_bg.wasm" ) ) ?;
Original file line number Diff line number Diff line change
1
+ // TYPES ONLY
2
+
1
3
use wasm_bindgen:: prelude:: * ;
2
4
3
5
#[ wasm_bindgen]
Original file line number Diff line number Diff line change
1
+ // TYPES ONLY
2
+
1
3
use wasm_bindgen:: prelude:: * ;
2
4
3
5
#[ wasm_bindgen]
You can’t perform that action at this time.
0 commit comments