@nutin/cli 1.3.1 → 2.1.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.md +106 -9
- package/README.md +17 -35
- package/bin/add-feature.mjs +9 -0
- package/bin/cli.mjs +8 -0
- package/bin/create-app.mjs +5 -4
- package/bin/update-app.mjs +9 -0
- package/lib/index.mjs +76 -25
- package/lib/src/add-feature/feature-adder.mjs +83 -0
- package/lib/src/add-feature/feature-context-builder.mjs +25 -0
- package/lib/src/add-feature/nutin-config-updater.mjs +29 -0
- package/lib/src/add-feature/package-json-updater.mjs +49 -0
- package/lib/src/common/feature-registry.mjs +11 -0
- package/lib/src/common/file-generator.mjs +159 -0
- package/lib/src/common/meta-bootstrap-prompt.mjs +33 -0
- package/lib/src/common/package-data.mjs +10 -0
- package/lib/src/common/package-json-helper.mjs +103 -0
- package/lib/src/common/project-meta.mjs +54 -0
- package/lib/src/create-app/context-builder.mjs +21 -0
- package/lib/src/{git-manager.mjs → create-app/git-manager.mjs} +2 -2
- package/lib/src/create-app/json-manager.mjs +73 -0
- package/lib/src/{prompts.mjs → create-app/new-app-prompt.mjs} +6 -6
- package/lib/src/{project-generator.mjs → create-app/project-generator.mjs} +10 -8
- package/lib/src/create-app/success-message.mjs +13 -0
- package/lib/src/update-app/conflict-report-writer.mjs +31 -0
- package/lib/src/update-app/fetch-old-templates.mjs +61 -0
- package/lib/src/update-app/project-updater.mjs +142 -0
- package/lib/src/update-app/template-differ.mjs +124 -0
- package/lib/src/update-app/update-context-builder.mjs +25 -0
- package/lib/src/update-app/update-summary-printer.mjs +22 -0
- package/lib/src/update-app/version-compare.mjs +12 -0
- package/lib/src/utils/print.mjs +36 -0
- package/lib/src/utils/promise-exec-alias.mjs +4 -0
- package/package.json +17 -12
- package/templates/base/.gitignore.hbs +6 -1
- package/templates/base/AGENTS.md.hbs +168 -0
- package/templates/base/GETTING_STARTED.md.hbs +199 -0
- package/templates/base/README.md.hbs +8 -17
- package/templates/base/config/languages.json.hbs +6 -0
- package/templates/base/config/seo.json.hbs +12 -0
- package/templates/base/nutin.config.js.hbs +44 -0
- package/templates/base/src/app/components/index.ts.hbs +1 -2
- package/templates/base/src/app/globals.d.ts.hbs +3 -19
- package/templates/base/src/{libs/guards → app}/guards.ts.hbs +1 -5
- package/templates/base/src/app/main.ts.hbs +6 -26
- package/templates/base/src/app/services/index.ts.hbs +1 -1
- package/templates/base/src/app/views/home/home.view.html.hbs +7 -0
- package/templates/base/src/app/views/home/home.view.ts.hbs +2 -57
- package/templates/base/src/app/views/index.ts.hbs +1 -0
- package/templates/base/src/app/views/not-found/not-found.view.html.hbs +8 -0
- package/templates/base/src/app/views/not-found/not-found.view.ts.hbs +5 -38
- package/templates/base/src/core/base-classes/base-component/base-component.test.js.hbs +158 -0
- package/templates/base/src/core/base-classes/base-component/base-component.ts.hbs +68 -35
- package/templates/base/src/core/base-classes/base-component/helpers/catalog.helper.test.js.hbs +124 -0
- package/templates/base/src/core/base-classes/base-component/helpers/catalog.helper.ts.hbs +9 -8
- package/templates/base/src/core/base-classes/base-component/helpers/children.helper.test.js.hbs +96 -0
- package/templates/base/src/core/base-classes/base-component/helpers/children.helper.ts.hbs +6 -3
- package/templates/base/src/core/base-classes/base-component/helpers/dom.helper.test.js.hbs +151 -0
- package/templates/base/src/core/base-classes/base-component/helpers/dom.helper.ts.hbs +8 -2
- package/templates/base/src/core/base-classes/base-component/helpers/event.helper.test.js.hbs +88 -0
- package/templates/base/src/core/base-classes/base-component/helpers/event.helper.ts.hbs +2 -2
- package/templates/base/src/core/base-classes/base-component/helpers/i18n.helper.test.js.hbs +62 -0
- package/templates/base/src/core/base-classes/base-component/helpers/pipe.helper.test.js.hbs +89 -0
- package/templates/base/src/core/base-classes/base-component/helpers/pipe.helper.ts.hbs +4 -1
- package/templates/base/src/core/base-classes/base-component/helpers/security.helper.test.js.hbs +142 -0
- package/templates/base/src/core/base-classes/base-component/helpers/security.helper.ts.hbs +67 -22
- package/templates/base/src/core/base-classes/base-component/helpers/token.helper.test.js.hbs +183 -0
- package/templates/base/src/core/base-classes/component/component.test.js.hbs +85 -0
- package/templates/base/src/core/base-classes/component/component.ts.hbs +24 -33
- package/templates/base/src/core/base-classes/component/helpers/config.helper.test.js.hbs +58 -0
- package/templates/base/src/core/base-classes/component/helpers/data-binding.helper.test.js.hbs +75 -0
- package/templates/base/src/core/base-classes/service/service.test.js.hbs +150 -0
- package/templates/base/src/core/base-classes/service/service.ts.hbs +26 -20
- package/templates/base/src/core/base-classes/view/view.test.js.hbs +71 -0
- package/templates/base/src/core/base-classes/view/view.ts.hbs +24 -49
- package/templates/base/src/core/config.ts.hbs +10 -0
- package/templates/base/src/core/index.ts.hbs +0 -3
- package/templates/base/src/core/internals.d.ts.hbs +27 -0
- package/templates/base/src/core/nutin-config.d.ts.hbs +4 -0
- package/templates/base/src/core/services/event-bus/event-bus.test.js.hbs +67 -3
- package/templates/base/src/core/services/event-bus/event-bus.ts.hbs +9 -4
- package/templates/base/src/core/services/event-bus/index.ts.hbs +3 -0
- package/templates/base/src/core/services/event-bus/lifecycle.facade.test.js.hbs +123 -0
- package/templates/base/src/core/services/event-bus/lifecycle.facade.ts.hbs +61 -0
- package/templates/base/src/core/services/event-bus/navigation.facade.test.js.hbs +46 -0
- package/templates/base/src/core/services/event-bus/navigation.facade.ts.hbs +25 -0
- package/templates/base/src/core/services/globals/globals.test.js.hbs +187 -0
- package/templates/base/src/core/services/globals/globals.ts.hbs +104 -0
- package/templates/base/src/core/services/http-client/helpers/http-builder.helper.test.js.hbs +25 -0
- package/templates/base/src/core/services/http-client/helpers/http-manager.helper.test.js.hbs +20 -0
- package/templates/base/src/core/services/http-client/http-client.test.js.hbs +73 -2
- package/templates/base/src/core/services/http-client/http-client.ts.hbs +4 -1
- package/templates/base/src/core/services/i18n/i18n.test.js.hbs +270 -0
- package/templates/{features/i18n → base}/src/core/services/i18n/i18n.ts.hbs +22 -4
- package/templates/base/src/core/services/index.ts.hbs +5 -6
- package/templates/base/src/core/services/pipe-registry/pipe-registry.test.js.hbs +60 -1
- package/templates/base/src/core/services/pipe-registry/pipe-registry.ts.hbs +1 -1
- package/templates/base/src/core/services/pipe-registry/pipes.test.js.hbs +128 -0
- package/templates/base/src/{libs/pipes → core/services/pipe-registry}/pipes.ts.hbs +8 -5
- package/templates/base/src/core/services/router/helpers/navigation-manager.helper.test.js.hbs +257 -6
- package/templates/base/src/core/services/router/helpers/navigation-manager.helper.ts.hbs +56 -29
- package/templates/base/src/core/services/router/helpers/route-guard-manager.helper.test.js.hbs +27 -0
- package/templates/base/src/core/services/router/helpers/view-render-manager.helper.test.js.hbs +83 -17
- package/templates/base/src/core/services/router/helpers/view-render-manager.helper.ts.hbs +14 -38
- package/templates/base/src/core/services/router/router.test.js.hbs +304 -2
- package/templates/base/src/core/services/router/router.ts.hbs +47 -12
- package/templates/base/src/index.html.hbs +2 -6
- package/templates/base/src/styles/_styles.scss.hbs +102 -43
- package/templates/base/src/styles/base/_variables.scss.hbs +1 -86
- package/templates/base/src/styles/main.scss.hbs +1 -18
- package/templates/base/src/styles/tailwind.css.hbs +2 -0
- package/templates/base/tools/builder/builder.config.js.hbs +40 -0
- package/templates/base/tools/builder/builder.js.hbs +24 -26
- package/templates/base/tools/builder/core/app/binary-extensions.test.js.hbs +16 -0
- package/templates/base/tools/builder/core/app/compile-ts.js.hbs +16 -0
- package/templates/base/tools/builder/core/{copy-static.js.hbs → app/copy-static.js.hbs} +27 -34
- package/templates/base/tools/builder/core/app/validate-routes.js.hbs +77 -0
- package/templates/base/tools/builder/core/finalize-build.js.hbs +16 -7
- package/templates/base/tools/builder/core/{add-tags.js.hbs → html-index/add-tags.js.hbs} +2 -2
- package/templates/base/tools/builder/core/html-index/add-tags.test.js.hbs +56 -0
- package/templates/base/tools/builder/core/{validate-html.js.hbs → html-index/validate-html.js.hbs} +5 -11
- package/templates/base/tools/builder/core/html-templates/merge-templates.js.hbs +152 -0
- package/templates/base/tools/builder/core/html-templates/minify-html.js.hbs +15 -0
- package/templates/base/tools/builder/core/html-templates/process-html-templates.js.hbs +8 -0
- package/templates/{features/i18n/tools/builder/core → base/tools/builder/core/i18n}/build-i18n.js.hbs +6 -17
- package/templates/base/tools/builder/core/prod-bundle/compress-files.js.hbs +37 -0
- package/templates/base/tools/builder/core/prod-bundle/esbuild.js.hbs +30 -0
- package/templates/base/tools/builder/core/{hash-files.js.hbs → prod-bundle/hash-files.js.hbs} +14 -11
- package/templates/base/tools/builder/core/seo/generate-robots-txt.js.hbs +51 -0
- package/templates/base/tools/builder/core/seo/generate-seo-files.js.hbs +16 -0
- package/templates/base/tools/builder/core/seo/generate-seo-html.js.hbs +128 -0
- package/templates/base/tools/builder/core/seo/generate-sitemap-xml.js.hbs +43 -0
- package/templates/base/tools/builder/core/seo/html-substitutions.js.hbs +99 -0
- package/templates/base/tools/builder/core/seo/i18n-resolution.js.hbs +66 -0
- package/templates/base/tools/builder/core/seo/route-output.js.hbs +64 -0
- package/templates/base/tools/builder/core/seo/ssr/ssr-bundle.js.hbs +54 -0
- package/templates/base/tools/builder/core/seo/ssr/ssr-polyfills.js.hbs +132 -0
- package/templates/base/tools/builder/core/seo/ssr/ssr-render.js.hbs +95 -0
- package/templates/base/tools/builder/core/styles/sass.js.hbs +40 -0
- package/templates/base/tools/builder/core/styles/tailwind.js.hbs +84 -0
- package/templates/base/tools/dev/dev-serve.js.hbs +26 -18
- package/templates/base/tools/dev/serve.js.hbs +11 -1
- package/templates/base/tools/dev/watcher.js.hbs +14 -6
- package/templates/base/tools/generator/generator.js.hbs +44 -47
- package/templates/base/tools/generator/handle-file.js.hbs +17 -44
- package/templates/base/tools/generator/handle-file.test.js.hbs +72 -0
- package/templates/base/tools/generator/templates/{component.template.js.hbs → component/component.template.js.hbs} +3 -2
- package/templates/base/tools/generator/templates/component/component.template.test.js.hbs +23 -0
- package/templates/base/tools/generator/templates/html/html.template.js.hbs +2 -0
- package/templates/base/tools/generator/templates/html/html.template.test.js.hbs +7 -0
- package/templates/base/tools/generator/templates/index.js.hbs +7 -12
- package/templates/base/tools/generator/templates/locale/locale.template.js.hbs +8 -0
- package/templates/base/tools/generator/templates/locale/locale.template.test.js.hbs +17 -0
- package/templates/base/tools/generator/templates/scss/scss.template.js.hbs +1 -0
- package/templates/base/tools/generator/templates/scss/scss.template.test.js.hbs +7 -0
- package/templates/base/tools/generator/templates/service/service.template.js.hbs +17 -0
- package/templates/base/tools/generator/templates/service/service.template.test.js.hbs +22 -0
- package/templates/base/tools/generator/templates/test/test.template.js.hbs +10 -0
- package/templates/base/tools/generator/templates/test/test.template.test.js.hbs +27 -0
- package/templates/base/tools/generator/templates/{view.template.js.hbs → view/view.template.js.hbs} +4 -3
- package/templates/base/tools/generator/templates/view/view.template.test.js.hbs +24 -0
- package/templates/base/tools/testin-nutin/core/coverage/collect-coverage.js.hbs +39 -0
- package/templates/base/tools/testin-nutin/core/coverage/compute-coverage.js.hbs +115 -0
- package/templates/base/tools/testin-nutin/core/coverage/compute-coverage.test.js.hbs +74 -0
- package/templates/base/tools/testin-nutin/core/coverage/write-summary-report.js.hbs +54 -0
- package/templates/base/tools/testin-nutin/core/coverage/write-uncovered-report.js.hbs +44 -0
- package/templates/{features/testinNutin/testin-nutin/core/src → base/tools/testin-nutin/core}/globals/assertion-lib.js.hbs +62 -24
- package/templates/base/tools/testin-nutin/core/globals/clock.js.hbs +206 -0
- package/templates/{features/testinNutin/testin-nutin/core/src → base/tools/testin-nutin/core}/globals/jsdom-setup.js.hbs +19 -6
- package/templates/{features/testinNutin/testin-nutin/core/src → base/tools/testin-nutin/core}/globals/register-test-globals.js.hbs +13 -4
- package/templates/base/tools/testin-nutin/core/globals/silence-console.js.hbs +23 -0
- package/templates/{features/testinNutin/testin-nutin/core/src → base/tools/testin-nutin/core}/globals/spyon.js.hbs +2 -0
- package/templates/base/tools/testin-nutin/core/index.js.hbs +9 -0
- package/templates/base/tools/testin-nutin/core/printer.js.hbs +85 -0
- package/templates/base/tools/testin-nutin/core/queue/queue.test.js.hbs +46 -0
- package/templates/base/tools/testin-nutin/core/queue/test-discovery.test.js.hbs +46 -0
- package/templates/base/tools/testin-nutin/core/queue/test-queue.js.hbs +154 -0
- package/templates/{features/testinNutin → base/tools}/testin-nutin/core/tests/assertions.test.js.hbs +27 -0
- package/templates/base/tools/testin-nutin/core/tests/clock.test.js.hbs +118 -0
- package/templates/base/tools/testin-nutin/core/tests/globals-each-all.test.js.hbs +28 -0
- package/templates/{features/testinNutin → base/tools}/testin-nutin/mocks/create-mock-method.js.hbs +2 -1
- package/templates/base/tools/testin-nutin/mocks/create-mock-method.test.js.hbs +64 -0
- package/templates/{features/testinNutin → base/tools}/testin-nutin/mocks/mock-event-bus.js.hbs +3 -2
- package/templates/base/tools/testin-nutin/mocks/mock-event-bus.test.js.hbs +66 -0
- package/templates/base/tools/testin-nutin/mocks/mock-http-client.test.js.hbs +26 -0
- package/templates/base/tools/testin-nutin/mocks/mock-i18n.test.js.hbs +61 -0
- package/templates/base/tools/testin-nutin/mocks/mock-router.test.js.hbs +29 -0
- package/templates/base/tools/testin-nutin/runner.js.hbs +100 -0
- package/templates/base/tools/testin-nutin/watch-tests.js.hbs +37 -0
- package/templates/base/tools/utils/error-exit.js.hbs +8 -0
- package/templates/base/tools/utils/format.js.hbs +10 -10
- package/templates/base/tools/utils/format.test.js.hbs +45 -0
- package/templates/base/tools/utils/get-files-recursive.js.hbs +6 -1
- package/templates/base/tools/utils/get-files-recursive.test.js.hbs +49 -0
- package/templates/base/tools/utils/get-rel-to-core.test.js.hbs +18 -0
- package/templates/base/tools/utils/index.js.hbs +1 -3
- package/templates/base/tools/utils/languages.js.hbs +15 -0
- package/templates/base/tools/utils/languages.test.js.hbs +16 -0
- package/templates/base/tools/utils/print.js.hbs +19 -13
- package/templates/base/tools/utils/print.test.js.hbs +60 -0
- package/templates/base/tools/utils/prompt-boolean.js.hbs +7 -0
- package/templates/base/tools/utils/prompt-boolean.test.js.hbs +54 -0
- package/templates/base/tools/utils/run-command.js.hbs +4 -2
- package/templates/base/tools/utils/run-command.test.js.hbs +19 -0
- package/templates/base/tools/utils/run-script.js.hbs +14 -3
- package/templates/base/tools/utils/run-script.test.js.hbs +40 -0
- package/templates/features/{deployHelper → docker}/.dockerignore.hbs +4 -4
- package/templates/features/docker/tools/docker/Dockerfile.template.hbs +51 -0
- package/templates/features/{deployHelper/tools/deployment/nginx.conf.hbs → docker/tools/docker/nginx.conf.template} +4 -2
- package/templates/features/docker/tools/docker/scripts/docker-build.js.hbs +20 -0
- package/templates/features/docker/tools/docker/scripts/docker-ports.js.hbs +48 -0
- package/templates/features/docker/tools/docker/scripts/docker-ports.test.js.hbs +52 -0
- package/templates/features/docker/tools/docker/scripts/docker-run.js.hbs +28 -0
- package/templates/features/docker/tools/docker/scripts/render-docker-template.js.hbs +23 -0
- package/templates/features/docker/tools/docker/scripts/render-docker-template.test.js.hbs +60 -0
- package/templates/features/docker/tools/docker/scripts/validate-docker.js.hbs +30 -0
- package/lib/src/context-builder.mjs +0 -40
- package/lib/src/file-generator.mjs +0 -109
- package/lib/src/json-generator.mjs +0 -31
- package/lib/src/package-manager.mjs +0 -139
- package/lib/src/print.mjs +0 -32
- package/lib/src/utils.mjs +0 -18
- package/lib/src/version.mjs +0 -1
- package/templates/base/builder.config.js.hbs +0 -36
- package/templates/base/src/app/components/common/anchor/anchor.component.ts.hbs +0 -32
- package/templates/base/src/app/components/common/button/button.component.ts.hbs +0 -40
- package/templates/base/src/app/dom.test.js.hbs +0 -13
- package/templates/base/src/app/services/example/example.service.ts.hbs +0 -18
- package/templates/base/src/app/views/home/home.view.test.js.hbs +0 -26
- package/templates/base/src/core/services/store/store.test.js.hbs +0 -8
- package/templates/base/src/core/services/store/store.ts.hbs +0 -39
- package/templates/base/src/core/utils/anchor-manager/anchor-manager.utils.test.js.hbs +0 -0
- package/templates/base/src/core/utils/anchor-manager/anchor-manager.utils.ts.hbs +0 -113
- package/templates/base/src/core/utils/button-manager/button-manager.utils.test.js.hbs +0 -249
- package/templates/base/src/core/utils/button-manager/button-manager.utils.ts.hbs +0 -131
- package/templates/base/src/core/utils/helpers/attributes.helper.ts.hbs +0 -50
- package/templates/base/src/core/utils/index.ts.hbs +0 -2
- package/templates/base/src/libs/index.ts.hbs +0 -4
- package/templates/base/src/libs/popover/helpers/focus-trap.helper.ts.hbs +0 -197
- package/templates/base/src/libs/popover/helpers/popover-dom.helper.ts.hbs +0 -75
- package/templates/base/src/libs/popover/popover.ts.hbs +0 -138
- package/templates/base/src/libs/snackbar/snackbar.ts.hbs +0 -75
- package/templates/base/src/styles/base/_functions.scss.hbs +0 -9
- package/templates/base/src/styles/core/_anchors.scss.hbs +0 -10
- package/templates/base/src/styles/core/_index.scss.hbs +0 -6
- package/templates/base/src/styles/core/_popover.scss.hbs +0 -96
- package/templates/base/src/styles/core/_snackbar.scss.hbs +0 -50
- package/templates/base/tools/builder/core/esbuild.js.hbs +0 -25
- package/templates/base/tools/builder/core/minify-html.js.hbs +0 -60
- package/templates/base/tools/builder/core/sass.js.hbs +0 -22
- package/templates/base/tools/builder/core/tsc.js.hbs +0 -12
- package/templates/base/tools/generator/templates/service.template.js.hbs +0 -17
- package/templates/base/tools/utils/export-flags.js.hbs +0 -6
- package/templates/features/deployHelper/tools/builder/core/compress-files.js.hbs +0 -56
- package/templates/features/deployHelper/tools/deployment/Dockerfile.hbs +0 -30
- package/templates/features/i18n/src/app/views/home/locales/en.json.hbs +0 -9
- package/templates/features/i18n/src/app/views/not-found/locales/en.json +0 -8
- package/templates/features/i18n/src/app/views/not-found/locales/fr.json +0 -8
- package/templates/features/i18n/src/core/config.ts.hbs +0 -3
- package/templates/features/i18n/src/core/services/i18n/i18n.test.js.hbs +0 -125
- package/templates/features/i18n/tools/generator/templates/json.template.js.hbs +0 -8
- package/templates/features/i18n/tools/utils/languages.js.hbs +0 -7
- package/templates/features/stylinNutin/src/styles/_custom-classes.scss.hbs +0 -9
- package/templates/features/stylinNutin/src/styles/base/_mixins.scss.hbs +0 -372
- package/templates/features/stylinNutin/src/styles/components/_index.scss.hbs +0 -3
- package/templates/features/stylinNutin/src/styles/core/_utilities.scss.hbs +0 -254
- package/templates/features/stylinNutin/src/styles/views/_index.scss.hbs +0 -0
- package/templates/features/stylinNutin/tools/generator/templates/scss.template.js.hbs +0 -4
- package/templates/features/template/src/app/views/home/home.view.html.hbs +0 -56
- package/templates/features/template/src/app/views/not-found/not-found.view.html.hbs +0 -19
- package/templates/features/template/tools/builder/core/merge-templates.js.hbs +0 -49
- package/templates/features/template/tools/generator/templates/html.template.js.hbs +0 -2
- package/templates/features/testinNutin/testin-nutin/core/index.js.hbs +0 -5
- package/templates/features/testinNutin/testin-nutin/core/src/utils/print.js.hbs +0 -64
- package/templates/features/testinNutin/testin-nutin/core/src/utils/test-queue.js.hbs +0 -64
- package/templates/features/testinNutin/testin-nutin/core/tests/globals-each-all.test.js.hbs +0 -28
- package/templates/features/testinNutin/testin-nutin/mocks/mock-store.js.hbs +0 -38
- package/templates/features/testinNutin/testin-nutin/runner.js.hbs +0 -36
- package/templates/features/testinNutin/testin-nutin/watch-tests.js.hbs +0 -21
- package/templates/features/testinNutin/testin-nutin.config.js.hbs +0 -14
- /package/lib/src/{template-compiler.mjs → common/template-compiler.mjs} +0 -0
- /package/templates/{features/i18n → base}/src/core/base-classes/base-component/helpers/i18n.helper.ts.hbs +0 -0
- /package/templates/{features/i18n → base}/src/core/services/i18n/languages.ts.hbs +0 -0
- /package/templates/base/tools/builder/{variables → core/app}/binary-extensions.js.hbs +0 -0
- /package/templates/base/tools/builder/core/{paths.js.hbs → app/paths.js.hbs} +0 -0
- /package/templates/{features/testinNutin/testin-nutin/core/src/utils → base/tools/testin-nutin/core/queue}/queue.js.hbs +0 -0
- /package/templates/{features/testinNutin/testin-nutin/core/src/utils → base/tools/testin-nutin/core/queue}/test-discovery.js.hbs +0 -0
- /package/templates/{features/testinNutin → base/tools}/testin-nutin/mocks/mock-http-client.js.hbs +0 -0
- /package/templates/{features/testinNutin → base/tools}/testin-nutin/mocks/mock-i18n.js.hbs +0 -0
- /package/templates/{features/testinNutin → base/tools}/testin-nutin/mocks/mock-router.js.hbs +0 -0
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
@use "sass:map";
|
|
2
|
-
@use "variables" as *;
|
|
3
|
-
@use "mixins";
|
|
4
|
-
|
|
5
|
-
// Utility classes prefix : 'u-'
|
|
6
|
-
|
|
7
|
-
// font size
|
|
8
|
-
@each $name, $size in $font-sizes {
|
|
9
|
-
.u-font-#{$name} {
|
|
10
|
-
font-size: $size;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// padding
|
|
15
|
-
@each $name, $space in $spacings {
|
|
16
|
-
.u-padd-x-#{$name} {
|
|
17
|
-
padding-left: $space;
|
|
18
|
-
padding-right: $space;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
@each $name, $space in $spacings {
|
|
22
|
-
.u-padd-y-#{$name} {
|
|
23
|
-
padding-top: $space;
|
|
24
|
-
padding-bottom: $space;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//margin
|
|
29
|
-
@each $name, $space in $spacings {
|
|
30
|
-
.u-marg-x-#{$name} {
|
|
31
|
-
margin-left: $space;
|
|
32
|
-
margin-right: $space;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
@each $name, $space in $spacings {
|
|
36
|
-
.u-marg-y-#{$name} {
|
|
37
|
-
margin-top: $space;
|
|
38
|
-
margin-bottom: $space;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//border-radius
|
|
43
|
-
@each $name, $radius in $border-radius {
|
|
44
|
-
.u-rounded-#{$name} {
|
|
45
|
-
border-radius: $radius;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// box-shadow
|
|
50
|
-
@each $name, $shadow in $shadows {
|
|
51
|
-
.u-shadow-#{$name} {
|
|
52
|
-
box-shadow: $shadow;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// transition
|
|
57
|
-
@each $name, $transition in $transitions {
|
|
58
|
-
.u-transition-#{$name} {
|
|
59
|
-
transition: $transition;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.u-hide-on-small {
|
|
64
|
-
@include mixins.respond-to(medium) {
|
|
65
|
-
display: none;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.u-hide {
|
|
70
|
-
display: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// color
|
|
74
|
-
.u-color-base {
|
|
75
|
-
color: $text-color;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.u-color-prim {
|
|
79
|
-
color: $primary-color;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.u-color-sec {
|
|
83
|
-
color: $secondary-color;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.u-color-acc {
|
|
87
|
-
color: $accent-color;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.u-color-bg {
|
|
91
|
-
color: $background-color;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// font weight / style
|
|
95
|
-
.u-italic {
|
|
96
|
-
font-style: italic;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.u-bold {
|
|
100
|
-
font-weight: bold;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.u-font-secondary {
|
|
104
|
-
font-family: $secondary-font;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.u-font-primary {
|
|
108
|
-
font-family: $primary-font;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// text
|
|
112
|
-
.u-text-center {
|
|
113
|
-
text-align: center;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.u-text-right {
|
|
117
|
-
text-align: right;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.u-text-left {
|
|
121
|
-
text-align: left;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// flex
|
|
125
|
-
.u-flex-center {
|
|
126
|
-
@include mixins.flex-center;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.u-flex-column {
|
|
130
|
-
@include mixins.flex-column;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.u-flex-row {
|
|
134
|
-
@include mixins.flex-row;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.u-flex-between {
|
|
138
|
-
@include mixins.flex-between;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.u-flex-around {
|
|
142
|
-
@include mixins.flex-around;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.u-flex-wrap {
|
|
146
|
-
@include mixins.flex-wrap;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//
|
|
150
|
-
.u-ellipsis {
|
|
151
|
-
@include mixins.text-ellipsis;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.u-clamp-2 {
|
|
155
|
-
@include mixins.line-clamp(2);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// positioning
|
|
159
|
-
.u-absolute-center {
|
|
160
|
-
@include mixins.absolute-center;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.u-fixed-full {
|
|
164
|
-
@include mixins.fixed-full;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// backgrounds
|
|
168
|
-
.u-bg-base {
|
|
169
|
-
background-color: $background-color;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.u-bg-inherit {
|
|
173
|
-
background-color: inherit;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.u-bg-primary {
|
|
177
|
-
background-color: $primary-color;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.u-bg-secondary {
|
|
181
|
-
background-color: $secondary-color;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.u-bg-gradient-right {
|
|
185
|
-
@include mixins.bg-gradient(right, rgba($primary-color, .7), rgba($secondary-color, .7));
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.u-bg-gradient-left {
|
|
189
|
-
@include mixins.bg-gradient(left, rgba($primary-color, .7), rgba($secondary-color, .7));
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.u-bg-gradient-top {
|
|
193
|
-
@include mixins.bg-gradient(top, rgba($primary-color, .7), rgba($secondary-color, .7));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.u-bg-gradient-bottom {
|
|
197
|
-
@include mixins.bg-gradient(bottom, rgba($primary-color, .7), rgba($secondary-color, .7));
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.u-bg-cover {
|
|
201
|
-
@include mixins.bg-cover;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.u-img-cover {
|
|
205
|
-
@include mixins.image-cover;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// animations
|
|
209
|
-
.u-transition {
|
|
210
|
-
@include mixins.transition(all 0.3s ease);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.u-hover-scale {
|
|
214
|
-
@include mixins.hover-scale;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// borders / radius
|
|
218
|
-
.u-border {
|
|
219
|
-
@include mixins.border($primary-color);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.u-border-none {
|
|
223
|
-
border: 0px solid white;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.u-rounded {
|
|
227
|
-
@include mixins.rounded;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// utility
|
|
231
|
-
.u-btn-disabled {
|
|
232
|
-
@include mixins.button-disabled;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.u-hide {
|
|
236
|
-
@include mixins.hide;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.u-sr-only {
|
|
240
|
-
@include mixins.sr-only;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.u-clearfix {
|
|
244
|
-
@include mixins.clearfix;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.u-pointer {
|
|
248
|
-
@include mixins.cursor-pointer;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.u-pre-wrap {
|
|
252
|
-
white-space:pre-wrap;
|
|
253
|
-
overflow-wrap:break-word;
|
|
254
|
-
}
|
|
File without changes
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
{{#if stylinNutin}}
|
|
3
|
-
class="u-flex-center u-flex-column u-padd-y-large"
|
|
4
|
-
{{else}}
|
|
5
|
-
style="display:flex;justify-content:center;align-items:center;flex-direction:column;padding-top:1rem;padding-bottom:1rem;"
|
|
6
|
-
{{/if}}>
|
|
7
|
-
<h1
|
|
8
|
-
{{#if i18n}}
|
|
9
|
-
data-i18n="home.title"
|
|
10
|
-
{{/if}}
|
|
11
|
-
{{#if stylinNutin}}
|
|
12
|
-
class="u-color-prim u-font-largest u-bold u-font-secondary"
|
|
13
|
-
style="color:#6C8359;"
|
|
14
|
-
{{else}}
|
|
15
|
-
style="color:#6C8359;font-size:2rem;font-weight:bold;"
|
|
16
|
-
{{/if}}
|
|
17
|
-
>{{#unless i18n}}{{projectName}}{{/unless}}</h1>
|
|
18
|
-
<span
|
|
19
|
-
{{#if stylinNutin}}
|
|
20
|
-
class="u-italic u-font-smallest u-font-secondary"
|
|
21
|
-
{{else}}
|
|
22
|
-
style="font-style:italic;font-size:0.75rem;"
|
|
23
|
-
{{/if}}
|
|
24
|
-
>nutin v{{version}}</span>
|
|
25
|
-
<img src="/assets/images/logo-trans.avif" width=250 height=250 alt="nutin's logo. A frame opened on the top left through which a plant grows.">
|
|
26
|
-
<div
|
|
27
|
-
{{#if i18n}}
|
|
28
|
-
data-i18n="home.ready"
|
|
29
|
-
{{/if}}
|
|
30
|
-
{{#if stylinNutin}}
|
|
31
|
-
class="u-font-large u-padd-y-medium"
|
|
32
|
-
style="margin-top:-2rem;"
|
|
33
|
-
{{else}}
|
|
34
|
-
style="font-size:1.5rem;paddin-top:1rem;padding-bottom:1rem;margin-top:2rem;"
|
|
35
|
-
{{/if}}
|
|
36
|
-
>{{#unless i18n}}You're all set !{{/unless}}</div>
|
|
37
|
-
<div
|
|
38
|
-
{{#if i18n}}
|
|
39
|
-
data-i18n="home.enjoy"
|
|
40
|
-
{{/if}}
|
|
41
|
-
{{#if stylinNutin}}
|
|
42
|
-
class="u-font-large u-color-sec"
|
|
43
|
-
style="color:#C56648;"
|
|
44
|
-
{{else}}
|
|
45
|
-
style="color:#C56648;font-size:1.5rem;"
|
|
46
|
-
{{/if}}
|
|
47
|
-
>{{#unless i18n}}Happy Coding 🎉{{/unless}}</div>
|
|
48
|
-
<div
|
|
49
|
-
{{#if stylinNutin}}
|
|
50
|
-
class="u-italic u-font-secondary u-font-small"
|
|
51
|
-
{{#unless transition}}style="position:fixed;bottom:0;"{{/unless}}
|
|
52
|
-
{{else}}
|
|
53
|
-
style="font-size:.875rem;font-style:italic;{{#unless transition}}position:fixed;bottom:0;{{/unless}}"
|
|
54
|
-
{{/if}}
|
|
55
|
-
>so lightweight it's <span {{#if stylinNutin}}class="u-bold"{{else}}style="font-weight:bold;"{{/if}}>nutin</span>.</div>
|
|
56
|
-
</div>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
{{#if stylinNutin}}
|
|
3
|
-
class="u-flex-center u-flex-column u-padd-y-large"
|
|
4
|
-
{{else}}
|
|
5
|
-
style="display:flex;justify-content:center;align-items:center;flex-direction:column"
|
|
6
|
-
{{/if}}>
|
|
7
|
-
<h1
|
|
8
|
-
{{#if i18n}}
|
|
9
|
-
data-i18n="not-found.content"
|
|
10
|
-
{{/if}}
|
|
11
|
-
{{#if stylinNutin}}
|
|
12
|
-
class="u-color-sec u-font-largest u-bold u-font-secondary"
|
|
13
|
-
{{else}}
|
|
14
|
-
style="font-size:2rem;font-weight:bold;"
|
|
15
|
-
{{/if}}
|
|
16
|
-
>{{#unless i18n}}Page Not Found{{/unless}}</h1>
|
|
17
|
-
<img src="/assets/images/logo-small-trans.avif" width=250 height=250 alt="nutin's small logo with a growing plant.">
|
|
18
|
-
<div data-component="home"></div>
|
|
19
|
-
</div>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { exit } from 'process';
|
|
4
|
-
import { getFilesRecursive, print, isVerbose, isProd } from '../../utils/index.js';
|
|
5
|
-
import { minifyHTML } from './minify-html.js';
|
|
6
|
-
import { PATHS } from './paths.js';
|
|
7
|
-
|
|
8
|
-
const PLACEHOLDER = '__TEMPLATE_PLACEHOLDER__';
|
|
9
|
-
|
|
10
|
-
async function mergeTemplates() {
|
|
11
|
-
const htmlFiles = await getFilesRecursive(PATHS.tempApp, 'html');
|
|
12
|
-
const fileExtension = isProd ? '.ts' : '.js';
|
|
13
|
-
|
|
14
|
-
for (const htmlPath of htmlFiles) {
|
|
15
|
-
const jsPath = htmlPath.replace(/\.html$/, fileExtension);
|
|
16
|
-
const htmlFilename = path.basename(htmlPath);
|
|
17
|
-
const jsFilename = path.basename(jsPath);
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const htmlContent = await fs.readFile(htmlPath, 'utf-8');
|
|
21
|
-
const minifiedHtml = await minifyHTML(htmlContent);
|
|
22
|
-
if (isVerbose) print.info(`Minified HTML: ${htmlPath}`);
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
let jsContent = await fs.readFile(jsPath, 'utf-8');
|
|
26
|
-
if (!jsContent.includes(PLACEHOLDER)) {
|
|
27
|
-
print.boldError(`WARNING: No matching placeholder in ${jsFilename}`);
|
|
28
|
-
print.error(`Make sure the template const is \`${PLACEHOLDER}\`.`);
|
|
29
|
-
exit(1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
jsContent = jsContent.replace(PLACEHOLDER, minifiedHtml);
|
|
33
|
-
await fs.writeFile(jsPath, jsContent);
|
|
34
|
-
await fs.unlink(htmlPath);
|
|
35
|
-
if (isVerbose) print.info(`Updated ${jsFilename} with template from ${htmlFilename}.`);
|
|
36
|
-
} catch (err) {
|
|
37
|
-
print.boldError(`ERROR: Cannot update ${jsFilename}. ${err.message}`);
|
|
38
|
-
}
|
|
39
|
-
} catch (err) {
|
|
40
|
-
print.boldError(`ERROR: Failed to read ${htmlFilename}. ${err.message}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (isVerbose) print.info(`HTML templates minified and merged in scripts.\n`)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
mergeTemplates().catch((err) => {
|
|
47
|
-
print.boldError(`Unexpected error: ${err.message}`);
|
|
48
|
-
exit(1);
|
|
49
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import config from '#root/testin-nutin.config.js';
|
|
2
|
-
|
|
3
|
-
export function printSummary(passed, failed, time) {
|
|
4
|
-
const totalTime = time.toFixed(2);
|
|
5
|
-
const total = passed + failed;
|
|
6
|
-
print.boldBlue(`\nTest Summary`);
|
|
7
|
-
print.boldInfo(`✓ ${passed} passed`);
|
|
8
|
-
print.boldError(`✗ ${failed} failed`);
|
|
9
|
-
print.info(`📖 ${total} total`);
|
|
10
|
-
print.info(`⌚️ Time: ${totalTime}ms \n`);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function printResults(results) {
|
|
14
|
-
const sortedResults = results.sort((a, b) => {
|
|
15
|
-
if (a.status === 'passed' && b.status === 'failed') return -1;
|
|
16
|
-
if (a.status === 'failed' && b.status === 'passed') return 1;
|
|
17
|
-
return 0;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
sortedResults.forEach(result => {
|
|
21
|
-
if (result.status === 'passed') {
|
|
22
|
-
if (config.verbose ) console.log(`${chalk.green('✓')} ${chalk.cyan(`${result.suiteName}`)} - ${chalk.green(`${result.name}`)}`);
|
|
23
|
-
} else {
|
|
24
|
-
print.error(`✗ ${result.suiteName} - ${result.name}`);
|
|
25
|
-
print.grayError(result.error);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function printStart() {
|
|
31
|
-
print.boldHead('\nRunning tests...');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const chalk = {
|
|
35
|
-
green: (s) => `\x1b[32m${s}\x1b[0m`,
|
|
36
|
-
red: (s) => `\x1b[31m${s}\x1b[0m`,
|
|
37
|
-
blue: (s) => `\x1b[34m${s}\x1b[0m`,
|
|
38
|
-
yellow: (s) => `\x1b[33m${s}\x1b[0m`,
|
|
39
|
-
cyan: (s) => `\x1b[36m${s}\x1b[0m`,
|
|
40
|
-
purple: (s) => `\x1b[35m${s}\x1b[0m`,
|
|
41
|
-
gray: (s) => `\x1b[90m${s}\x1b[0m`,
|
|
42
|
-
boldGreen: (s) => `\x1b[1;32m${s}\x1b[0m`,
|
|
43
|
-
boldRed: (s) => `\x1b[1;31m${s}\x1b[0m`,
|
|
44
|
-
boldBlue: (s) => `\x1b[1;34m${s}\x1b[0m`,
|
|
45
|
-
boldYellow: (s) => `\x1b[1;33m${s}\x1b[0m`,
|
|
46
|
-
boldCyan: (s) => `\x1b[1;36m${s}\x1b[0m`,
|
|
47
|
-
boldPurple: (s) => `\x1b[1;35m${s}\x1b[0m`,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const print = {
|
|
51
|
-
head: (s) => console.log(`${chalk.purple(s)}`),
|
|
52
|
-
boldHead : (s) => console.log(`${chalk.boldPurple(s)}`),
|
|
53
|
-
section: (s) => console.log(`${chalk.yellow(s)}`),
|
|
54
|
-
boldSection: (s) => console.log(`${chalk.boldYellow(s)}`),
|
|
55
|
-
info: (s) => console.log(`${chalk.green(s)}`),
|
|
56
|
-
boldInfo: (s) => console.log(`${chalk.boldGreen(s)}`),
|
|
57
|
-
success: (s) => console.log(`${chalk.cyan(s)}`),
|
|
58
|
-
boldSuccess: (s) => console.log(`${chalk.boldCyan(s)}`),
|
|
59
|
-
error: (s) => console.error(`${chalk.red(s)}`),
|
|
60
|
-
boldError: (s) => console.error(`${chalk.boldRed(s)}`),
|
|
61
|
-
grayError: (s) => console.error(`${chalk.gray(s)}`),
|
|
62
|
-
blue: (s) => console.log(`${chalk.blue(s)}`),
|
|
63
|
-
boldBlue: (s) => console.log(`${chalk.boldBlue(s)}`),
|
|
64
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import Queue from './queue.js';
|
|
2
|
-
import { printStart, printSummary, printResults } from './print.js';
|
|
3
|
-
|
|
4
|
-
const testQueue = new Queue();
|
|
5
|
-
let passed = 0;
|
|
6
|
-
let failed = 0;
|
|
7
|
-
let elapsedTime;
|
|
8
|
-
|
|
9
|
-
export function addTest(test) {
|
|
10
|
-
testQueue.enqueue(test);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function runQueuedTests() {
|
|
14
|
-
printStart();
|
|
15
|
-
const startTime = performance.now();
|
|
16
|
-
const testAmount = testQueue.length;
|
|
17
|
-
const results = [];
|
|
18
|
-
let previousSuite = null;
|
|
19
|
-
let previousSuiteAfterAll = null;
|
|
20
|
-
let test;
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < testAmount; i++) {
|
|
23
|
-
try {
|
|
24
|
-
test = testQueue.deque();
|
|
25
|
-
|
|
26
|
-
if (test.suiteName !== previousSuite) {
|
|
27
|
-
teardownJsdom();
|
|
28
|
-
if (previousSuiteAfterAll) {
|
|
29
|
-
await previousSuiteAfterAll();
|
|
30
|
-
}
|
|
31
|
-
setupJsdom();
|
|
32
|
-
if (test.beforeAll) {
|
|
33
|
-
await test.beforeAll();
|
|
34
|
-
}
|
|
35
|
-
previousSuite = test.suiteName;
|
|
36
|
-
previousSuiteAfterAll = test.afterAll;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (test.beforeEach) await test.beforeEach();
|
|
40
|
-
await test.testFn();
|
|
41
|
-
if (test.afterEach) await test.afterEach();
|
|
42
|
-
|
|
43
|
-
passed++;
|
|
44
|
-
results.push({
|
|
45
|
-
suiteName: test.suiteName,
|
|
46
|
-
status: 'passed',
|
|
47
|
-
name: test.testName
|
|
48
|
-
});
|
|
49
|
-
} catch (err) {
|
|
50
|
-
failed++;
|
|
51
|
-
results.push({
|
|
52
|
-
suiteName: test.suiteName,
|
|
53
|
-
status: 'failed',
|
|
54
|
-
name: test.testName,
|
|
55
|
-
error: err.stack
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const endTime = performance.now();
|
|
61
|
-
elapsedTime = (endTime - startTime);
|
|
62
|
-
printResults(results);
|
|
63
|
-
printSummary(passed, failed, elapsedTime);
|
|
64
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
describe('globals beforeEach/All and afterEach/All', () => {
|
|
2
|
-
let beforeEachCount = 0;
|
|
3
|
-
let beforeAllCount = 0;
|
|
4
|
-
let afterEachCount = 0;
|
|
5
|
-
|
|
6
|
-
beforeAll(() => {
|
|
7
|
-
beforeAllCount++;
|
|
8
|
-
});
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
beforeEachCount++;
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
afterEachCount++;
|
|
14
|
-
});
|
|
15
|
-
afterAll(() => {
|
|
16
|
-
console.debug('afterAll called.');
|
|
17
|
-
});
|
|
18
|
-
it('should be called once for all and once for each', () => {
|
|
19
|
-
expect(beforeAllCount).toEqual(1);
|
|
20
|
-
expect(beforeEachCount).toEqual(1);
|
|
21
|
-
expect(afterEachCount).toEqual(0);
|
|
22
|
-
});
|
|
23
|
-
it('should be called once for all and twice for each', () => {
|
|
24
|
-
expect(beforeAllCount).toEqual(1);
|
|
25
|
-
expect(beforeEachCount).toEqual(2);
|
|
26
|
-
expect(afterEachCount).toEqual(1);
|
|
27
|
-
});
|
|
28
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createMockMethod } from './create-mock-method.js';
|
|
2
|
-
|
|
3
|
-
export class MockStore {
|
|
4
|
-
constructor() {
|
|
5
|
-
this._state = {};
|
|
6
|
-
|
|
7
|
-
this.set = createMockMethod((key, value) => {
|
|
8
|
-
this._state[key] = value;
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
this.get = createMockMethod((key) => {
|
|
12
|
-
return this._state[key];
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
this.subscribe = createMockMethod();
|
|
16
|
-
this.unsubscribe = createMockMethod();
|
|
17
|
-
|
|
18
|
-
this.clear = createMockMethod(() => {
|
|
19
|
-
this._state = {};
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
this.onDestroy = createMockMethod();
|
|
23
|
-
this.disposeStore = createMockMethod(() => {
|
|
24
|
-
this.clear();
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
reset() {
|
|
29
|
-
this.set.mockReset();
|
|
30
|
-
this.get.mockReset();
|
|
31
|
-
this.subscribe.mockReset();
|
|
32
|
-
this.unsubscribe.mockReset();
|
|
33
|
-
this.clear.mockReset();
|
|
34
|
-
this.onDestroy.mockReset();
|
|
35
|
-
this.disposeStore.mockReset();
|
|
36
|
-
this._state = {};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { registerTestGlobals, getTestFiles, runQueuedTests, print } from './core/index.js';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import config from '#root/testin-nutin.config.js';
|
|
4
|
-
|
|
5
|
-
registerTestGlobals();
|
|
6
|
-
|
|
7
|
-
let testFiles = config.origins.flatMap(
|
|
8
|
-
origin => getTestFiles(`../${origin}`)
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
const args = process.argv.slice(2);
|
|
12
|
-
if (args.length) {
|
|
13
|
-
testFiles = testFiles.filter(file => args.some(f => file.includes(f)));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async function loadTestFile(file) {
|
|
17
|
-
setupJsdom();
|
|
18
|
-
await import(file);
|
|
19
|
-
teardownJsdom();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function runTests() {
|
|
23
|
-
if (config.verbose) print.head('Test suites :');
|
|
24
|
-
for (const file of testFiles) {
|
|
25
|
-
try {
|
|
26
|
-
await loadTestFile(file);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
print.boldError(`✗ ${file} failed to load:`);
|
|
29
|
-
print.grayError(error.stack);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
await runQueuedTests();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
runTests();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import chokidar from 'chokidar';
|
|
2
|
-
import { exec } from 'child_process';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { print } from './core/index.js'
|
|
5
|
-
|
|
6
|
-
const watcher = chokidar.watch(['src', 'test', 'unit', 'e2e'], {
|
|
7
|
-
ignored: /(^|[/\\])\../,
|
|
8
|
-
persistent: true,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
print.boldHead('Watching for test changes...')
|
|
12
|
-
|
|
13
|
-
watcher.on('change', (filePath) => {
|
|
14
|
-
console.clear();
|
|
15
|
-
print.boldInfo(`\n🔄 File changed: ${path.relative(process.cwd(), filePath)}\n`);
|
|
16
|
-
|
|
17
|
-
exec('node --experimental-modules testin-nutin/runner.js', (err, stdout, stderr) => {
|
|
18
|
-
if (stdout) process.stdout.write(stdout);
|
|
19
|
-
if (stderr) process.stderr.write(stderr);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
origins: [
|
|
3
|
-
'src/app', // actual app code
|
|
4
|
-
// 'src/core', // toolkit core logic
|
|
5
|
-
// 'testin-nutin/core/tests', // test globals
|
|
6
|
-
],
|
|
7
|
-
jsdomOptions: {
|
|
8
|
-
runScripts: false, // or true ("dangerously") if needed
|
|
9
|
-
resources: false, // or true ("usable") if needed
|
|
10
|
-
freezeGlobals: false,
|
|
11
|
-
pretendToBeVisual: true,
|
|
12
|
-
},
|
|
13
|
-
verbose: false,
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/{features/testinNutin → base/tools}/testin-nutin/mocks/mock-http-client.js.hbs
RENAMED
|
File without changes
|
|
File without changes
|
/package/templates/{features/testinNutin → base/tools}/testin-nutin/mocks/mock-router.js.hbs
RENAMED
|
File without changes
|