Skip to content

Commit

Permalink
switch to mocha for testing (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss authored Dec 2, 2023
1 parent 4b2a81d commit abdc29b
Show file tree
Hide file tree
Showing 39 changed files with 11,394 additions and 15,516 deletions.
9 changes: 9 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"exit": true,
"extension": ["ts", "tsx"],
"recursive": true,
"require": [
"./register-hooks.cjs"
],
"timeout": 10000
}
19 changes: 19 additions & 0 deletions css-loader.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import fs from 'node:fs'

export async function load(url, context, nextLoad) {
if (url.endsWith('.scss')) {
const content = fs.readFileSync(new URL(url), { encoding: 'utf-8' });
const classNamesMap = [...content.matchAll(/\.[\w\d]+ {/g)]
.map(([fromCss]) => fromCss.substring(1, fromCss.length - 2))
.reduce((prev, next) => ({
...prev,
[next]: next
}), {})
return {
format: 'json',
shortCircuit: true,
source: JSON.stringify(classNamesMap)
}
}
return nextLoad(url);
}
20 changes: 0 additions & 20 deletions jest.config.cjs

This file was deleted.

1 change: 0 additions & 1 deletion jest.setup.cjs

This file was deleted.

Loading

0 comments on commit abdc29b

Please sign in to comment.