diff --git a/packages/repl-sdk/example/samples.js b/packages/repl-sdk/example/samples.js index 03186c623..9ad3a2d0b 100644 --- a/packages/repl-sdk/example/samples.js +++ b/packages/repl-sdk/example/samples.js @@ -1,3 +1,12 @@ +export const qunit = ` +import { module, test } from 'qunit'; + +module('Suite name', function () { + test('test name', function (assert) { + assert.strictEqual(2, 2, '2 === 2'); + }); +}); +`; export const mermaid = ` graph TD; A-->B; diff --git a/packages/repl-sdk/src/compilers.js b/packages/repl-sdk/src/compilers.js index efabc1a4a..78dc36952 100644 --- a/packages/repl-sdk/src/compilers.js +++ b/packages/repl-sdk/src/compilers.js @@ -2,6 +2,7 @@ import * as ember from './compilers/ember.js'; import { js } from './compilers/js.js'; import * as markdown from './compilers/markdown.js'; import { mermaid } from './compilers/mermaid.js'; +import { qunit } from './compilers/qunit.js'; import * as react from './compilers/react.js'; import { svelte } from './compilers/svelte.js'; import { vue } from './compilers/vue.js'; @@ -97,6 +98,10 @@ export const compilers = { * https://mermaid.js.org/ */ mermaid, + /** + * https://qunitjs.com/ + */ + qunit, /** * https://svelte.dev/ */ diff --git a/packages/repl-sdk/src/compilers/qunit.js b/packages/repl-sdk/src/compilers/qunit.js new file mode 100644 index 000000000..499654541 --- /dev/null +++ b/packages/repl-sdk/src/compilers/qunit.js @@ -0,0 +1,43 @@ +export const qunit = { + codemirror: { + lang: async () => {}, + }, + resolve: (id) => { + switch (id) { + case 'qunit': + return `https://esm.sh/qunit@3.0.0-alpha.4`; + case 'qunit.css': + return `https://cdn.jsdelivr.net/npm/qunit@2.24.2/qunit/qunit.min.css`; + } + }, + compiler: async (config, api) => { + return { + compile: async (text, options) => {}, + render: async (element, component, extras, compiler) => { + element.innerHTML = ` +
+
+ +