Skip to content

Commit b19a9f7

Browse files
committed
Replace bun with junit-js for JS tests; fix inline validator generation bug (#31)
- Add junit-js 2.0.0 dependency with GraalVM exclusions to avoid version conflicts - Add JUnit Vintage engine to run JUnit 4 tests under JUnit 5 Platform - Configure Surefire to discover *TestSuite.java files - Delete bun-based src/test/js/ directory (replaced by junit-js) - Add JtdEsmJsTestSuite.java to run JS tests via @RunWith(JSRunner.class) - Add boolean-schema.test.js and nested-elements-empty-focused.test.js - Tests run in GraalVM polyglot, no external JS runtime needed - Fix EsmRenderer bug where inline validator functions were never emitted: - Add generateInlineFunctions() method to emit collected inline validators - Fix collision issue by using counter instead of hashCode for function names - Support nested elements/schemas that require multiple inline validators Test results: 29 tests pass in jtd-esm-codegen (17 Java + 2 property + 10 JS)
1 parent 9c9d5e2 commit b19a9f7

File tree

10 files changed

+690
-811
lines changed

10 files changed

+690
-811
lines changed

jtd-esm-codegen/pom.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2828
<maven.compiler.release>21</maven.compiler.release>
2929
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
30+
<graaljs.version>24.1.2</graaljs.version>
3031
</properties>
3132

3233
<dependencies>
@@ -63,6 +64,50 @@
6364
<version>1.9.3</version>
6465
<scope>test</scope>
6566
</dependency>
67+
<!-- GraalVM Polyglot JS for in-process JavaScript execution -->
68+
<dependency>
69+
<groupId>org.graalvm.polyglot</groupId>
70+
<artifactId>polyglot</artifactId>
71+
<version>${graaljs.version}</version>
72+
<scope>test</scope>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.graalvm.polyglot</groupId>
76+
<artifactId>js-community</artifactId>
77+
<version>${graaljs.version}</version>
78+
<type>pom</type>
79+
<scope>test</scope>
80+
</dependency>
81+
82+
<!-- junit-js: JUnit runner for JavaScript tests via GraalVM polyglot (replaces bun) -->
83+
<dependency>
84+
<groupId>org.bitbucket.thinbus</groupId>
85+
<artifactId>junit-js</artifactId>
86+
<version>2.0.0</version>
87+
<scope>test</scope>
88+
<exclusions>
89+
<!-- Exclude GraalVM deps to use project's 24.1.2 (bugfix of 24.1.0) -->
90+
<exclusion>
91+
<groupId>org.graalvm.polyglot</groupId>
92+
<artifactId>*</artifactId>
93+
</exclusion>
94+
<exclusion>
95+
<groupId>org.graalvm.js</groupId>
96+
<artifactId>*</artifactId>
97+
</exclusion>
98+
<exclusion>
99+
<groupId>org.graalvm.truffle</groupId>
100+
<artifactId>*</artifactId>
101+
</exclusion>
102+
</exclusions>
103+
</dependency>
104+
<!-- JUnit Vintage engine to run JUnit 4 @RunWith(JSRunner.class) tests under JUnit 5 -->
105+
<dependency>
106+
<groupId>org.junit.vintage</groupId>
107+
<artifactId>junit-vintage-engine</artifactId>
108+
<version>${junit.jupiter.version}</version>
109+
<scope>test</scope>
110+
</dependency>
66111
</dependencies>
67112

68113
<build>
@@ -87,6 +132,14 @@
87132
<artifactId>maven-surefire-plugin</artifactId>
88133
<configuration>
89134
<argLine>-ea</argLine>
135+
<includes>
136+
<include>**/*Test.java</include>
137+
<include>**/*Tests.java</include>
138+
<include>**/*TestSuite.java</include>
139+
</includes>
140+
<systemPropertyVariables>
141+
<polyglot.engine.WarnInterpreterOnly>false</polyglot.engine.WarnInterpreterOnly>
142+
</systemPropertyVariables>
90143
</configuration>
91144
</plugin>
92145

0 commit comments

Comments
 (0)