Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ def run_on_pty(self, cmd):
os.close(master)
os.close(slave)

def run_tsc(self, args):
Comment thread
brendandahl marked this conversation as resolved.
# We use skipLibCheck to prevent tsc from type checking the node_modules in the parent directory
# (e.g. in a single test mode).
return self.run_process(shared.get_npm_cmd('tsc') + ['--skipLibCheck'] + args)

# Test that running `emcc -v` always works even in the presence of `EMCC_CFLAGS`.
# This needs to work because many tools run `emcc -v` internally and it should
# always work even if the user has `EMCC_CFLAGS` set.
Expand Down Expand Up @@ -3566,8 +3571,7 @@ def test_embind_tsgen_end_to_end(self, opts, tsc_opts):
# also run the output JS file as a module in node.
copy_asset('other/embind_tsgen_package.json', 'package.json')

cmd = shared.get_npm_cmd('tsc') + ['embind_tsgen.d.ts', 'main.ts', '--target', 'es2021'] + tsc_opts
shared.check_call(cmd)
self.run_tsc(['embind_tsgen.d.ts', 'main.ts', '--target', 'es2021'] + tsc_opts)
actual = read_file('embind_tsgen.d.ts')
self.assertFileContents(test_file('other/embind_tsgen_module.d.ts'), actual)
self.assertContained('main ran\nts ran', self.run_js('main.js'))
Expand Down Expand Up @@ -3727,8 +3731,7 @@ def test_emit_tsd(self):
self.get_cflags())
self.assertFileContents(test_file('other/test_emit_tsd.d.ts'), read_file('test_emit_tsd.d.ts'))
# Test that the output compiles with a TS file that uses the definitions.
cmd = shared.get_npm_cmd('tsc') + [test_file('other/test_tsd.ts'), '--noEmit']
shared.check_call(cmd)
self.run_tsc([test_file('other/test_tsd.ts'), '--noEmit'])

@requires_dev_dependency('typescript')
def test_emit_tsd_sync_compilation(self):
Expand All @@ -3739,8 +3742,7 @@ def test_emit_tsd_sync_compilation(self):
self.get_cflags())
self.assertFileContents(test_file('other/test_emit_tsd_sync.d.ts'), read_file('test_emit_tsd_sync.d.ts'))
# Test that the output compiles with a TS file that uses the definitions.
cmd = shared.get_npm_cmd('tsc') + [test_file('other/test_tsd_sync.ts'), '--noEmit']
shared.check_call(cmd)
self.run_tsc([test_file('other/test_tsd_sync.ts'), '--noEmit'])

def test_emit_tsd_wasm_only(self):
expected = 'Wasm only output is not compatible with --emit-tsd'
Expand Down
Loading