-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt generator-exist, add tests #15
Conversation
- generator-exist provides common scaffolding and integrates practices for testing and CI - use generator-exist library template, so the package is now a library, not an application - adopt the community convention for XQuery file extensions, using .xqm for library modules and using .xq for main modules - remove controller.xql and parse.xql - since this is now a library package - make minimal changes to pass generator-exist's npm tests (full test suite based on test.md to come) - increment version to 1.0.0 given the change from application to library package and the major under-the-hood changes
The first few examples from test.md - paragraph delimiters - inline-code - inline-code-backticks Created by comparing test.md to HTML produced by the library, e.g., view-source:https://exist-db.org/exist/apps/markdown/test.md
Drat, I just realized I was on an old checkout of the generator-exist "master" branch, whereas development has moved to "main." This explains why some things I was expecting weren't present in the generated package. I will regenerate the package. |
- adapted from https://github.com/eXist-db/templating - note that gulp-exist "^4.0.0" (which downloaded 4.3.0) produced errors during `npm test` (reproducible in templating), so I limited it to "4.0.0" until we can get the current gulp-exist working again. See eXist-db/templating#11.
It turns out there weren't many changes in generator-exist main branch. I was really after the functions I liked from the templating repo - where I could invoke So now
I recall the maven-based apps like semver.xq also enjoy this auto-deploy-during-test feature. I nearly jumped ship for that approach before I discovered the workaround to get gulp-exist working again. Either approach would be fine. |
I think I added all the necessary tests. The inline HTML doesn't transform the <mark> element, and others, such as htmlblocks-with-markdown, output too many <body> elements.
Added `%test:pending` for failing tests.
In `declare %annotation function`, the annotations are indented but not the `declare` or `function` keywords. This allows the function body to be indented only one level, rather than 2. Also, applied indenting to expected results for readability.
and delete 'HTML blocks' test which was really a code block test
Implicitly demonstrated with test.md and the operations of the library.
With @lguariento's kind help and hard work, we now have a test suite containing 16 tests based on the implicit tests in the test.md file at the root of this repository. Of the 16 tests, 13 pass, and 3 are marked pending, since the library does not return the expected output. I will turn each pending test into a new issue, in the hope of closing them and laying a firm foundation for further development of this library. Here is the XQSuite test report: <testsuite package="http://exist-db.org/xquery/markdown/tests"
timestamp="2022-02-07T23:45:51.978-05:00" tests="16" failures="0" errors="0" pending="3"
time="PT0.023S">
<testcase name="Atx-style headers and hierarchically nested sections"
class="tests:atx-style-headers-and-nested-sections"/>
<testcase name="Code Blocks" class="tests:code-blocks">
<pending>The raw code block is piped into a p instead of a pre/@data-language=xquery structure</pending>
</testcase>
<testcase name="HTML block containing markdown" class="tests:html-block-containing-markdown">
<pending>Extra body elements are inserted into the divs; div structure is mangled</pending>
</testcase>
<testcase name="Images" class="tests:images"/>
<testcase name="Format inline code snippets with a pair of backticks" class="tests:inline-code"/>
<testcase name="Use two backticks to allow one backtick inside" class="tests:inline-code-escape-backticks"/>
<testcase name="Inline HTML" class="tests:inline-html">
<pending>The mark element is not rendered</pending>
</testcase>
<testcase name="Labels" class="tests:labels"/>
<testcase name="Links" class="tests:links"/>
<testcase name="Nested list" class="tests:nested-list"/>
<testcase name="Paragraphs are separated from following blocks by a blank line" class="tests:paragraph-delimiters"/>
<testcase name="Quotes" class="tests:quotes"/>
<testcase name="Simple lists" class="tests:simple-list"/>
<testcase name="Table" class="tests:table"/>
<testcase name="Task list" class="tests:task-list"/>
<testcase name="TEI output" class="tests:tei-output"/>
</testsuite> Thanks to @duncdrum for generator-exist, which provided the new scaffolding for this package and the many affordances for test-driven development, including GitHub Actions support. Thanks also to @wolfgangmm and @line-o for providing a model of a full build/deploy/test harness in the templating app. |
p.s. I'd still gladly welcome contributions of an XQuery wrapper for commonmark-java - along the lines of Andy Bunce's https://github.com/expkg-zone58/ex-markdown XQuery wrapper for flexmark-java, for BaseX. Commonmark has 700 tests and a spec that covers GFM. This is a fun project and all, but we'll be lucky to fix these 3 pending tests... |
I'd been reviewing #14 when I created the branch. The change doesn't affect the current test suite, but we'll need tests in that PR before we merge it in to prevent future regressions.
Awesome work @joewiz and @lguariento! 🎉 I am happy to merge this. Especially making this a library package really brings this project forward.
I am eager to hear your feedback on this and happy to help. |
@line-o i m not sure if copying is superflous, since markdown comes as part of the autodeployed packages OOTB iirc. To achieve maximum speedup of tests, i would suggest to host a local volume with just the markdown xar inside into the container's autodeploy. |
To my knowledge Markdown was dropped from autodeploy since 5.3.0 |
And testing if the package can be installed is therefore useful information |
Especially since autodeploy does not install dependencies |
I just checked @duncdrum the markdown package is no longer bundled with exist. |
Ah good if it doesn't ship by default anymore, then there shouldn't be a naming confilct. Installing from autodeploy will install dependencies. Using a volume will theefoe test the install just fine, the thing it does is save us around 30s on every run for exist to install dashboard, monex, … before it becomes responsive |
OK, so the 30s configuration ramp-up that existdb takes on the very first run is definitely something we should address for CI in general not only this package. A few possible solutions come to my mind
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said I am happy to merge this as is. Any of the comments I made are just enhancements that do not block this. We can also wait for them to be incorporated into this PR if we choose so.
@duncdrum how would that be possible to succeed for instances that start without access to the internet? |
Install via autodeploy checks to see if any declared dependency is present in the db. So the hack is to make sure that the dependency gets processed first. Nevertheless the check is performed, and installation succeed / fails based on the check. and yes happy for merge to proceed |
Yes, correct. That also means no dependencies will be installed, right? |
@duncdrum Thank you! @lguariento @line-o @duncdrum This PR is included in https://github.com/eXist-db/exist-markdown/releases/tag/v1.0.0, also available at https://exist-db.org/exist/apps/public-repo/packages/markdown.html?eXist-db-min-version=5.3.0. |
Use generator-exist for scaffolding and integrated testing and CI.
Use templating's gulp integration for building/deploying/test running.
.xqm
for library modules and using.xq
for main modulescontroller.xql
andparse.xql
- since this is now a library packagetest.md
Closes #13.