@davidsouther/jiffies 1.1.0 → 2.0.2
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/build/pico.css +2466 -0
- package/build/pico.css.map +1 -0
- package/{build → lib/cjs}/assert.d.ts +23 -23
- package/lib/cjs/assert.js +40 -0
- package/{build → lib/cjs}/case.d.ts +1 -1
- package/lib/cjs/case.js +9 -0
- package/{build → lib/cjs}/components/button_bar.d.ts +8 -8
- package/lib/cjs/components/button_bar.js +29 -0
- package/{build → lib/cjs}/components/inline_edit.d.ts +12 -12
- package/lib/cjs/components/inline_edit.js +51 -0
- package/{build → lib/cjs}/components/logger.d.ts +6 -6
- package/lib/cjs/components/logger.js +27 -0
- package/lib/cjs/components/select.d.ts +10 -0
- package/lib/cjs/components/select.js +6 -0
- package/lib/cjs/components/test.d.ts +1 -0
- package/lib/cjs/components/test.js +7 -0
- package/{build → lib/cjs}/components/virtual_scroll.d.ts +40 -40
- package/lib/cjs/components/virtual_scroll.js +102 -0
- package/{build → lib/cjs}/components/virtual_scroll.test.d.ts +1 -1
- package/lib/cjs/components/virtual_scroll.test.js +22 -0
- package/{build → lib/cjs}/context.d.ts +15 -15
- package/lib/cjs/context.js +48 -0
- package/{build → lib/cjs}/context.test.d.ts +1 -1
- package/lib/cjs/context.test.js +48 -0
- package/lib/cjs/debounce.d.ts +1 -0
- package/lib/cjs/debounce.js +12 -0
- package/lib/cjs/diff.d.ts +15 -0
- package/lib/cjs/diff.js +58 -0
- package/{build/components/test.d.ts → lib/cjs/diff.test.d.ts} +1 -1
- package/lib/cjs/diff.test.js +41 -0
- package/{build → lib/cjs}/display.d.ts +5 -5
- package/lib/cjs/display.js +16 -0
- package/{build → lib/cjs}/dom/css/border.d.ts +11 -11
- package/lib/cjs/dom/css/border.js +33 -0
- package/{build → lib/cjs}/dom/css/constants.d.ts +31 -31
- package/lib/cjs/dom/css/constants.js +31 -0
- package/{build → lib/cjs}/dom/css/core.d.ts +5 -5
- package/lib/cjs/dom/css/core.js +31 -0
- package/{build → lib/cjs}/dom/css/fstyle.d.ts +5 -5
- package/lib/cjs/dom/css/fstyle.js +36 -0
- package/{build → lib/cjs}/dom/css/sizing.d.ts +5 -5
- package/lib/cjs/dom/css/sizing.js +14 -0
- package/{build → lib/cjs}/dom/dom.d.ts +27 -26
- package/lib/cjs/dom/dom.js +110 -0
- package/{build → lib/cjs}/dom/fc.d.ts +14 -14
- package/lib/cjs/dom/fc.js +39 -0
- package/{build → lib/cjs}/dom/fc.test.d.ts +1 -1
- package/lib/cjs/dom/fc.test.js +23 -0
- package/{build → lib/cjs}/dom/form/form.app.d.ts +1 -1
- package/lib/cjs/dom/form/form.app.js +27 -0
- package/{build → lib/cjs}/dom/form/form.d.ts +26 -26
- package/lib/cjs/dom/form/form.js +49 -0
- package/{build → lib/cjs}/dom/form/form.test.d.ts +0 -0
- package/{build → lib/cjs}/dom/form/form.test.js +1 -1
- package/{build → lib/cjs}/dom/html.d.ts +113 -113
- package/lib/cjs/dom/html.js +119 -0
- package/{build → lib/cjs}/dom/html.test.d.ts +1 -1
- package/lib/cjs/dom/html.test.js +60 -0
- package/lib/cjs/dom/observable.d.ts +2 -0
- package/lib/cjs/dom/observable.js +10 -0
- package/{build/observable → lib/cjs/dom}/observable.test.d.ts +1 -1
- package/lib/cjs/dom/observable.test.js +35 -0
- package/{build → lib/cjs}/dom/provide.d.ts +3 -3
- package/lib/cjs/dom/provide.js +12 -0
- package/{build → lib/cjs}/dom/router/link.d.ts +6 -6
- package/lib/cjs/dom/router/link.js +7 -0
- package/{build → lib/cjs}/dom/router/router.d.ts +12 -12
- package/lib/cjs/dom/router/router.js +52 -0
- package/{build → lib/cjs}/dom/svg.d.ts +64 -64
- package/lib/cjs/dom/svg.js +69 -0
- package/lib/cjs/dom/test.d.ts +1 -0
- package/lib/cjs/dom/test.js +13 -0
- package/{build → lib/cjs}/dom/types/css.d.ts +6612 -6612
- package/lib/cjs/dom/types/css.js +24 -0
- package/{build → lib/cjs}/dom/types/dom.d.ts +0 -0
- package/{build → lib/cjs}/dom/types/dom.js +1 -1
- package/{build → lib/cjs}/dom/types/html.d.ts +616 -616
- package/lib/cjs/dom/types/html.js +2 -0
- package/{build → lib/cjs}/dom/xml.d.ts +1 -1
- package/lib/cjs/dom/xml.js +8 -0
- package/{build → lib/cjs}/equal.d.ts +5 -5
- package/lib/cjs/equal.js +43 -0
- package/{build → lib/cjs}/equal.test.d.ts +1 -1
- package/lib/cjs/equal.test.js +22 -0
- package/{build → lib/cjs}/flags.d.ts +7 -7
- package/lib/cjs/flags.js +52 -0
- package/{build → lib/cjs}/flags.test.d.ts +1 -1
- package/lib/cjs/flags.test.js +37 -0
- package/{build → lib/cjs}/fs.d.ts +48 -48
- package/lib/cjs/fs.js +152 -0
- package/{build → lib/cjs}/fs.test.d.ts +1 -1
- package/lib/cjs/fs.test.js +45 -0
- package/{build → lib/cjs}/generator.d.ts +1 -1
- package/lib/cjs/generator.js +14 -0
- package/{build → lib/cjs}/generator.test.d.ts +1 -1
- package/lib/cjs/generator.test.js +26 -0
- package/{build → lib/cjs}/is_browser.d.ts +1 -1
- package/lib/cjs/is_browser.js +4 -0
- package/{build → lib/cjs}/loader.d.mts +22 -22
- package/lib/cjs/loader.mjs +40 -0
- package/{build → lib/cjs}/lock.d.ts +1 -1
- package/lib/cjs/lock.js +27 -0
- package/{build → lib/cjs}/lock.test.d.ts +1 -1
- package/lib/cjs/lock.test.js +18 -0
- package/{build → lib/cjs}/log.d.ts +26 -26
- package/lib/cjs/log.js +54 -0
- package/lib/cjs/observable/event.d.ts +35 -0
- package/lib/cjs/observable/event.js +61 -0
- package/lib/cjs/observable/observable.d.ts +132 -0
- package/lib/cjs/observable/observable.js +363 -0
- package/lib/cjs/observable/observable.test.d.ts +1 -0
- package/lib/cjs/observable/observable.test.js +65 -0
- package/{build → lib/cjs}/range.d.ts +1 -1
- package/lib/cjs/range.js +11 -0
- package/{build → lib/cjs}/result.d.ts +31 -31
- package/lib/cjs/result.js +80 -0
- package/{build → lib/cjs}/result.test.d.ts +1 -1
- package/lib/cjs/result.test.js +73 -0
- package/{build → lib/cjs}/safe.d.ts +1 -1
- package/lib/cjs/safe.js +14 -0
- package/{build → lib/cjs}/scope/describe.d.ts +18 -18
- package/lib/cjs/scope/describe.js +73 -0
- package/{build → lib/cjs}/scope/display/console.d.ts +2 -2
- package/lib/cjs/scope/display/console.js +25 -0
- package/{build → lib/cjs}/scope/display/dom.d.ts +3 -3
- package/lib/cjs/scope/display/dom.js +30 -0
- package/{build → lib/cjs}/scope/display/junit.d.ts +2 -2
- package/lib/cjs/scope/display/junit.js +21 -0
- package/{build → lib/cjs}/scope/execute.d.ts +12 -12
- package/lib/cjs/scope/execute.js +91 -0
- package/{build → lib/cjs}/scope/expect.d.ts +23 -23
- package/lib/cjs/scope/expect.js +114 -0
- package/{build → lib/cjs}/scope/fix.d.ts +4 -4
- package/lib/cjs/scope/fix.js +26 -0
- package/{build → lib/cjs}/scope/index.d.ts +3 -3
- package/lib/cjs/scope/index.js +15 -0
- package/{build → lib/cjs}/scope/scope.d.ts +17 -17
- package/lib/cjs/scope/scope.js +2 -0
- package/lib/cjs/scope/state.d.ts +1 -0
- package/lib/cjs/scope/state.js +11 -0
- package/{build → lib/cjs}/server/http/apps.d.ts +5 -5
- package/lib/cjs/server/http/apps.js +27 -0
- package/{build → lib/cjs}/server/http/css.d.ts +5 -5
- package/lib/cjs/server/http/css.js +54 -0
- package/{build → lib/cjs}/server/http/index.d.ts +21 -21
- package/lib/cjs/server/http/index.js +77 -0
- package/{build → lib/cjs}/server/http/response.d.ts +4 -4
- package/lib/cjs/server/http/response.js +45 -0
- package/{build → lib/cjs}/server/http/sitemap.d.ts +2 -2
- package/lib/cjs/server/http/sitemap.js +46 -0
- package/{build → lib/cjs}/server/http/static.d.ts +2 -2
- package/lib/cjs/server/http/static.js +25 -0
- package/{build → lib/cjs}/server/http/typescript.d.ts +5 -5
- package/lib/cjs/server/http/typescript.js +44 -0
- package/{build → lib/cjs}/server/main.d.ts +2 -2
- package/lib/cjs/server/main.js +14 -0
- package/{build → lib/cjs}/test.d.mts +2 -2
- package/lib/cjs/test.mjs +28 -0
- package/{build → lib/cjs}/test_all.d.ts +9 -7
- package/lib/cjs/test_all.js +30 -0
- package/{build → lib/cjs}/transpile.d.mts +3 -3
- package/lib/cjs/transpile.mjs +22 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -0
- package/lib/esm/assert.d.ts +23 -0
- package/{build → lib/esm}/assert.js +33 -33
- package/lib/esm/case.d.ts +1 -0
- package/{build → lib/esm}/case.js +5 -5
- package/lib/esm/components/button_bar.d.ts +8 -0
- package/{build → lib/esm}/components/button_bar.js +27 -27
- package/lib/esm/components/inline_edit.d.ts +12 -0
- package/{build → lib/esm}/components/inline_edit.js +48 -48
- package/lib/esm/components/logger.d.ts +6 -0
- package/{build → lib/esm}/components/logger.js +22 -22
- package/lib/esm/components/select.d.ts +10 -0
- package/{build → lib/esm}/components/select.js +3 -3
- package/lib/esm/components/test.d.ts +1 -0
- package/lib/esm/components/test.js +3 -0
- package/lib/esm/components/virtual_scroll.d.ts +40 -0
- package/{build → lib/esm}/components/virtual_scroll.js +94 -94
- package/lib/esm/components/virtual_scroll.test.d.ts +1 -0
- package/{build → lib/esm}/components/virtual_scroll.test.js +20 -21
- package/lib/esm/context.d.ts +15 -0
- package/{build → lib/esm}/context.js +43 -43
- package/lib/esm/context.test.d.ts +1 -0
- package/{build → lib/esm}/context.test.js +46 -46
- package/lib/esm/debounce.d.ts +1 -0
- package/{build → lib/esm}/debounce.js +8 -7
- package/lib/esm/diff.d.ts +15 -0
- package/lib/esm/diff.js +54 -0
- package/lib/esm/diff.test.d.ts +1 -0
- package/lib/esm/diff.test.js +39 -0
- package/lib/esm/display.d.ts +5 -0
- package/{build → lib/esm}/display.js +11 -11
- package/lib/esm/dom/css/border.d.ts +11 -0
- package/{build → lib/esm}/dom/css/border.js +27 -27
- package/lib/esm/dom/css/constants.d.ts +31 -0
- package/{build → lib/esm}/dom/css/constants.js +28 -28
- package/lib/esm/dom/css/core.d.ts +5 -0
- package/{build → lib/esm}/dom/css/core.js +24 -24
- package/lib/esm/dom/css/fstyle.d.ts +5 -0
- package/{build → lib/esm}/dom/css/fstyle.js +32 -32
- package/lib/esm/dom/css/sizing.d.ts +5 -0
- package/{build → lib/esm}/dom/css/sizing.js +10 -10
- package/lib/esm/dom/dom.d.ts +27 -0
- package/{build → lib/esm}/dom/dom.js +104 -95
- package/lib/esm/dom/fc.d.ts +14 -0
- package/{build → lib/esm}/dom/fc.js +35 -36
- package/lib/esm/dom/fc.test.d.ts +1 -0
- package/{build → lib/esm}/dom/fc.test.js +21 -21
- package/lib/esm/dom/form/form.app.d.ts +1 -0
- package/{build → lib/esm}/dom/form/form.app.js +23 -23
- package/lib/esm/dom/form/form.d.ts +26 -0
- package/{build → lib/esm}/dom/form/form.js +34 -34
- package/lib/esm/dom/form/form.test.d.ts +0 -0
- package/lib/esm/dom/form/form.test.js +1 -0
- package/lib/esm/dom/html.d.ts +113 -0
- package/{build → lib/esm}/dom/html.js +114 -114
- package/lib/esm/dom/html.test.d.ts +1 -0
- package/{build → lib/esm}/dom/html.test.js +58 -58
- package/lib/esm/dom/observable.d.ts +2 -0
- package/lib/esm/dom/observable.js +6 -0
- package/lib/esm/dom/observable.test.d.ts +1 -0
- package/lib/esm/dom/observable.test.js +33 -0
- package/lib/esm/dom/provide.d.ts +3 -0
- package/{build → lib/esm}/dom/provide.js +7 -7
- package/lib/esm/dom/router/link.d.ts +6 -0
- package/{build → lib/esm}/dom/router/link.js +3 -3
- package/lib/esm/dom/router/router.d.ts +12 -0
- package/{build → lib/esm}/dom/router/router.js +49 -49
- package/lib/esm/dom/svg.d.ts +64 -0
- package/{build → lib/esm}/dom/svg.js +65 -65
- package/lib/esm/dom/test.d.ts +1 -0
- package/lib/esm/dom/test.js +9 -0
- package/lib/esm/dom/types/css.d.ts +6612 -0
- package/{build → lib/esm}/dom/types/css.js +23 -23
- package/lib/esm/dom/types/dom.d.ts +0 -0
- package/lib/esm/dom/types/dom.js +1 -0
- package/lib/esm/dom/types/html.d.ts +616 -0
- package/{build → lib/esm}/dom/types/html.js +1 -1
- package/lib/esm/dom/xml.d.ts +1 -0
- package/{build → lib/esm}/dom/xml.js +4 -4
- package/lib/esm/equal.d.ts +5 -0
- package/{build → lib/esm}/equal.js +37 -37
- package/lib/esm/equal.test.d.ts +1 -0
- package/{build → lib/esm}/equal.test.js +20 -20
- package/lib/esm/flags.d.ts +7 -0
- package/{build → lib/esm}/flags.js +48 -48
- package/lib/esm/flags.test.d.ts +1 -0
- package/{build → lib/esm}/flags.test.js +35 -35
- package/lib/esm/fs.d.ts +48 -0
- package/{build → lib/esm}/fs.js +145 -144
- package/lib/esm/fs.test.d.ts +1 -0
- package/{build → lib/esm}/fs.test.js +43 -43
- package/lib/esm/generator.d.ts +1 -0
- package/{build → lib/esm}/generator.js +10 -10
- package/lib/esm/generator.test.d.ts +1 -0
- package/{build → lib/esm}/generator.test.js +24 -24
- package/lib/esm/is_browser.d.ts +1 -0
- package/{build → lib/esm}/is_browser.js +1 -1
- package/lib/esm/loader.d.mts +22 -0
- package/{build → lib/esm}/loader.mjs +35 -35
- package/lib/esm/lock.d.ts +1 -0
- package/{build → lib/esm}/lock.js +23 -23
- package/lib/esm/lock.test.d.ts +1 -0
- package/{build → lib/esm}/lock.test.js +16 -16
- package/lib/esm/log.d.ts +26 -0
- package/{build → lib/esm}/log.js +46 -46
- package/lib/esm/observable/event.d.ts +35 -0
- package/lib/esm/observable/event.js +46 -0
- package/lib/esm/observable/observable.d.ts +132 -0
- package/lib/esm/observable/observable.js +343 -0
- package/lib/esm/observable/observable.test.d.ts +1 -0
- package/lib/esm/observable/observable.test.js +63 -0
- package/lib/esm/range.d.ts +1 -0
- package/{build → lib/esm}/range.js +7 -7
- package/lib/esm/result.d.ts +31 -0
- package/{build → lib/esm}/result.js +65 -65
- package/lib/esm/result.test.d.ts +1 -0
- package/{build → lib/esm}/result.test.js +71 -71
- package/lib/esm/safe.d.ts +1 -0
- package/{build → lib/esm}/safe.js +10 -10
- package/lib/esm/scope/describe.d.ts +18 -0
- package/{build → lib/esm}/scope/describe.js +60 -61
- package/lib/esm/scope/display/console.d.ts +2 -0
- package/{build → lib/esm}/scope/display/console.js +21 -21
- package/lib/esm/scope/display/dom.d.ts +3 -0
- package/{build → lib/esm}/scope/display/dom.js +26 -26
- package/lib/esm/scope/display/junit.d.ts +2 -0
- package/{build → lib/esm}/scope/display/junit.js +17 -17
- package/lib/esm/scope/execute.d.ts +12 -0
- package/{build → lib/esm}/scope/execute.js +85 -85
- package/lib/esm/scope/expect.d.ts +23 -0
- package/{build → lib/esm}/scope/expect.js +108 -108
- package/lib/esm/scope/fix.d.ts +4 -0
- package/{build → lib/esm}/scope/fix.js +22 -22
- package/lib/esm/scope/index.d.ts +3 -0
- package/{build → lib/esm}/scope/index.js +3 -3
- package/lib/esm/scope/scope.d.ts +17 -0
- package/{build → lib/esm}/scope/scope.js +1 -1
- package/lib/esm/scope/state.d.ts +1 -0
- package/lib/esm/scope/state.js +7 -0
- package/lib/esm/server/http/apps.d.ts +5 -0
- package/{build → lib/esm}/server/http/apps.js +23 -23
- package/lib/esm/server/http/css.d.ts +5 -0
- package/{build → lib/esm}/server/http/css.js +50 -50
- package/lib/esm/server/http/index.d.ts +21 -0
- package/{build → lib/esm}/server/http/index.js +73 -73
- package/lib/esm/server/http/response.d.ts +4 -0
- package/{build → lib/esm}/server/http/response.js +40 -40
- package/lib/esm/server/http/sitemap.d.ts +2 -0
- package/{build → lib/esm}/server/http/sitemap.js +42 -42
- package/lib/esm/server/http/static.d.ts +2 -0
- package/{build → lib/esm}/server/http/static.js +21 -21
- package/lib/esm/server/http/typescript.d.ts +5 -0
- package/{build → lib/esm}/server/http/typescript.js +40 -40
- package/lib/esm/server/main.d.ts +2 -0
- package/{build → lib/esm}/server/main.js +12 -9
- package/lib/esm/test.d.mts +2 -0
- package/lib/esm/test.mjs +26 -0
- package/lib/esm/test_all.d.ts +9 -0
- package/{build → lib/esm}/test_all.js +28 -18
- package/lib/esm/transpile.d.mts +3 -0
- package/{build → lib/esm}/transpile.mjs +18 -18
- package/lib/esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +16 -17
- package/src/assert.ts +1 -1
- package/src/components/button_bar.ts +3 -3
- package/src/components/inline_edit.ts +3 -3
- package/src/components/logger.ts +3 -3
- package/src/components/select.ts +3 -3
- package/src/components/test.js +3 -2
- package/src/context.ts +3 -3
- package/src/debounce.ts +2 -1
- package/src/diff.ts +2 -2
- package/src/display.ts +2 -2
- package/src/dom/css/border.ts +3 -3
- package/src/dom/css/core.ts +1 -1
- package/src/dom/css/fstyle.ts +2 -2
- package/src/dom/css/sizing.ts +1 -1
- package/src/dom/dom.ts +1 -1
- package/src/dom/fc.test.ts +3 -3
- package/src/dom/fc.ts +1 -1
- package/src/dom/form/form.app.ts +2 -2
- package/src/dom/form/form.ts +3 -3
- package/src/dom/html.test.ts +3 -3
- package/src/dom/html.ts +1 -1
- package/src/dom/observable.test.ts +6 -6
- package/src/dom/observable.ts +1 -1
- package/src/dom/provide.ts +1 -1
- package/src/dom/router/link.ts +2 -2
- package/src/dom/router/router.ts +2 -2
- package/src/dom/svg.ts +1 -1
- package/src/dom/test.ts +8 -6
- package/src/dom/types/html.ts +1 -1
- package/src/equal.ts +1 -1
- package/src/flags.ts +1 -1
- package/src/fs.ts +5 -4
- package/src/index.html +6 -6
- package/src/observable/event.ts +2 -2
- package/src/observable/observable.test.ts +2 -2
- package/src/observable/observable.ts +72 -12
- package/src/pico/_variables.scss +1 -1
- package/src/pico/layout/_sectioning.scss +2 -0
- package/src/result.ts +1 -1
- package/src/scope/describe.ts +2 -5
- package/src/scope/display/console.ts +4 -4
- package/src/scope/display/dom.ts +6 -6
- package/src/scope/display/junit.ts +3 -3
- package/src/scope/execute.ts +2 -2
- package/src/scope/expect.ts +3 -3
- package/src/scope/state.ts +10 -0
- package/src/server/http/sitemap.ts +1 -1
- package/src/server/main.ts +9 -2
- package/src/test.mjs +22 -18
- package/src/test_all.ts +10 -0
- package/build/components/select.d.ts +0 -13
- package/build/components/test.js +0 -2
- package/build/debounce.d.ts +0 -1
- package/build/dom/test.d.ts +0 -1
- package/build/dom/test.js +0 -2
- package/build/observable/observable.d.ts +0 -83
- package/build/observable/observable.js +0 -148
- package/build/observable/observable.test.js +0 -21
- package/build/test.mjs +0 -23
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { TestCase } from "./scope.js";
|
|
2
|
-
export declare const beforeall: unique symbol;
|
|
3
|
-
export declare const beforeeach: unique symbol;
|
|
4
|
-
export declare const afterall: unique symbol;
|
|
5
|
-
export declare const aftereach: unique symbol;
|
|
6
|
-
export declare function rootCases(): TestCase;
|
|
7
|
-
export declare function getTotalCases(): number;
|
|
8
|
-
export declare function getSkippedCases(): number;
|
|
9
|
-
export declare function describe(title: string, block: Function): void;
|
|
10
|
-
export declare function it(title: string, block: Function): void;
|
|
11
|
-
export declare namespace it {
|
|
12
|
-
var skip: (title: string, _block: Function) => void;
|
|
13
|
-
}
|
|
14
|
-
export declare function beforeEach(fn: () => void): void;
|
|
15
|
-
export declare function beforeAll(fn: () => void): void;
|
|
16
|
-
export declare function afterEach(fn: () => void): void;
|
|
17
|
-
export declare function afterAll(fn: () => void): void;
|
|
18
|
-
export declare function cleanState<State extends {}>(init: () => State, runner?: (action: () => void) => void): State;
|
|
1
|
+
import { TestCase } from "./scope.js";
|
|
2
|
+
export declare const beforeall: unique symbol;
|
|
3
|
+
export declare const beforeeach: unique symbol;
|
|
4
|
+
export declare const afterall: unique symbol;
|
|
5
|
+
export declare const aftereach: unique symbol;
|
|
6
|
+
export declare function rootCases(): TestCase;
|
|
7
|
+
export declare function getTotalCases(): number;
|
|
8
|
+
export declare function getSkippedCases(): number;
|
|
9
|
+
export declare function describe(title: string, block: Function): void;
|
|
10
|
+
export declare function it(title: string, block: Function): void;
|
|
11
|
+
export declare namespace it {
|
|
12
|
+
var skip: (title: string, _block: Function) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function beforeEach(fn: () => void): void;
|
|
15
|
+
export declare function beforeAll(fn: () => void): void;
|
|
16
|
+
export declare function afterEach(fn: () => void): void;
|
|
17
|
+
export declare function afterAll(fn: () => void): void;
|
|
18
|
+
export declare function cleanState<State extends {}>(init: () => State, runner?: (action: () => void) => void): State;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanState = exports.afterAll = exports.afterEach = exports.beforeAll = exports.beforeEach = exports.it = exports.describe = exports.getSkippedCases = exports.getTotalCases = exports.rootCases = exports.aftereach = exports.afterall = exports.beforeeach = exports.beforeall = void 0;
|
|
4
|
+
const assert_js_1 = require("../assert.js");
|
|
5
|
+
const log_js_1 = require("../log.js");
|
|
6
|
+
const state = require("./state.js");
|
|
7
|
+
exports.beforeall = Symbol("beforeAll");
|
|
8
|
+
exports.beforeeach = Symbol("beforeEach");
|
|
9
|
+
exports.afterall = Symbol("afterAll");
|
|
10
|
+
exports.aftereach = Symbol("afterEach");
|
|
11
|
+
const logger = (0, log_js_1.getLogger)("scope");
|
|
12
|
+
const CASES = {};
|
|
13
|
+
let cases = [CASES];
|
|
14
|
+
let totalCases = 0;
|
|
15
|
+
let skippedCases = 0;
|
|
16
|
+
function push(title) {
|
|
17
|
+
const next = (cases[0][title] = cases[0][title] ?? {});
|
|
18
|
+
cases.unshift(next);
|
|
19
|
+
}
|
|
20
|
+
function pop() {
|
|
21
|
+
cases.shift();
|
|
22
|
+
}
|
|
23
|
+
function rootCases() {
|
|
24
|
+
return CASES;
|
|
25
|
+
}
|
|
26
|
+
exports.rootCases = rootCases;
|
|
27
|
+
function getTotalCases() {
|
|
28
|
+
return totalCases;
|
|
29
|
+
}
|
|
30
|
+
exports.getTotalCases = getTotalCases;
|
|
31
|
+
function getSkippedCases() {
|
|
32
|
+
return skippedCases;
|
|
33
|
+
}
|
|
34
|
+
exports.getSkippedCases = getSkippedCases;
|
|
35
|
+
function describe(title, block) {
|
|
36
|
+
logger.debug(`describe(${title})`);
|
|
37
|
+
push(title);
|
|
38
|
+
block();
|
|
39
|
+
pop();
|
|
40
|
+
}
|
|
41
|
+
exports.describe = describe;
|
|
42
|
+
function it(title, block) {
|
|
43
|
+
logger.debug(`it(${title})`);
|
|
44
|
+
(0, assert_js_1.assert)(cases[0][title] == undefined, `Block already has test ${title}`);
|
|
45
|
+
totalCases += 1;
|
|
46
|
+
cases[0][title] = block;
|
|
47
|
+
}
|
|
48
|
+
exports.it = it;
|
|
49
|
+
it.skip = (title, _block) => {
|
|
50
|
+
logger.debug(`it.skip(${title})`);
|
|
51
|
+
totalCases += 1;
|
|
52
|
+
skippedCases += 1;
|
|
53
|
+
};
|
|
54
|
+
function beforeEach(fn) {
|
|
55
|
+
cases[0][exports.beforeeach] = fn;
|
|
56
|
+
}
|
|
57
|
+
exports.beforeEach = beforeEach;
|
|
58
|
+
function beforeAll(fn) {
|
|
59
|
+
cases[0][exports.beforeall] = fn;
|
|
60
|
+
}
|
|
61
|
+
exports.beforeAll = beforeAll;
|
|
62
|
+
function afterEach(fn) {
|
|
63
|
+
cases[0][exports.aftereach] = fn;
|
|
64
|
+
}
|
|
65
|
+
exports.afterEach = afterEach;
|
|
66
|
+
function afterAll(fn) {
|
|
67
|
+
cases[0][exports.afterall] = fn;
|
|
68
|
+
}
|
|
69
|
+
exports.afterAll = afterAll;
|
|
70
|
+
function cleanState(init, runner = beforeEach) {
|
|
71
|
+
return state.cleanState(init, runner);
|
|
72
|
+
}
|
|
73
|
+
exports.cleanState = cleanState;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TestResult } from "../scope.js";
|
|
2
|
-
export declare function onConsole(results: TestResult): void;
|
|
1
|
+
import { TestResult } from "../scope.js";
|
|
2
|
+
export declare function onConsole(results: TestResult): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onConsole = void 0;
|
|
4
|
+
const log_js_1 = require("../../log.js");
|
|
5
|
+
const describe_js_1 = require("../describe.js");
|
|
6
|
+
const execute_js_1 = require("../execute.js");
|
|
7
|
+
const logger = (0, log_js_1.getLogger)("Scope Test Runner");
|
|
8
|
+
function onConsole(results) {
|
|
9
|
+
const { executed, failed } = results;
|
|
10
|
+
logger.info("Executed test suite.", {
|
|
11
|
+
executed,
|
|
12
|
+
total: (0, describe_js_1.getTotalCases)(),
|
|
13
|
+
failed,
|
|
14
|
+
});
|
|
15
|
+
const flat = (0, execute_js_1.flattenResults)(results);
|
|
16
|
+
for (const { test } of flat) {
|
|
17
|
+
logger.debug(test);
|
|
18
|
+
}
|
|
19
|
+
for (const { test, stack } of flat) {
|
|
20
|
+
if (stack) {
|
|
21
|
+
logger.error(test, { stack });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.onConsole = onConsole;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DOMElement } from "../../dom/dom.js";
|
|
2
|
-
import { TestResult } from "../scope.js";
|
|
3
|
-
export declare function displayStatistics(results: TestResult, root?: DOMElement): void;
|
|
1
|
+
import { DOMElement } from "../../dom/dom.js";
|
|
2
|
+
import { TestResult } from "../scope.js";
|
|
3
|
+
export declare function displayStatistics(results: TestResult, root?: DOMElement): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayStatistics = void 0;
|
|
4
|
+
const logger_js_1 = require("../../components/logger.js");
|
|
5
|
+
const log_js_1 = require("../../log.js");
|
|
6
|
+
const describe_js_1 = require("../describe.js");
|
|
7
|
+
const execute_js_1 = require("../execute.js");
|
|
8
|
+
function displayStatistics(results, root = document.body) {
|
|
9
|
+
const { executed, failed } = results;
|
|
10
|
+
const logger = (() => {
|
|
11
|
+
try {
|
|
12
|
+
return (0, logger_js_1.makeHTMLLogger)(`Executed ${executed} of ${(0, describe_js_1.getTotalCases)()}; ${failed} failed.`);
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
return log_js_1.DEFAULT_LOGGER;
|
|
16
|
+
}
|
|
17
|
+
})();
|
|
18
|
+
logger.level = log_js_1.LEVEL.DEBUG;
|
|
19
|
+
const flat = (0, execute_js_1.flattenResults)(results);
|
|
20
|
+
for (const { test, stack } of flat) {
|
|
21
|
+
if (stack) {
|
|
22
|
+
logger.info(test);
|
|
23
|
+
logger.debug(`${stack}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if ((0, logger_js_1.isHTMLLogger)(logger)) {
|
|
27
|
+
root.appendChild(logger.root);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.displayStatistics = displayStatistics;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TestResult } from "../scope.js";
|
|
2
|
-
export declare function asXML(results: TestResult): string;
|
|
1
|
+
import { TestResult } from "../scope.js";
|
|
2
|
+
export declare function asXML(results: TestResult): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asXML = void 0;
|
|
4
|
+
const xml_js_1 = require("../../dom/xml.js");
|
|
5
|
+
const execute_js_1 = require("../execute.js");
|
|
6
|
+
const cases = (results) => Object.entries(results).filter(([key]) => !["executed", "passed", "failed"].includes(key));
|
|
7
|
+
function asXML(results) {
|
|
8
|
+
return (`<?xml version="1.0" encoding="UTF-8" ?>` +
|
|
9
|
+
(0, xml_js_1.xml)("testsuites", { tests: results.executed, failures: results.failed }, cases(results).map(([title, children]) => testsuite(title, children.executed, children.failed, (0, execute_js_1.flattenResults)(children)))));
|
|
10
|
+
}
|
|
11
|
+
exports.asXML = asXML;
|
|
12
|
+
function testsuite(name, tests, failures, cases) {
|
|
13
|
+
const id = name.replace("s+", "_");
|
|
14
|
+
return (0, xml_js_1.xml)("testsuite", { id, name, tests, failures }, cases.map(({ test, stack }) => testcase({ name: `${name} ${test}` }, stack ? [stack] : [])));
|
|
15
|
+
}
|
|
16
|
+
function testcase({ name, id = name.replace(/\s+/g, "_"), time = "0.00", }, failures) {
|
|
17
|
+
return (0, xml_js_1.xml)("testcase", { id, name, time }, failures.map((stack) => failure({ text: stack })));
|
|
18
|
+
}
|
|
19
|
+
function failure({ text, message = text.split("\n")[0], }) {
|
|
20
|
+
return (0, xml_js_1.xml)("failure", { message }, [`<![CDATA[${text}]]>`]);
|
|
21
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TestResult, TestSummary } from "./scope.js";
|
|
2
|
-
export declare function execute(
|
|
3
|
-
export declare function getError({ error }: TestResult): number | TestResult | TestSummary | "unknown error";
|
|
4
|
-
export interface FlatResult {
|
|
5
|
-
test: string;
|
|
6
|
-
stack?: string | number | TestResult | TestSummary;
|
|
7
|
-
stats: {
|
|
8
|
-
executed: number;
|
|
9
|
-
failed: number;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export declare function flattenResults(results: TestResult, prefix?: string): FlatResult[];
|
|
1
|
+
import { TestResult, TestSummary } from "./scope.js";
|
|
2
|
+
export declare function execute(cases?: import("./scope.js").TestCase): Promise<TestResult>;
|
|
3
|
+
export declare function getError({ error }: TestResult): number | TestResult | TestSummary | "unknown error";
|
|
4
|
+
export interface FlatResult {
|
|
5
|
+
test: string;
|
|
6
|
+
stack?: string | number | TestResult | TestSummary;
|
|
7
|
+
stats: {
|
|
8
|
+
executed: number;
|
|
9
|
+
failed: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function flattenResults(results: TestResult, prefix?: string): FlatResult[];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flattenResults = exports.getError = exports.execute = void 0;
|
|
4
|
+
const describe_js_1 = require("./describe.js");
|
|
5
|
+
async function execute(cases = (0, describe_js_1.rootCases)()) {
|
|
6
|
+
const beforeallfn = cases[describe_js_1.beforeall] ?? (() => { });
|
|
7
|
+
const beforeeachfn = cases[describe_js_1.beforeeach] ?? (() => { });
|
|
8
|
+
const afterallfn = cases[describe_js_1.afterall] ?? (() => { });
|
|
9
|
+
const aftereachfn = cases[describe_js_1.aftereach] ?? (() => { });
|
|
10
|
+
const result = { executed: 0, passed: 0, failed: 0, total: 0 };
|
|
11
|
+
try {
|
|
12
|
+
await beforeallfn();
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
result["_beforeAll"] = { error: e };
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
for (const [title, block] of Object.entries(cases)) {
|
|
19
|
+
if (typeof title === "symbol") {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (block instanceof Function) {
|
|
23
|
+
try {
|
|
24
|
+
result.executed += 1;
|
|
25
|
+
await beforeeachfn();
|
|
26
|
+
await block();
|
|
27
|
+
await aftereachfn();
|
|
28
|
+
result.passed += 1;
|
|
29
|
+
result[title] = { passed: true };
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
result.failed += 1;
|
|
33
|
+
result[title] = { error: /** @type Error */ e };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (block) {
|
|
37
|
+
const run = await execute(block);
|
|
38
|
+
result.executed += run.executed;
|
|
39
|
+
result.passed += run.passed;
|
|
40
|
+
result.failed += run.failed;
|
|
41
|
+
result[title] = run;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
await afterallfn();
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
result["_afterAll"] = { error: e };
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
exports.execute = execute;
|
|
53
|
+
function getError({ error }) {
|
|
54
|
+
if (typeof error == "string") {
|
|
55
|
+
return error;
|
|
56
|
+
}
|
|
57
|
+
else if (error.message) {
|
|
58
|
+
return error.stack;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return "unknown error";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.getError = getError;
|
|
65
|
+
function makeResult(test, result) {
|
|
66
|
+
if (result.error)
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
test,
|
|
70
|
+
stack: getError(result),
|
|
71
|
+
stats: { executed: 1, failed: 1 },
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
if (result.passed === true) {
|
|
75
|
+
return [{ test, stats: { executed: 1, failed: 0 } }];
|
|
76
|
+
}
|
|
77
|
+
return flattenResults(result, test);
|
|
78
|
+
}
|
|
79
|
+
function flattenResults(results, prefix = "") {
|
|
80
|
+
const arrow = prefix == "" ? "" : " -> ";
|
|
81
|
+
let errorList = [];
|
|
82
|
+
for (const [title, result] of Object.entries(results).filter(([key]) => !["executed", "passed", "failed"].includes(key))) {
|
|
83
|
+
const test = `${prefix}${arrow}${title}`;
|
|
84
|
+
if (typeof result == "number")
|
|
85
|
+
continue;
|
|
86
|
+
const flatResult = makeResult(test, result);
|
|
87
|
+
errorList = errorList.concat(flatResult);
|
|
88
|
+
}
|
|
89
|
+
return errorList;
|
|
90
|
+
}
|
|
91
|
+
exports.flattenResults = flattenResults;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export declare class Matcher<T> {
|
|
2
|
-
actual: T;
|
|
3
|
-
constructor(actual: T);
|
|
4
|
-
get not(): Matcher<T>;
|
|
5
|
-
toBe(expected: T): void;
|
|
6
|
-
toEqual(expected: T, partial?: boolean): void;
|
|
7
|
-
toMatch(expected: RegExp | string): void;
|
|
8
|
-
toMatchObject(expected: Partial<T>): void;
|
|
9
|
-
toBeNull(): void;
|
|
10
|
-
toThrow(message?: string): void;
|
|
11
|
-
}
|
|
12
|
-
export declare class NotMatcher<T> {
|
|
13
|
-
actual: T;
|
|
14
|
-
constructor(actual: T);
|
|
15
|
-
get not(): Matcher<T>;
|
|
16
|
-
toBe(expected: T): void;
|
|
17
|
-
toEqual(expected: T): void;
|
|
18
|
-
toMatch(expected: RegExp | string): void;
|
|
19
|
-
toMatchObject(expected: Partial<T>): void;
|
|
20
|
-
toBeNull(): void;
|
|
21
|
-
toThrow(message?: string): void;
|
|
22
|
-
}
|
|
23
|
-
export declare function expect<T>(t: T): Matcher<T>;
|
|
1
|
+
export declare class Matcher<T> {
|
|
2
|
+
actual: T;
|
|
3
|
+
constructor(actual: T);
|
|
4
|
+
get not(): Matcher<T>;
|
|
5
|
+
toBe(expected: T): void;
|
|
6
|
+
toEqual(expected: T, partial?: boolean): void;
|
|
7
|
+
toMatch(expected: RegExp | string): void;
|
|
8
|
+
toMatchObject(expected: Partial<T>): void;
|
|
9
|
+
toBeNull(): void;
|
|
10
|
+
toThrow(message?: string): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class NotMatcher<T> {
|
|
13
|
+
actual: T;
|
|
14
|
+
constructor(actual: T);
|
|
15
|
+
get not(): Matcher<T>;
|
|
16
|
+
toBe(expected: T): void;
|
|
17
|
+
toEqual(expected: T): void;
|
|
18
|
+
toMatch(expected: RegExp | string): void;
|
|
19
|
+
toMatchObject(expected: Partial<T>): void;
|
|
20
|
+
toBeNull(): void;
|
|
21
|
+
toThrow(message?: string): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function expect<T>(t: T): Matcher<T>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expect = exports.NotMatcher = exports.Matcher = void 0;
|
|
4
|
+
const assert_js_1 = require("../assert.js");
|
|
5
|
+
const display_js_1 = require("../display.js");
|
|
6
|
+
const equal_js_1 = require("../equal.js");
|
|
7
|
+
class Matcher {
|
|
8
|
+
actual;
|
|
9
|
+
constructor(actual) {
|
|
10
|
+
this.actual = actual;
|
|
11
|
+
}
|
|
12
|
+
get not() {
|
|
13
|
+
return new NotMatcher(this.actual);
|
|
14
|
+
}
|
|
15
|
+
toBe(expected) {
|
|
16
|
+
(0, assert_js_1.assert)(this.actual === expected, () => `${this.actual} !== ${expected}`);
|
|
17
|
+
}
|
|
18
|
+
toEqual(expected, partial = false) {
|
|
19
|
+
(0, assert_js_1.assert)((0, equal_js_1.equals)(this.actual, expected, partial), () => `Objects are not equivalent: ${(0, display_js_1.display)(this.actual)}, ${(0, display_js_1.display)(expected)}`);
|
|
20
|
+
}
|
|
21
|
+
toMatch(expected) {
|
|
22
|
+
(0, assert_js_1.assert)(typeof this.actual === "string", () => "Must have string for regexp match");
|
|
23
|
+
// @ts-expect-error
|
|
24
|
+
const actual = this.actual;
|
|
25
|
+
if (typeof expected === "string") {
|
|
26
|
+
(0, assert_js_1.assert)(actual.includes(expected), () => `${actual} does not include ${expected}`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
(0, assert_js_1.assert)(expected.test(actual), () => `${actual} does not match ${expected}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
toMatchObject(expected) {
|
|
33
|
+
for (const [k, v] of Object.entries(expected)) {
|
|
34
|
+
// @ts-expect-error
|
|
35
|
+
const actual = this.actual[k];
|
|
36
|
+
(0, assert_js_1.assert)((0, equal_js_1.equals)(actual, v, true), () => `Comparing ${k}, properties not equal: ${(0, display_js_1.display)(actual)}, ${(0, display_js_1.display)(v)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
toBeNull() {
|
|
40
|
+
(0, assert_js_1.assert)(this.actual === null, () => `Expected null, got ${JSON.stringify(this.actual)}`);
|
|
41
|
+
}
|
|
42
|
+
toThrow(message = "") {
|
|
43
|
+
let didThrow = false;
|
|
44
|
+
let result = undefined;
|
|
45
|
+
try {
|
|
46
|
+
// @ts-expect-error
|
|
47
|
+
result = this.actual();
|
|
48
|
+
}
|
|
49
|
+
catch ({ message: e }) {
|
|
50
|
+
(0, assert_js_1.assert)(
|
|
51
|
+
// @ts-expect-error
|
|
52
|
+
(e ?? "").match(message), () => `Expected thrown message to match ${message}, got ${e}`);
|
|
53
|
+
didThrow = true;
|
|
54
|
+
}
|
|
55
|
+
(0, assert_js_1.assert)(didThrow, () => `Expected throw but got ${JSON.stringify(result)}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Matcher = Matcher;
|
|
59
|
+
class NotMatcher {
|
|
60
|
+
actual;
|
|
61
|
+
constructor(actual) {
|
|
62
|
+
this.actual = actual;
|
|
63
|
+
}
|
|
64
|
+
get not() {
|
|
65
|
+
return new Matcher(this.actual);
|
|
66
|
+
}
|
|
67
|
+
toBe(expected) {
|
|
68
|
+
(0, assert_js_1.assert)(this.actual !== expected, () => `${this.actual} === ${expected}`);
|
|
69
|
+
}
|
|
70
|
+
toEqual(expected) {
|
|
71
|
+
(0, assert_js_1.assert)(!(0, equal_js_1.equals)(this.actual, expected), () => `Objects are equivalent: ${JSON.stringify(this.actual)}, ${JSON.stringify(expected)}`);
|
|
72
|
+
}
|
|
73
|
+
toMatch(expected) {
|
|
74
|
+
(0, assert_js_1.assert)(typeof this.actual === "string", () => "Must have string for regexp match");
|
|
75
|
+
// @ts-expect-error
|
|
76
|
+
const actual = this.actual;
|
|
77
|
+
if (typeof expected === "string") {
|
|
78
|
+
(0, assert_js_1.assert)(!actual.includes(expected), () => `${actual} includes ${expected}`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
(0, assert_js_1.assert)(!expected.test(actual), () => `${actual} matches ${expected}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
toMatchObject(expected) {
|
|
85
|
+
for (const [k, v] of Object.entries(expected)) {
|
|
86
|
+
// @ts-expect-error
|
|
87
|
+
const actual = this.actual[k];
|
|
88
|
+
(0, assert_js_1.assert)(!(0, equal_js_1.equals)(actual, v), () => `Comparing ${k}, properties equal: ${JSON.stringify(actual)}, ${JSON.stringify(v)}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
toBeNull() {
|
|
92
|
+
(0, assert_js_1.assert)(this.actual !== null, () => `Expected not null`);
|
|
93
|
+
}
|
|
94
|
+
toThrow(message = "") {
|
|
95
|
+
let didThrow = false;
|
|
96
|
+
let result = undefined;
|
|
97
|
+
try {
|
|
98
|
+
// @ts-expect-error
|
|
99
|
+
result = this.actual();
|
|
100
|
+
}
|
|
101
|
+
catch ({ message: e }) {
|
|
102
|
+
(0, assert_js_1.assert)(
|
|
103
|
+
// @ts-expect-error
|
|
104
|
+
(e ?? "").match(message), () => `Expected thrown message to match ${message}, got ${e}`);
|
|
105
|
+
didThrow = true;
|
|
106
|
+
}
|
|
107
|
+
(0, assert_js_1.assert)(!didThrow, () => `Expected throw but got ${JSON.stringify(result)}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.NotMatcher = NotMatcher;
|
|
111
|
+
function expect(t) {
|
|
112
|
+
return new Matcher(t);
|
|
113
|
+
}
|
|
114
|
+
exports.expect = expect;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a value with numbers, attempt to fix all numbers to 1 decimal point.
|
|
3
|
-
*/
|
|
4
|
-
export declare function fix<T>(n: T): T;
|
|
1
|
+
/**
|
|
2
|
+
* Given a value with numbers, attempt to fix all numbers to 1 decimal point.
|
|
3
|
+
*/
|
|
4
|
+
export declare function fix<T>(n: T): T;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fix = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Given a value with numbers, attempt to fix all numbers to 1 decimal point.
|
|
6
|
+
*/
|
|
7
|
+
function fix(n) {
|
|
8
|
+
if (typeof n === "number") {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
return +n.toFixed(1);
|
|
11
|
+
}
|
|
12
|
+
if (n !== Object(n)) {
|
|
13
|
+
// A primitive
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
16
|
+
if (n instanceof Array) {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
return n.map(fix);
|
|
19
|
+
}
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
return mapreduce(fix, n);
|
|
22
|
+
}
|
|
23
|
+
exports.fix = fix;
|
|
24
|
+
function mapreduce(fn, iter) {
|
|
25
|
+
return Object.entries(iter).reduce((acc, [k, v]) => ((acc[k] = fn(v)), acc), {});
|
|
26
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { expect } from "./expect.js";
|
|
2
|
-
export { fix } from "./fix.js";
|
|
3
|
-
export { afterAll, afterEach, beforeAll, beforeEach, cleanState, describe, it, } from "./describe.js";
|
|
1
|
+
export { expect } from "./expect.js";
|
|
2
|
+
export { fix } from "./fix.js";
|
|
3
|
+
export { afterAll, afterEach, beforeAll, beforeEach, cleanState, describe, it, } from "./describe.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.it = exports.describe = exports.cleanState = exports.beforeEach = exports.beforeAll = exports.afterEach = exports.afterAll = exports.fix = exports.expect = void 0;
|
|
4
|
+
var expect_js_1 = require("./expect.js");
|
|
5
|
+
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return expect_js_1.expect; } });
|
|
6
|
+
var fix_js_1 = require("./fix.js");
|
|
7
|
+
Object.defineProperty(exports, "fix", { enumerable: true, get: function () { return fix_js_1.fix; } });
|
|
8
|
+
var describe_js_1 = require("./describe.js");
|
|
9
|
+
Object.defineProperty(exports, "afterAll", { enumerable: true, get: function () { return describe_js_1.afterAll; } });
|
|
10
|
+
Object.defineProperty(exports, "afterEach", { enumerable: true, get: function () { return describe_js_1.afterEach; } });
|
|
11
|
+
Object.defineProperty(exports, "beforeAll", { enumerable: true, get: function () { return describe_js_1.beforeAll; } });
|
|
12
|
+
Object.defineProperty(exports, "beforeEach", { enumerable: true, get: function () { return describe_js_1.beforeEach; } });
|
|
13
|
+
Object.defineProperty(exports, "cleanState", { enumerable: true, get: function () { return describe_js_1.cleanState; } });
|
|
14
|
+
Object.defineProperty(exports, "describe", { enumerable: true, get: function () { return describe_js_1.describe; } });
|
|
15
|
+
Object.defineProperty(exports, "it", { enumerable: true, get: function () { return describe_js_1.it; } });
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export interface TestCase {
|
|
2
|
-
[k: string]: Function | TestCase;
|
|
3
|
-
[k: symbol]: Function;
|
|
4
|
-
}
|
|
5
|
-
export interface TestResult {
|
|
6
|
-
executed: number;
|
|
7
|
-
passed: number;
|
|
8
|
-
failed: number;
|
|
9
|
-
[k: string]: TestResult | TestSummary | number;
|
|
10
|
-
}
|
|
11
|
-
export declare type TestSummary = TestFailed | TestPassed;
|
|
12
|
-
export interface TestFailed {
|
|
13
|
-
error: unknown;
|
|
14
|
-
}
|
|
15
|
-
export interface TestPassed {
|
|
16
|
-
passed: true;
|
|
17
|
-
}
|
|
1
|
+
export interface TestCase {
|
|
2
|
+
[k: string]: Function | TestCase;
|
|
3
|
+
[k: symbol]: Function;
|
|
4
|
+
}
|
|
5
|
+
export interface TestResult {
|
|
6
|
+
executed: number;
|
|
7
|
+
passed: number;
|
|
8
|
+
failed: number;
|
|
9
|
+
[k: string]: TestResult | TestSummary | number;
|
|
10
|
+
}
|
|
11
|
+
export declare type TestSummary = TestFailed | TestPassed;
|
|
12
|
+
export interface TestFailed {
|
|
13
|
+
error: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface TestPassed {
|
|
16
|
+
passed: true;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cleanState<State extends {}>(init: () => State, runner: (action: () => void) => void): State;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanState = void 0;
|
|
4
|
+
function cleanState(init, runner) {
|
|
5
|
+
const state = {};
|
|
6
|
+
runner(() => {
|
|
7
|
+
Object.assign(state, init());
|
|
8
|
+
});
|
|
9
|
+
return state;
|
|
10
|
+
}
|
|
11
|
+
exports.cleanState = cleanState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiddlewareFactory } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Searches up the request path until the first index is found.
|
|
4
|
-
*/
|
|
5
|
-
export declare const findIndex: MiddlewareFactory;
|
|
1
|
+
import { MiddlewareFactory } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Searches up the request path until the first index is found.
|
|
4
|
+
*/
|
|
5
|
+
export declare const findIndex: MiddlewareFactory;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findIndex = void 0;
|
|
4
|
+
const fs = require("fs/promises");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const response_js_1 = require("./response.js");
|
|
7
|
+
/**
|
|
8
|
+
* Searches up the request path until the first index is found.
|
|
9
|
+
*/
|
|
10
|
+
const findIndex = async ({ root }) => async (req) => {
|
|
11
|
+
let filename = path.join(root, req.url ?? "");
|
|
12
|
+
if (path.basename(filename).match(/\.[a-z]{1,3}$/)) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
while (filename.startsWith(root)) {
|
|
16
|
+
const index = path.join(filename, "index.html");
|
|
17
|
+
try {
|
|
18
|
+
const stat = await fs.stat(index);
|
|
19
|
+
return (0, response_js_1.fileResponse)(index, stat);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
filename = path.dirname(filename);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
};
|
|
27
|
+
exports.findIndex = findIndex;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiddlewareFactory } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Serves .css files statically. Finds .sass files and transpiles them to css.
|
|
4
|
-
*/
|
|
5
|
-
export declare const cssFileServer: MiddlewareFactory;
|
|
1
|
+
import { MiddlewareFactory } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Serves .css files statically. Finds .sass files and transpiles them to css.
|
|
4
|
+
*/
|
|
5
|
+
export declare const cssFileServer: MiddlewareFactory;
|