Skip to content
Open
Show file tree
Hide file tree
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
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
PYTHON ?= python3
# CURDIR is reliable with spaces; lastword(MAKEFILE_LIST) breaks on "Web Browser/..."
ROOT := $(CURDIR)

export PYTHONPATH := $(ROOT)

.PHONY: help test test-simple test-es6 test-es7 test-es8 test-async test-language test-all

help:
@echo "Js2Py test targets:"
@echo " make test Run quick integration tests (default)"
@echo " make test-simple Run simple_test.py (ES5 + ES6 smoke tests)"
@echo " make test-es6 Run tests/test_es6.py"
@echo " make test-es7 Run tests/test_es7.py"
@echo " make test-es8 Run tests/test_es8.py"
@echo " make test-async Run tests/test_async.py"
@echo " make test-language Run ES5.1 language suite (tests/run.py, slow)"
@echo " make test-all Run quick tests and the language suite"

test: test-simple test-es6 test-es7 test-es8 test-async
@:

test-simple:
PYTHONPATH="$(ROOT)" $(PYTHON) "$(ROOT)/simple_test.py"

test-es6:
PYTHONPATH="$(ROOT)" $(PYTHON) "$(ROOT)/tests/test_es6.py"

test-es7:
PYTHONPATH="$(ROOT)" $(PYTHON) "$(ROOT)/tests/test_es7.py"

test-es8:
PYTHONPATH="$(ROOT)" $(PYTHON) "$(ROOT)/tests/test_es8.py"

test-async:
PYTHONPATH="$(ROOT)" $(PYTHON) "$(ROOT)/tests/test_async.py"

test-language:
@test -f "$(ROOT)/tests/node_failed.txt" || touch "$(ROOT)/tests/node_failed.txt"
cd "$(ROOT)/tests" && PYTHONPATH="$(ROOT)" $(PYTHON) run.py

test-all: test test-language
3 changes: 2 additions & 1 deletion js2py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
__all__ = [
'EvalJs', 'translate_js', 'import_js', 'eval_js', 'parse_js',
'translate_file', 'run_file', 'disable_pyimport', 'eval_js6',
'translate_js6', 'PyJsException', 'get_file_contents',
'translate_js6', 'eval_js7', 'translate_js7', 'eval_js8', 'translate_js8',
'eval_js_async', 'translate_js_async', 'drain_event_loop', 'PyJsException', 'get_file_contents',
'write_file_contents', 'require'
]

Expand Down
5 changes: 5 additions & 0 deletions js2py/async_js/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Async/await support for Js2Py."""

from .transform import downlevel_async_await, looks_like_async

__all__ = ['downlevel_async_await', 'looks_like_async']
Loading