Files
pyscript/pyscriptjs/jest.config.js
Hood Chatham 854e9d1378 Refactor pyexec (#1318)
This is some refactoring I did on the way towards resolving pyscript#1313.
I added a new _run_pyscript Python function which executes the code
inside a context manager that sets the display target. We can then
return a JS object wrapper directly from Python.

I moved the "installation" of the pyscript module to loadInterpreter,
and pyimport pyscript_py there and give it a type. This avoids a bunch
of creating and deleting of proxies for pyscript_py and allows us to
give it a type once and for all.

I also did some minor logic cleanup in a few places.
2023-03-30 04:34:24 +02:00

26 lines
697 B
JavaScript

//jest.config.js
module.exports = {
preset: 'ts-jest',
setupFilesAfterEnv: ['./tests/unit/setup.ts'],
testEnvironment: './jest-environment-jsdom.js',
extensionsToTreatAsEsm: ['.ts'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'tsconfig.json',
useESM: true,
},
],
},
verbose: true,
testEnvironmentOptions: {
url: 'http://localhost',
},
moduleNameMapper: {
'^.*?pyscript.py$': '<rootDir>/__mocks__/_pyscript.js',
'^[./a-zA-Z0-9$_-]+\\.py$': '<rootDir>/__mocks__/fileMock.js',
'\\.(css)$': '<rootDir>/__mocks__/cssMock.js',
},
};