supertape 12.11.0 → 12.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +7 -0
- package/README.md +16 -0
- package/lib/env/index.js +8 -4
- package/lib/loader/jsx.js +45 -0
- package/lib/loader/register.js +5 -4
- package/package.json +3 -2
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -60,6 +60,22 @@ export default {
|
|
|
60
60
|
};
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
or jsx:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import {run, defineEnv} from 'supertape/env';
|
|
67
|
+
|
|
68
|
+
const testEnv = defineEnv({
|
|
69
|
+
timeout: 7000,
|
|
70
|
+
jsx: true,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
test: () => [testEnv, `tape 'lib/**/*.spec.js'`],
|
|
75
|
+
coverage: async () => [testEnv, `c8 ${await run('test')}`],
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
63
79
|
📼 **Supertape** doesn't contain:
|
|
64
80
|
|
|
65
81
|
- assertion aliases, making the available operators far more concise
|
package/lib/env/index.js
CHANGED
|
@@ -4,9 +4,8 @@ import justSnakeCase from 'just-snake-case';
|
|
|
4
4
|
const isBool = (a) => typeof a === 'boolean';
|
|
5
5
|
const {entries} = Object;
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
};
|
|
7
|
+
const addCSSLoader = (a) => `"${a} --import supertape/css"`;
|
|
8
|
+
const addJSXLoader = (a) => `"${a} --import supertape/jsx"`;
|
|
10
9
|
|
|
11
10
|
const parseValue = (a) => {
|
|
12
11
|
if (isBool(a))
|
|
@@ -22,7 +21,12 @@ export const defineEnv = (config, overrides = {}) => {
|
|
|
22
21
|
|
|
23
22
|
for (const [key, value] of entries(config)) {
|
|
24
23
|
if (key === 'css' && value) {
|
|
25
|
-
result.NODE_OPTIONS =
|
|
24
|
+
result.NODE_OPTIONS = addCSSLoader(NODE_OPTIONS);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (key === 'jsx' && value) {
|
|
29
|
+
result.NODE_OPTIONS = addJSXLoader(NODE_OPTIONS);
|
|
26
30
|
continue;
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {transformSync} from '@swc/core';
|
|
2
|
+
|
|
3
|
+
export function resolve(specifier, context, nextResolve) {
|
|
4
|
+
if (specifier.endsWith('.jsx'))
|
|
5
|
+
return {
|
|
6
|
+
url: new URL(specifier, context.parentURL).href,
|
|
7
|
+
shortCircuit: true,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return nextResolve(specifier, context);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function load(url, context, nextLoad) {
|
|
14
|
+
if (url.endsWith('.jsx')) {
|
|
15
|
+
const {source} = nextLoad(url, {
|
|
16
|
+
format: 'module',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
format: 'module',
|
|
21
|
+
source: jsxToJs(String(source)),
|
|
22
|
+
shortCircuit: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return nextLoad(url, context);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function jsxToJs(source) {
|
|
30
|
+
const {code} = transformSync(source, {
|
|
31
|
+
jsc: {
|
|
32
|
+
parser: {
|
|
33
|
+
syntax: 'ecmascript',
|
|
34
|
+
jsx: true,
|
|
35
|
+
},
|
|
36
|
+
transform: {
|
|
37
|
+
react: {
|
|
38
|
+
runtime: 'automatic',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return code;
|
|
45
|
+
}
|
package/lib/loader/register.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {registerHooks} from 'node:module';
|
|
2
|
+
import * as cssLoaderUrl from './css.js';
|
|
3
|
+
import * as jsxLoaderUrl from './jsx.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
register(loaderUrl);
|
|
5
|
+
registerHooks(jsxLoaderUrl);
|
|
6
|
+
registerHooks(cssLoaderUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supertape",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.12.0",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "📼 Supertape simplest high speed test runner with superpowers",
|
|
6
6
|
"homepage": "http://github.com/coderaiser/supertape",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@supertape/formatter-tap": "^4.0.0",
|
|
53
53
|
"@supertape/formatter-time": "^3.0.0",
|
|
54
54
|
"@supertape/operator-stub": "^4.0.0",
|
|
55
|
+
"@swc/core": "^1.15.33",
|
|
55
56
|
"cli-progress": "^3.8.2",
|
|
56
57
|
"flatted": "^3.3.1",
|
|
57
58
|
"fullstore": "^4.0.0",
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
"eslint-plugin-putout": "^31.0.1",
|
|
86
87
|
"find-up": "^8.0.0",
|
|
87
88
|
"madrun": "^13.0.0",
|
|
88
|
-
"montag": "^
|
|
89
|
+
"montag": "^2.0.1",
|
|
89
90
|
"nodemon": "^3.0.1",
|
|
90
91
|
"pullout": "^5.0.1",
|
|
91
92
|
"putout": "^42.0.17",
|