tofail = [
'console.assert.html',
#'document.getElementsByName.html', // not implemented
'element.namedItem.html'
]


took = [
'customEvent.html',
'doctype.publicId.html',
'doctype.systemId.html',
'document.anchors.html',
'document.baseURI.html',
'document.body.childNodes.html',
'document.body.children.html',
'document.body.id.html',
'document.characterSet.html',
'document.currentScript.html',
'document.doctype.html',
'document.documentElement.html',
'document.documentURI.html',
'document.domain.html',
'document.getElementsByClassName.html',
'document.getElementsByTagName.html',
'document.head.html',
'document.images.html',
'document.links.html',
'document.location.href.html',
'document.new.html',
'document.querySelectorAll.html',
'document.querySelector.html',
'document.scripts.html',
'domparser.html',
'element.append.html',
'element.appendChild.html',
'element.attributes.html',
'element.checked.html',
'element.childElementCount.html',
'element.classList.html',
'element.className.html',
'element.cloneNode.html',
'element.closest.html',
'element.contains.html',
'element.dataset.html',
'element.dir.html',
'element.eventListener.html',
'element.firstChild.html',
'element.firstElementChild.html',
'element.getAttribute.html',
'element.getAttributeNode.html',
'element.getElementsByTagName.html',
'element.hasAttribute.html',
'element.hasAttributes.html',
'element.hasChildNodes.html',
'element.href.html',
'element.id.html',
'element.innerHTML.html',
'element.insertBefore.html',
'element.isEqualNode.html',
'element.isSameNode.html',
'element.lang.html',
'element.lastChild.html',
'element.lastElementChild.html',
'element.matches.html',
'element.nextElementSibling.html',
'element.nextSibling.html',
'element.nodeName.html',
'element.nodeType.html',
'element.nodeValue.html',
'element.onload.html',
'element.outerHTML.html',
'element.parentElement.html',
'element.parentNode.html',
'element.previousElementSibling.html',
'element.previousSibling.html',
'element.querySelectorAll.html',
'element.querySelector.html',
'element.remove.html',
'element.replaceWith.html',
'element.setAttribute.html',
'element.textContent.html',
#'event.html',
'eventListener.html',
'fragment.appendChild.html',
'fragment.firstChild.html',
'fragment.getElementsByTagName.html',
'fragment.hasChildNodes.html',
'fragment.new.html',
'image.new.html',
'keyboardEvent.html',
'navigator.appCodeName.html',
'node.nodeType.html',
'nodelist.forEach.html',
'style.backgroundClip.html',
'window.performance.now.html',
'window.requestAnimationFrame.html',
'window.setTimeout.html',
'URL.html',
]

mujs_fail = [
'element.prototype.matches.html'
]

mujs_timeout = [
'document.getElementsByClassName_2.html',
'fetch.html',
'URLSearchParams.html'
]

if conf_data.get('CONFIG_MUJS')
    tofail += mujs_fail
else
    took += mujs_fail
    took += mujs_timeout
endif

term = environment({'TERM':'dumb'})

if conf_data.get('CONFIG_ECMASCRIPT')
    foreach t: tofail
        test(t, elinks, protocol: 'exitcode', is_parallel: true, timeout: 30, should_fail: true, env: term, verbose: false, workdir: meson.project_source_root() / 'test/js/assert/',
            args: ['--test', '1', '--eval', 'set ecmascript.enable = 1',
            '--eval', 'set ecmascript.allow_xhr_file = 1',
            '--eval', 'set ecmascript.enable_console_log = 1',
            '--eval', 'set ui.sessions.fork_on_start = 0',
            '--no-connect', '1',
            '--no-home', '1',
        t])
    endforeach
    foreach t : took
        test(t, elinks, protocol: 'exitcode', is_parallel: true, timeout: 30, should_fail: false, env: term, verbose: false, workdir: meson.project_source_root() / 'test/js/assert',
            args: ['--test', '1', '--eval', 'set ecmascript.enable = 1',
            '--eval', 'set ecmascript.allow_xhr_file = 1',
            '--eval', 'set ecmascript.enable_console_log = 1',
            '--eval', 'set ui.sessions.fork_on_start = 0',
            '--no-connect', '1',
            '--no-home', '1',
        t])
    endforeach
endif
