mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
Fix main.test.ts (#1320)
This commit is contained in:
@@ -436,6 +436,10 @@ globalExport('pyscript_get_config', pyscript_get_config);
|
||||
|
||||
// main entry point of execution
|
||||
const globalApp = new PyScriptApp();
|
||||
globalApp.readyPromise = globalApp.main();
|
||||
|
||||
// This top level execution causes trouble in jest
|
||||
if (typeof jest === 'undefined') {
|
||||
globalApp.readyPromise = globalApp.main();
|
||||
}
|
||||
|
||||
export { version };
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import { describe, it, expect } from '@jest/globals';
|
||||
import { describe, it, beforeEach, expect } from '@jest/globals';
|
||||
import { UserError, ErrorCode } from '../../src/exceptions';
|
||||
import { PyScriptApp } from '../../src/main';
|
||||
|
||||
describe('Placeholder', () => {
|
||||
it('this is a placeholder, we need to fix and re-enable the commented out tests', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
describe('Test withUserErrorHandler', () => {
|
||||
class MyApp extends PyScriptApp {
|
||||
myRealMain: any;
|
||||
@@ -17,7 +12,7 @@ describe('Test withUserErrorHandler', () => {
|
||||
}
|
||||
|
||||
async _realMain() {
|
||||
await this.myRealMain();
|
||||
this.myRealMain();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +63,6 @@ describe('Test withUserErrorHandler', () => {
|
||||
}
|
||||
|
||||
const app = new MyApp(myRealMain);
|
||||
expect.assertions(1);
|
||||
await expect(async () => await app.main()).resolves.toThrow(new Error('Explosions!'));
|
||||
expect(app.main()).rejects.toThrow(new Error('Explosions!'));
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
@@ -4,3 +4,5 @@ import { directoryManifest } from '../../directoryManifest.mjs';
|
||||
jest.unstable_mockModule('../../src/python_package', async () => ({
|
||||
python_package: await directoryManifest('./src/python/'),
|
||||
}));
|
||||
|
||||
globalThis.jest = jest;
|
||||
|
||||
Reference in New Issue
Block a user