@falsejs/falsejs 3.3.2 → 4.0.1
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/CONTRIBUTING.md +3 -0
- package/LICENSE +27 -4
- package/README.md +5 -3
- package/index.d.ts +43 -0
- package/index.js +2981 -0
- package/package.json +17 -38
- package/packages-to-remove.txt +0 -1
- package/preinstall.js +7 -7
- package/dist/index.d.ts +0 -46
- package/dist/index.js +0 -1904
- package/dist/index.js.map +0 -1
- package/spec/ava.test.js +0 -38
- package/spec/jasmine.test.js +0 -71
- package/spec/jest.test.js +0 -90
- package/spec/manual.test.js +0 -80
- package/spec/mocha.test.js +0 -73
- package/spec/qunit.test.js +0 -44
- package/spec/run_all_tests.js +0 -182
- package/spec/tape.test.js +0 -37
- package/tsconfig.json +0 -45
package/spec/run_all_tests.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
// run_all_tests.js
|
|
2
|
-
|
|
3
|
-
const { execSync } = require("node:child_process")
|
|
4
|
-
const fs = require("node:fs")
|
|
5
|
-
const path = require("node:path")
|
|
6
|
-
const clc = require("cli-color")
|
|
7
|
-
|
|
8
|
-
// --- Commands and Paths ---
|
|
9
|
-
const JEST_COMMAND = "npx jest spec/jest.test.js"
|
|
10
|
-
const MOCHA_COMMAND = "npx mocha spec/mocha.test.js"
|
|
11
|
-
const JASMINE_COMMAND = "npx jasmine spec/jasmine.test.js"
|
|
12
|
-
const AVA_COMMAND = "npx ava spec/ava.test.js"
|
|
13
|
-
const QUNIT_COMMAND = "node spec/qunit.test.js"
|
|
14
|
-
const TAPE_COMMAND = "node spec/tape.test.js"
|
|
15
|
-
const MANUAL_COMMAND = "node spec/manual.test.js"
|
|
16
|
-
// INTERN_COMMAND has been removed
|
|
17
|
-
const OUTPUT_DIR = ".falsejs"
|
|
18
|
-
const OUTPUT_FILE = path.join(OUTPUT_DIR, "test-log.txt")
|
|
19
|
-
|
|
20
|
-
let outputLog = ""
|
|
21
|
-
let jestPassed = false
|
|
22
|
-
let mochaPassed = false
|
|
23
|
-
let jasminePassed = false
|
|
24
|
-
let avaPassed = false
|
|
25
|
-
let qunitPassed = false
|
|
26
|
-
let tapePassed = false
|
|
27
|
-
// internPassed flag removed
|
|
28
|
-
let manualPassed = false
|
|
29
|
-
let allPassed = false
|
|
30
|
-
|
|
31
|
-
const log = (message, colorFn = clc.white) => {
|
|
32
|
-
console.log(colorFn(message))
|
|
33
|
-
outputLog += `${message}\n`
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function runCommand(command) {
|
|
37
|
-
try {
|
|
38
|
-
const output = execSync(command, { encoding: "utf8", stdio: "pipe" })
|
|
39
|
-
return { success: true, output }
|
|
40
|
-
} catch (error) {
|
|
41
|
-
const errorOutput = (error.stdout || "") + (error.stderr || "")
|
|
42
|
-
return { success: false, output: errorOutput }
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// --- Test Execution ---
|
|
47
|
-
|
|
48
|
-
log("--- Starting Comprehensive Test Suite (7 Suites) ---", clc.yellow)
|
|
49
|
-
|
|
50
|
-
// 1. Run Manual Tests (First)
|
|
51
|
-
// -----------------------------------------------------------------------------
|
|
52
|
-
log("\n>> Running Manual Test (spec/manual.test.js)...", clc.cyan)
|
|
53
|
-
const manualResult = runCommand(MANUAL_COMMAND)
|
|
54
|
-
outputLog += manualResult.output
|
|
55
|
-
|
|
56
|
-
if (manualResult.success && manualResult.output.includes("✓ TESTS PASSED")) {
|
|
57
|
-
manualPassed = true
|
|
58
|
-
log("✓ MANUAL TESTS PASSED.", clc.green)
|
|
59
|
-
} else {
|
|
60
|
-
log("× MANUAL TESTS FAILED (Exit Code Error).", clc.red)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// 2. Run Jest Tests (Second)
|
|
64
|
-
// -----------------------------------------------------------------------------
|
|
65
|
-
log("\n>> Running Jest Test (spec/jest.test.js)...", clc.cyan)
|
|
66
|
-
const jestResult = runCommand(JEST_COMMAND)
|
|
67
|
-
outputLog += jestResult.output
|
|
68
|
-
|
|
69
|
-
if (jestResult.success) {
|
|
70
|
-
jestPassed = true
|
|
71
|
-
log("✓ JEST TESTS PASSED.", clc.green)
|
|
72
|
-
} else {
|
|
73
|
-
log("× JEST TESTS FAILED.", clc.red)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 3. Run Tape Tests (Third)
|
|
77
|
-
// -----------------------------------------------------------------------------
|
|
78
|
-
log("\n>> Running Tape Test (spec/tape.test.js)...", clc.cyan)
|
|
79
|
-
const tapeResult = runCommand(TAPE_COMMAND)
|
|
80
|
-
outputLog += tapeResult.output
|
|
81
|
-
|
|
82
|
-
if (tapeResult.success && !tapeResult.output.includes("not ok")) {
|
|
83
|
-
tapePassed = true
|
|
84
|
-
log("✓ TAPE TESTS PASSED.", clc.green)
|
|
85
|
-
} else {
|
|
86
|
-
log("× TAPE TESTS FAILED.", clc.red)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// 4. Run Mocha Tests (Fourth)
|
|
90
|
-
// -----------------------------------------------------------------------------
|
|
91
|
-
log("\n>> Running Mocha Test (spec/mocha.test.js)...", clc.cyan)
|
|
92
|
-
const mochaResult = runCommand(MOCHA_COMMAND)
|
|
93
|
-
outputLog += mochaResult.output
|
|
94
|
-
|
|
95
|
-
if (mochaResult.success) {
|
|
96
|
-
mochaPassed = true
|
|
97
|
-
log("✓ MOCHA TESTS PASSED.", clc.green)
|
|
98
|
-
} else {
|
|
99
|
-
log("× MOCHA TESTS FAILED.", clc.red)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// 5. Run Jasmine Tests (Fifth)
|
|
103
|
-
// -----------------------------------------------------------------------------
|
|
104
|
-
log("\n>> Running Jasmine Test (spec/jasmine.test.js)...", clc.cyan)
|
|
105
|
-
const jasmineResult = runCommand(JASMINE_COMMAND)
|
|
106
|
-
outputLog += jasmineResult.output
|
|
107
|
-
|
|
108
|
-
if (jasmineResult.success) {
|
|
109
|
-
jasminePassed = true
|
|
110
|
-
log("✓ JASMINE TESTS PASSED.", clc.green)
|
|
111
|
-
} else {
|
|
112
|
-
log("× JASMINE TESTS FAILED.", clc.red)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// 6. Run AVA Tests (Sixth)
|
|
116
|
-
// -----------------------------------------------------------------------------
|
|
117
|
-
log("\n>> Running AVA Test (spec/ava.test.js)...", clc.cyan)
|
|
118
|
-
const avaResult = runCommand(AVA_COMMAND)
|
|
119
|
-
outputLog += avaResult.output
|
|
120
|
-
|
|
121
|
-
if (avaResult.success) {
|
|
122
|
-
avaPassed = true
|
|
123
|
-
log("✓ AVA TESTS PASSED.", clc.green)
|
|
124
|
-
} else {
|
|
125
|
-
log("× AVA TESTS FAILED.", clc.red)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// 7. Run QUnit Tests (Seventh)
|
|
129
|
-
// -----------------------------------------------------------------------------
|
|
130
|
-
log("\n>> Running QUnit Test (spec/qunit.test.js)...", clc.cyan)
|
|
131
|
-
const qunitResult = runCommand(QUNIT_COMMAND)
|
|
132
|
-
outputLog += qunitResult.output
|
|
133
|
-
|
|
134
|
-
if (qunitResult.success && !qunitResult.output.includes("failed: 0")) {
|
|
135
|
-
qunitPassed = true
|
|
136
|
-
log("✓ QUNIT TESTS PASSED.", clc.green)
|
|
137
|
-
} else if (qunitResult.success && qunitResult.output.includes("failed: 0")) {
|
|
138
|
-
qunitPassed = true
|
|
139
|
-
log("✓ QUNIT TESTS PASSED.", clc.green)
|
|
140
|
-
} else {
|
|
141
|
-
log("× QUNIT TESTS FAILED.", clc.red)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// 8. Final Result Summary
|
|
145
|
-
// -----------------------------------------------------------------------------
|
|
146
|
-
log("\n--- Final Test Suite Result ---", clc.yellow)
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
jestPassed &&
|
|
150
|
-
mochaPassed &&
|
|
151
|
-
jasminePassed &&
|
|
152
|
-
manualPassed &&
|
|
153
|
-
avaPassed &&
|
|
154
|
-
qunitPassed &&
|
|
155
|
-
tapePassed
|
|
156
|
-
) {
|
|
157
|
-
allPassed = true
|
|
158
|
-
log(" ALL 7 TEST SUITES PASSED SUCCESSFULLY! ", clc.bgGreen.bold)
|
|
159
|
-
} else {
|
|
160
|
-
log(
|
|
161
|
-
" 1 or more TEST SUITES FAILED. Check logs above and in test-log.txt. ",
|
|
162
|
-
clc.bgRed.bold,
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// 9. Output to File and Exit
|
|
167
|
-
// -----------------------------------------------------------------------------
|
|
168
|
-
try {
|
|
169
|
-
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
170
|
-
fs.mkdirSync(OUTPUT_DIR)
|
|
171
|
-
}
|
|
172
|
-
fs.writeFileSync(OUTPUT_FILE, outputLog)
|
|
173
|
-
console.log(clc.yellow(`\nTest results written to ${OUTPUT_FILE}`))
|
|
174
|
-
} catch {
|
|
175
|
-
console.error(
|
|
176
|
-
clc.red("\nERROR: Could not write test results to output file."),
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (!allPassed) {
|
|
181
|
-
process.exit(1)
|
|
182
|
-
}
|
package/spec/tape.test.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// spec/tape.test.js
|
|
2
|
-
|
|
3
|
-
const test = require("tape")
|
|
4
|
-
|
|
5
|
-
// Load the library components from the specified path
|
|
6
|
-
const fjs = require("../dist/index").default
|
|
7
|
-
const False = fjs.False
|
|
8
|
-
const isFalse = fjs.isFalse
|
|
9
|
-
|
|
10
|
-
// Define constants
|
|
11
|
-
const FALSE = 1 == 3
|
|
12
|
-
const TRUE = 1 == 1
|
|
13
|
-
|
|
14
|
-
// Sampled Combinations
|
|
15
|
-
const combinations = [
|
|
16
|
-
["no", "no", "no", "no", "no", "no", "none"],
|
|
17
|
-
["yes", "yes", "yes", "no", "no", "no", "netscape"],
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
// Tape uses the 't' object for assertions (t.equal, t.ok, t.plan)
|
|
21
|
-
|
|
22
|
-
test("FalseJS Core Functions", function (t) {
|
|
23
|
-
// Plan the number of assertions expected in this main block (2 assertions + 2 combination blocks * 2 assertions each)
|
|
24
|
-
t.plan(2 + combinations.length)
|
|
25
|
-
|
|
26
|
-
t.equal(isFalse(FALSE), TRUE, "isFalse(FALSE) should return TRUE")
|
|
27
|
-
t.equal(isFalse(TRUE), FALSE, "isFalse(TRUE) should return FALSE")
|
|
28
|
-
|
|
29
|
-
combinations.forEach((params) => {
|
|
30
|
-
// Check if False() returns the exact FALSE constant (which is boolean false)
|
|
31
|
-
t.equal(
|
|
32
|
-
False(...params),
|
|
33
|
-
FALSE,
|
|
34
|
-
`False(${params.join(", ")}) should return FALSE`,
|
|
35
|
-
)
|
|
36
|
-
})
|
|
37
|
-
})
|
package/tsconfig.json
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
-
"include": [
|
|
4
|
-
"./src/**/*.ts" // Adjust this pattern to match your source file locations
|
|
5
|
-
],
|
|
6
|
-
"compilerOptions": {
|
|
7
|
-
// File Layout
|
|
8
|
-
"rootDir": "./src",
|
|
9
|
-
"outDir": "./dist",
|
|
10
|
-
|
|
11
|
-
// Environment Settings
|
|
12
|
-
// See also https://aka.ms/tsconfig/module
|
|
13
|
-
"module": "commonjs",
|
|
14
|
-
"target": "es2024",
|
|
15
|
-
// For nodejs:
|
|
16
|
-
// "lib": ["esnext"],
|
|
17
|
-
// "types": ["node"],
|
|
18
|
-
// and npm install -D @types/node
|
|
19
|
-
|
|
20
|
-
// Other Outputs
|
|
21
|
-
"sourceMap": true,
|
|
22
|
-
"declaration": false,
|
|
23
|
-
|
|
24
|
-
// Stricter Typechecking Options
|
|
25
|
-
"noUncheckedIndexedAccess": true,
|
|
26
|
-
"exactOptionalPropertyTypes": true,
|
|
27
|
-
|
|
28
|
-
// Style Options
|
|
29
|
-
// "noImplicitReturns": true,
|
|
30
|
-
// "noImplicitOverride": true,
|
|
31
|
-
// "noUnusedLocals": true,
|
|
32
|
-
// "noUnusedParameters": true,
|
|
33
|
-
// "noFallthroughCasesInSwitch": true,
|
|
34
|
-
// "noPropertyAccessFromIndexSignature": true,
|
|
35
|
-
|
|
36
|
-
// Recommended Options
|
|
37
|
-
"strict": true,
|
|
38
|
-
"jsx": "react-jsx",
|
|
39
|
-
"verbatimModuleSyntax": true,
|
|
40
|
-
"isolatedModules": true,
|
|
41
|
-
"noUncheckedSideEffectImports": true,
|
|
42
|
-
"moduleDetection": "force",
|
|
43
|
-
"skipLibCheck": true
|
|
44
|
-
}
|
|
45
|
-
}
|