Skip to content

Commit abdc29b

Browse files
authored
switch to mocha for testing (#340)
1 parent 4b2a81d commit abdc29b

39 files changed

+11394
-15516
lines changed

.mocharc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"exit": true,
3+
"extension": ["ts", "tsx"],
4+
"recursive": true,
5+
"require": [
6+
"./register-hooks.cjs"
7+
],
8+
"timeout": 10000
9+
}

css-loader.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import fs from 'node:fs'
2+
3+
export async function load(url, context, nextLoad) {
4+
if (url.endsWith('.scss')) {
5+
const content = fs.readFileSync(new URL(url), { encoding: 'utf-8' });
6+
const classNamesMap = [...content.matchAll(/\.[\w\d]+ {/g)]
7+
.map(([fromCss]) => fromCss.substring(1, fromCss.length - 2))
8+
.reduce((prev, next) => ({
9+
...prev,
10+
[next]: next
11+
}), {})
12+
return {
13+
format: 'json',
14+
shortCircuit: true,
15+
source: JSON.stringify(classNamesMap)
16+
}
17+
}
18+
return nextLoad(url);
19+
}

jest.config.cjs

Lines changed: 0 additions & 20 deletions
This file was deleted.

jest.setup.cjs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)