Fix and enable integration tests in CI (#721)

* run jest only inside node + fix indexURL for integration tests

* add integration tests to CI

* use pytest from env
This commit is contained in:
Madhur Tandon
2022-08-25 22:01:05 +05:30
committed by GitHub
parent 7aa25712d9
commit 47494e62a7
3 changed files with 10 additions and 9 deletions

View File

@@ -62,6 +62,9 @@ jobs:
- name: Build and Test
run: make test
- name: Integration Tests
run: make test-integration
# Deploy to S3
- name: Configure AWS credentials
if: github.ref == 'refs/heads/main' # Only deploy on merge into main

View File

@@ -78,9 +78,9 @@ test:
make test-ts
make test-py
test-local:
test-integration:
make examples
pytest -vvs $(ARGS) tests/integration/ --log-cli-level=warning
$(PYTEST_EXE) -vvs $(ARGS) tests/integration/ --log-cli-level=warning
test-py:
@echo "Tests from $(src_dir)"

View File

@@ -15,17 +15,15 @@ export class PyodideRuntime extends Runtime {
async loadInterpreter(): Promise<void> {
console.log('creating pyodide runtime');
// eslint-disable-next-line
// @ts-ignore
let extraOpts: any = {}
if (inJest()) {
extraOpts = {indexURL: [process.cwd(), 'node_modules', 'pyodide'].join('/') }
}
let indexURL: string = this.src.substring(0, this.src.length - "/pyodide.js".length)
if (typeof process === 'object' && inJest()) {
indexURL = [process.cwd(), 'node_modules', 'pyodide'].join('/')
}
this.interpreter = await loadPyodide({
stdout: console.log,
stderr: console.log,
fullStdLib: false,
...extraOpts
indexURL
});
this.globals = this.interpreter.globals;