mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
WIP
This commit is contained in:
@@ -5,9 +5,9 @@ export const patch_promise = window => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const _then = Promise.prototype.then
|
const _then = window.Promise.prototype.then
|
||||||
|
|
||||||
Promise.prototype.then = function then(on_resolve, on_reject) {
|
window.Promise.prototype.then = function then(on_resolve, on_reject) {
|
||||||
let children = window.get_children()
|
let children = window.get_children()
|
||||||
if(children == null) {
|
if(children == null) {
|
||||||
children = []
|
children = []
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import * as pathlib from 'path'
|
|||||||
import {COMMANDS} from '../src/cmd.js'
|
import {COMMANDS} from '../src/cmd.js'
|
||||||
import {root_calltree_node} from '../src/calltree.js'
|
import {root_calltree_node} from '../src/calltree.js'
|
||||||
import { assert_equal, test_initial_state, } from './utils.js'
|
import { assert_equal, test_initial_state, } from './utils.js'
|
||||||
|
import {tests} from './test.js'
|
||||||
|
|
||||||
// Should work same as src/filesystem.js:load_dir
|
// Should work same as src/filesystem.js:load_dir
|
||||||
const load_dir = path => {
|
const load_dir = path => {
|
||||||
@@ -85,6 +86,6 @@ const run = root.children[0]
|
|||||||
assert_equal(root_calltree_node(state).ok, true)
|
assert_equal(root_calltree_node(state).ok, true)
|
||||||
|
|
||||||
// Assert that run children are tests
|
// Assert that run children are tests
|
||||||
assert_equal(run.children.length > 100, true)
|
assert_equal(run.children.length, tests.length)
|
||||||
|
|
||||||
console.timeEnd('run')
|
console.timeEnd('run')
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export const test_only = (message, t) => test(message, t, true)
|
|||||||
export const run = Object.defineProperty(new Function('tests', `
|
export const run = Object.defineProperty(new Function('tests', `
|
||||||
// Runs test, return failure or null if not failed
|
// Runs test, return failure or null if not failed
|
||||||
const run_test = t => {
|
const run_test = t => {
|
||||||
return Promise.resolve(t.test())
|
return Promise.resolve().then(t.test)
|
||||||
.then(() => null)
|
.then(() => null)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
if(globalThis.process != null) {
|
if(globalThis.process != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user