@@ -6,7 +6,6 @@ import { Fragment, useEffect, useRef, useState } from "react";
66import { useWandbox } from "@my-code/runtime/wandbox/runtime" ;
77import { RuntimeContext } from "@my-code/runtime/interface" ;
88import { langConstants , RuntimeLang } from "@my-code/runtime/languages" ;
9- import { defineTests } from "@my-code/runtime/tests" ;
109import { usePyodide } from "@my-code/runtime/worker/pyodide" ;
1110import { useRuby } from "@my-code/runtime/worker/ruby" ;
1211import { useJSEval } from "@my-code/runtime/worker/jsEval" ;
@@ -25,6 +24,12 @@ import sub_h from "@my-code/runtime/samples/sub.h?raw";
2524import sub_cpp from "@my-code/runtime/samples/sub.cpp?raw" ;
2625import main2_rs from "@my-code/runtime/samples/main2.rs?raw" ;
2726import sub_rs from "@my-code/runtime/samples/sub.rs?raw" ;
27+ import {
28+ RUNTIME_TIMEOUTS ,
29+ waitForRuntimeReady ,
30+ } from "@my-code/runtime/tests/utils" ;
31+ import { replTests } from "@my-code/runtime/tests/repl" ;
32+ import { fileExecutionTests } from "@my-code/runtime/tests/fileExecution" ;
2833
2934export default function RuntimeTestPage ( ) {
3035 return (
@@ -143,7 +148,11 @@ function RuntimeSample({
143148 />
144149 ) ) }
145150 { config . exec && (
146- < ExecFile filenames = { config . exec } language = { langConstants ( lang ) } content = "" />
151+ < ExecFile
152+ filenames = { config . exec }
153+ language = { langConstants ( lang ) }
154+ content = ""
155+ />
147156 ) }
148157 { config . readonlyFiles ?. map ( ( filename ) => (
149158 < EditorComponent
@@ -230,7 +239,39 @@ function MochaTest() {
230239
231240 for ( const lang of Object . keys ( runtimeRef . current ) as RuntimeLang [ ] ) {
232241 runtimeRef . current [ lang ] . init ?.( ) ;
233- defineTests ( lang , runtimeRef ) ;
242+
243+ describe ( `${ lang } Runtime` , function ( ) {
244+ this . timeout ( RUNTIME_TIMEOUTS [ lang ] ) ;
245+
246+ beforeEach ( async function ( ) {
247+ this . timeout ( 60000 ) ;
248+ await waitForRuntimeReady ( lang , runtimeRef ) ;
249+ } ) ;
250+
251+ describe ( "REPL" , function ( ) {
252+ for ( const [ name , generator ] of Object . entries ( replTests ) ) {
253+ const body = generator ( lang ) ;
254+ if ( body ) {
255+ it ( name , async ( ) => body ( runtimeRef ) ) ;
256+ } else {
257+ it . skip ( name ) ;
258+ }
259+ }
260+ } ) ;
261+
262+ describe ( "File Execution" , function ( ) {
263+ for ( const [ name , generator ] of Object . entries (
264+ fileExecutionTests
265+ ) ) {
266+ const body = generator ( lang ) ;
267+ if ( body ) {
268+ it ( name , async ( ) => body ( runtimeRef ) ) ;
269+ } else {
270+ it . skip ( name ) ;
271+ }
272+ }
273+ } ) ;
274+ } ) ;
234275 }
235276
236277 const runner = mocha . run ( ) ;
0 commit comments