supertape 12.10.5 → 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 CHANGED
@@ -1,3 +1,17 @@
1
+ 2026.05.04, v12.12.0
2
+
3
+ feature:
4
+ - 05d90b1 supertape: montag v2.0.1
5
+ - 5d1087f supertape: montag v2.0.1
6
+ - 77cfae0 supertape: loader: jsx: add
7
+
8
+ 2026.04.08, v12.11.0
9
+
10
+ feature:
11
+ - 73acac3 supertape: operator: match: isObject -> isRegExp
12
+ - b92a950 supertape: check-dts v1.0.0
13
+ - a1befb1 supertape: typescript v6.0.2
14
+
1
15
  2026.03.14, v12.10.5
2
16
 
3
17
  fix:
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 addLoader = (a) => {
8
- return `"${a} --import supertape/css"`;
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 = addLoader(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
+ }
@@ -1,5 +1,6 @@
1
- import {register} from 'node:module';
1
+ import {registerHooks} from 'node:module';
2
+ import * as cssLoaderUrl from './css.js';
3
+ import * as jsxLoaderUrl from './jsx.js';
2
4
 
3
- const loaderUrl = new URL('./css.js', import.meta.url);
4
-
5
- register(loaderUrl);
5
+ registerHooks(jsxLoaderUrl);
6
+ registerHooks(cssLoaderUrl);
package/lib/operators.js CHANGED
@@ -3,12 +3,13 @@ import diff from './diff.js';
3
3
  import {formatOutput, parseAt} from './format.js';
4
4
  import {maybeRegExp} from './maybe-regexp.js';
5
5
 
6
+ const isRegExp = (a) => a instanceof RegExp;
7
+
6
8
  const {entries} = Object;
7
9
  const isAsync = (a) => a[Symbol.toStringTag] === 'AsyncFunction';
8
10
 
9
11
  const isFn = (a) => typeof a === 'function';
10
12
  const isStr = (a) => typeof a === 'string';
11
- const isObj = (a) => typeof a === 'object';
12
13
 
13
14
  const end = () => {};
14
15
 
@@ -27,7 +28,7 @@ const notOk = (result, message = 'should be falsy') => ({
27
28
  });
28
29
 
29
30
  const validateRegExp = (regexp) => {
30
- if (!isObj(regexp) && !isStr(regexp))
31
+ if (!isRegExp(regexp) && !isStr(regexp))
31
32
  return Error('regexp should be RegExp or String');
32
33
 
33
34
  if (!regexp)
package/lib/validator.js CHANGED
@@ -163,6 +163,7 @@ function checkDuplicates(msg, filtered) {
163
163
  return [];
164
164
 
165
165
  processedList.add(first);
166
+
166
167
  return [
167
168
  `Duplicate ${first}`,
168
169
  second,
@@ -10,6 +10,7 @@ export const overrideConsoleLog = (parentPort, {console = globalThis.console} =
10
10
  const {log} = console;
11
11
 
12
12
  console.log = createConsoleMethod(CONSOLE_LOG, parentPort);
13
+
13
14
  return {
14
15
  getBackConsoleLog: () => {
15
16
  console.log = log;
@@ -21,6 +22,7 @@ export const overrideConsoleError = (parentPort, {console = globalThis.console}
21
22
  const {error} = console;
22
23
 
23
24
  console.error = createConsoleMethod(CONSOLE_ERROR, parentPort);
25
+
24
26
  return {
25
27
  getBackConsoleError: () => {
26
28
  console.error = error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supertape",
3
- "version": "12.10.5",
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",
@@ -79,20 +80,20 @@
79
80
  "devDependencies": {
80
81
  "@iocmd/wait": "^2.1.0",
81
82
  "@putout/eslint-flat": "^4.0.0",
82
- "check-dts": "^0.9.0",
83
+ "check-dts": "^1.0.0",
83
84
  "currify": "^4.0.0",
84
85
  "eslint": "^10.0.2",
85
86
  "eslint-plugin-putout": "^31.0.1",
86
87
  "find-up": "^8.0.0",
87
88
  "madrun": "^13.0.0",
88
- "montag": "^1.0.0",
89
+ "montag": "^2.0.1",
89
90
  "nodemon": "^3.0.1",
90
91
  "pullout": "^5.0.1",
91
92
  "putout": "^42.0.17",
92
93
  "runsome": "^1.0.0",
93
94
  "superc8": "^12.0.0",
94
95
  "try-catch": "^4.0.2",
95
- "typescript": "^5.1.6"
96
+ "typescript": "^6.0.2"
96
97
  },
97
98
  "license": "MIT",
98
99
  "engines": {