functionalscript 0.14.1 → 0.14.3
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.
|
@@ -18,7 +18,7 @@ export declare const playwright = "1.60.0";
|
|
|
18
18
|
export declare const rust = "1.95.0";
|
|
19
19
|
export declare const node: {
|
|
20
20
|
readonly default: "26.1.0";
|
|
21
|
-
readonly others: readonly ["
|
|
21
|
+
readonly others: readonly ["22.22.2", "24.15.0"];
|
|
22
22
|
};
|
|
23
23
|
export declare const wasmtime = "44.0.1";
|
|
24
24
|
export declare const wasmer = "7.1.0";
|
package/fs/ci/config/module.f.js
CHANGED
|
@@ -24,7 +24,7 @@ export const rust = '1.95.0';
|
|
|
24
24
|
// https://nodejs.org/en/download
|
|
25
25
|
export const node = {
|
|
26
26
|
default: '26.1.0',
|
|
27
|
-
others: ['
|
|
27
|
+
others: ['22.22.2', '24.15.0'],
|
|
28
28
|
};
|
|
29
29
|
// https://github.com/bytecodealliance/wasmtime/releases
|
|
30
30
|
export const wasmtime = '44.0.1';
|
package/fs/ci/node/module.f.js
CHANGED
|
@@ -13,11 +13,11 @@ export const nodeTests = (version) => (extra) => basicNode(version)([
|
|
|
13
13
|
...extra,
|
|
14
14
|
]);
|
|
15
15
|
const findTgz = (v) => v === 'windows' ? '(Get-ChildItem *.tgz).FullName' : './*.tgz';
|
|
16
|
-
const nodeTest = (v) => major(v) === '20' ? 'run test20' : 'test'
|
|
16
|
+
// const nodeTest = (v: string) => major(v) === '20' ? 'run test20' : 'test'
|
|
17
17
|
const nodeSteps = (v) => [
|
|
18
18
|
install(installNode(v)),
|
|
19
19
|
test({ run: 'npm ci' }),
|
|
20
|
-
test({ run:
|
|
20
|
+
test({ run: 'npm t' }),
|
|
21
21
|
];
|
|
22
22
|
export const nodeVersions = Object.fromEntries(node.others.map(v => [
|
|
23
23
|
`node${major(v)}`,
|
package/fs/dev/tf/all.test.js
CHANGED
|
@@ -1,54 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { loadModuleMap } from "../module.f.js";
|
|
3
|
-
import { isTest, parseTestSet } from "./module.f.js";
|
|
4
|
-
import * as nodeTest from 'node:test';
|
|
5
|
-
const isBun = typeof Bun !== 'undefined';
|
|
6
|
-
const isPlaywright = typeof process !== 'undefined' && process?.env?.PLAYWRIGHT_TEST !== undefined;
|
|
7
|
-
const createFramework = (fw) => (prefix, f) => fw.test(prefix, t => f((name, v) => t.test(name, v)));
|
|
8
|
-
// Bun doesn't support nested tests yet.
|
|
9
|
-
const createBunFramework = (fw) => (prefix, f) => f((name, v) => fw.test(`${prefix}: ${name}`, v));
|
|
10
|
-
const createPlaywrightFramework = async () => {
|
|
11
|
-
const pwTest = (await import('@playwright/test')).test;
|
|
12
|
-
return (prefix, f) => f((name, v) => pwTest(`${prefix}: ${name}`, v));
|
|
13
|
-
};
|
|
14
|
-
const framework = isPlaywright ? await createPlaywrightFramework() :
|
|
15
|
-
isBun ? createBunFramework(nodeTest) :
|
|
16
|
-
createFramework(nodeTest);
|
|
17
|
-
const parse = parseTestSet(io.tryCatch);
|
|
18
|
-
const scanModule = (x) => async (subTestRunner) => {
|
|
19
|
-
let subTests = [x];
|
|
20
|
-
while (true) {
|
|
21
|
-
const [first, ...rest] = subTests;
|
|
22
|
-
if (first === undefined) {
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
subTests = rest;
|
|
26
|
-
//
|
|
27
|
-
const [name, value, throws] = first;
|
|
28
|
-
const set = parse(throws)(value);
|
|
29
|
-
if (typeof set === 'function') {
|
|
30
|
-
await subTestRunner(name, () => {
|
|
31
|
-
const r = set();
|
|
32
|
-
// The result of a function is walked as a fresh sub-tree;
|
|
33
|
-
// the parent's `throws` flag does not propagate into it.
|
|
34
|
-
subTests = [...subTests, [`${name}()`, r, false]];
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
for (const [j, y] of set) {
|
|
39
|
-
const pr = `${name}/${j}`;
|
|
40
|
-
subTests = [...subTests, [pr, y, throws || j === 'throw']];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const run = async () => {
|
|
46
|
-
const x = await loadModuleMap(io);
|
|
47
|
-
for (const [i, v] of Object.entries(x)) {
|
|
48
|
-
if (isTest(i)) {
|
|
49
|
-
framework(i, scanModule(['', v.default, false]));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
1
|
+
import { run } from "./module.js";
|
|
53
2
|
// we need `await` for Playwright.
|
|
54
3
|
await run();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const run: () => Promise<void>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { io } from "../../io/module.js";
|
|
2
|
+
import { loadModuleMap } from "../module.f.js";
|
|
3
|
+
import { isTest, parseTestSet } from "./module.f.js";
|
|
4
|
+
import * as nodeTest from 'node:test';
|
|
5
|
+
const isBun = typeof Bun !== 'undefined';
|
|
6
|
+
const isPlaywright = typeof process !== 'undefined' && process?.env?.PLAYWRIGHT_TEST !== undefined;
|
|
7
|
+
const createFramework = (fw) => (prefix, f) => fw.test(prefix, t => f((name, v) => t.test(name, v)));
|
|
8
|
+
// Bun doesn't support nested tests yet.
|
|
9
|
+
const createBunFramework = (fw) => (prefix, f) => f((name, v) => fw.test(`${prefix}: ${name}`, v));
|
|
10
|
+
const createPlaywrightFramework = async () => {
|
|
11
|
+
const pwTest = (await import('@playwright/test')).test;
|
|
12
|
+
return (prefix, f) => f((name, v) => pwTest(`${prefix}: ${name}`, v));
|
|
13
|
+
};
|
|
14
|
+
const framework = isPlaywright ? await createPlaywrightFramework() :
|
|
15
|
+
isBun ? createBunFramework(nodeTest) :
|
|
16
|
+
createFramework(nodeTest);
|
|
17
|
+
const parse = parseTestSet(io.tryCatch);
|
|
18
|
+
const scanModule = (x) => async (subTestRunner) => {
|
|
19
|
+
let subTests = [x];
|
|
20
|
+
while (true) {
|
|
21
|
+
const [first, ...rest] = subTests;
|
|
22
|
+
if (first === undefined) {
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
subTests = rest;
|
|
26
|
+
//
|
|
27
|
+
const [name, value, throws] = first;
|
|
28
|
+
const set = parse(throws)(value);
|
|
29
|
+
if (typeof set === 'function') {
|
|
30
|
+
await subTestRunner(name, () => {
|
|
31
|
+
const r = set();
|
|
32
|
+
// The result of a function is walked as a fresh sub-tree;
|
|
33
|
+
// the parent's `throws` flag does not propagate into it.
|
|
34
|
+
subTests = [...subTests, [`${name}()`, r, false]];
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
for (const [j, y] of set) {
|
|
39
|
+
const pr = `${name}/${j}`;
|
|
40
|
+
subTests = [...subTests, [pr, y, throws || j === 'throw']];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const run = async () => {
|
|
46
|
+
const x = await loadModuleMap(io);
|
|
47
|
+
for (const [i, v] of Object.entries(x)) {
|
|
48
|
+
if (isTest(i)) {
|
|
49
|
+
framework(i, scanModule(['', v.default, false]));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functionalscript",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"description": "FunctionalScript is a purely functional subset of JavaScript",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"prepack": "tsc --NoEmit false",
|
|
12
|
-
"test20": "npm run prepack && node --test",
|
|
13
12
|
"test": "tsc && node --test --experimental-strip-types --experimental-test-coverage --test-coverage-include=**/module.f.ts",
|
|
14
13
|
"index": "node ./fs/fjs/module.ts r ./fs/dev/index/module.f.ts",
|
|
15
14
|
"fst": "node ./fs/fjs/module.ts t",
|