Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Jest to Vitest #273

Merged
merged 26 commits into from
Apr 2, 2024
Merged

Switch from Jest to Vitest #273

merged 26 commits into from
Apr 2, 2024

Conversation

twelch
Copy link
Contributor

@twelch twelch commented Mar 8, 2024

This is not fully functional. Most/all geoblaze functions don't seem to run properly, throwing an internal error. More work needed. See node-test-runner to test out swapping geoblaze tests over to use the vanilla node test runner.

  • add setup/teardown scripts that start and stop extra data server
  • geoblaze tests
  • browser tests (fix mocking)
  • e2e tests (fix mocking)
  • Fix all skipped tests
  • Replace runner.js. Need to be able to run geoprocessing test CLI command from a project
  • Fix vitest globals so explicit import not needed
  • Switch to Vitest workspace - https://vitest.dev/guide/workspace.html

@twelch twelch marked this pull request as draft March 8, 2024 17:15
@twelch
Copy link
Contributor Author

twelch commented Apr 2, 2024

This PR is stable enough to merge. Lots of failing tests that are currently skipped, solving flatgeobuf library upgrade issues (regenerating flatgeobuf files for global data possibly) should resolve many, Jest mocking makes up many of the remainder.

@twelch twelch marked this pull request as ready for review April 2, 2024 18:53
@twelch twelch merged commit 00362ec into esm Apr 2, 2024
1 check passed
@twelch twelch deleted the vitest branch April 2, 2024 18:54
twelch added a commit that referenced this pull request May 14, 2024
…book 8 (#272)

* - update lerna and node, add eslint esm preset
- update typescript and ts-node config
- file path and extension changes
- migrate away from styled-icons/boxicons due to typing issue with esm
- update flatgeobuf, remove old workarounds
- add skipLibCheck to resolve flatgeobuf internal import error
- update turf to v7 prerelease, migrate to exporting latest geojson types, tighten up geometry generics
- ignore rbush type import errors
- switch from ts-node to tsx for prepare script
- migrating use of __dirname to new method

* switch CI to use node 20

* Migrate base-project and template packages to esm

* disable run of test suite on commit until resolved

* missed test

* fix fetchPolyfill import

* switch to nodenext module and moduleResolution.  Add assert to json imports

* clean up import of CJS dependencies that don't have a true default import. Migrate use of require in some places, enough to get init working.

* switch to tsx for translation extract and migrate babel config to cjs extension

* fix report name for template-blank-project

* Switch from Jest to Vitest (#273)

* start switch to vitest

* drop jest stuff, other dirname and import dep fixes, reset lerna.json

* use default-import to use and extend rbush

* add vitest dep formally, add vitest-setup loading jest-dom

* Migrate more tests, make them runnable standalone in vscode debug with direct import

* update geoblaze, update overlap output changes related to turf area. skip many remaining tests

* fix prepare

* comment out and skip tests with jest mocks

* initial migrate of scripts to vitest, skipping failing precalc datasource tests

* stub vitest project runner

* clean up vitest config type error, and punt on browser test mock error and bump vi* versions

* skip remaining failing tests, add back test commit gate

* try making vitest regular dependency

* update runner to config project vitest

* merge cli options

* fix vitest cli command

* switch to TEST_ROOT env var

* shift jsdom dep for project use

* fix TEST_ROOT

* simplify test commands, tune test config

* update vitest comments

* add data server back to test command

* vitest comments

* drop ts-node for tsx

* add testing of base and template packages, skipping most.  Migrate remaining commands to vitest. Migrate to turf 7 in projects

* fix type error, upgrade node-fetch, fix launcher paths, VectorDatasource not fetching properly?

* add new world fgb and confirm test passing with latest unstable gp docker workspace

* downgrade flatgeobuf to resolve timeout error, add back skipped tests

* migrate to new import.meta.dirname available with node 20.12

* update fetch polyfill and upgrade again to latest flatgeobuf.  subdivided datasource fetch also resolved.

* unskip remaining tests utilizing flatgeobuf, update sideEffects for fetch polyfill

* Switch to esbuild (#278)

* convert function builder to esbuild

* fix other function output dir, cleanup negative zero in cleanCoords

* add buildClient using esbuild with html plugin, refactor App to receive lazy loaded report clients, fix loose client-ui exports

* add esbuild polyfill, address esbuild strict module import - pare down projectClient import paths, switch client away from using top-level gp lib import, shift top-level indexes to prevent pollution of node code in ui code, guard use of process env var

* Switch to generating ReportApp.tsx in .build-web with lazy load of report clients

* on build copy language assets to .build-web

* bring back template smoke tests

* AWS - deploy pure ESM code for Lambda and client, on node 20 (#279)

* upgrade aws-cdk-lib and aws-sdk, add package.json to build to get esm enabled in lambda, move esbuild dep to top of monorepo, add node 20 runtime

* update data scripts to work in monorepo

* fix precalc script env

* build - create isolated mini package per function with own entry point. Add type assertion to language json import

* upgrade zx, refactor translation install and extract to use scripts clarify build script

* add missing esbuild plugins add missing babel plugin for translation extract, add client polyfill globals process true

* cleanup isHostedOnLambda

* process empty

* bump

* directly set client lambda env vars

* add esbuild metafile output

* add ANALYZE  env vars

* fix metafile output path

* Switch to gp core imports in client to not pull backend modules

* Allow minify to be overridden, defaults to true

* fix minify arg passing

* add cloufront access to client bucket to be able to access client files in directories.  Fix dynamic import of translations in browser client

* update translationInstall to be more comprehensive

* update dirname in importTerms and publishTerms, loosen gitignore on i18n dir

* Make sure .build dir created, remove old createManifest

* bump

* simplify generateHandler, add guard to .build dir copy

* Cut out intermediate build in gp .build dir, go straight to project path .build

* simplify build client gp path discovery

* make build client use gp dependencies. removes need for esbuild deps in project

* replace use of esbuild-plugin-html which doesn't support entry point outside of current directory

* upgrade to typescript 5.4.5

* swtich from assert json to with json

* fully switch from assert to with import syntax, esbuild still converts to older assert syntax but should change at some point

* rebuild package lockfile, major non-breaking npm upgrades

* additional upgrades:
- polygon-clipping upgrade resulted in additional vertice in some clip results slightly changing value (<.04 sq meters).
- Update base translations. Fix translations extract with babel import assertion plugin.

* upgrade babel proposal plugins to official

* update husky prepare command, husky install is deprecated

* migrate to new styled-components .attrs() to define caller-defined attributes to pass to components

* switch to transient prop for duration ProgressBar

* Vite for client dev, build, storybook (#282)

* switch to transient prop for duration ProgressBar

* start conversion to Vite for client build, still need to fix import attributes and add dev server

* Migrate start:client to Vite, language dynamic import not working or keeping with:json import assertion

* Migrate gp lib to storybook 8 using Vite, missing project storybook still

* drop babel from gp vite config, causing require error

* add back storybook to build docs

* migrate from start-storybook to just storybook

* refactor report stories to use code generator with story-cache

* add story-cache to base project gitignore

* change report-stories to example-stories. Migrate templates to use them.  reports required to use named export

* migrate create:report to node 20 patterns.  Fix classColumn type error

* glob delete story caches on startup, add vite types using d.ts file for asset import

* switch to Vite glob loader for language modules

* no need to copy language modules into build-web anymore

* add vite to base-project

* export pathUtils, simplify tsconfig

* Drop unused TranslatorSync component

* shift storybook to dependencies for project user

* Change story folder structure

* Add turf/helpers to base-project since common project use

* add all to dependencies to try and solve storybook start error

* export datasource helpers, remove unused vitest workspace, update min node and npm in package.json

* Make project storybook+vite independent of gp version

* make styled-components props transient, drop unused main from base-project package.json

* vite configure web worker

* remove vite worker config since web worker not being used

* fix story sort order

* fix blank-project functions

* attempt fix to favicon install command

* add storybook install script for migraters.  Add initial Migrating docs

* add back default export to report clients require for React.lazy load

* nit Migrating
twelch added a commit that referenced this pull request Jun 25, 2024
…book 8 (#272)

* - update lerna and node, add eslint esm preset
- update typescript and ts-node config
- file path and extension changes
- migrate away from styled-icons/boxicons due to typing issue with esm
- update flatgeobuf, remove old workarounds
- add skipLibCheck to resolve flatgeobuf internal import error
- update turf to v7 prerelease, migrate to exporting latest geojson types, tighten up geometry generics
- ignore rbush type import errors
- switch from ts-node to tsx for prepare script
- migrating use of __dirname to new method

* switch CI to use node 20

* Migrate base-project and template packages to esm

* disable run of test suite on commit until resolved

* missed test

* fix fetchPolyfill import

* switch to nodenext module and moduleResolution.  Add assert to json imports

* clean up import of CJS dependencies that don't have a true default import. Migrate use of require in some places, enough to get init working.

* switch to tsx for translation extract and migrate babel config to cjs extension

* fix report name for template-blank-project

* Switch from Jest to Vitest (#273)

* start switch to vitest

* drop jest stuff, other dirname and import dep fixes, reset lerna.json

* use default-import to use and extend rbush

* add vitest dep formally, add vitest-setup loading jest-dom

* Migrate more tests, make them runnable standalone in vscode debug with direct import

* update geoblaze, update overlap output changes related to turf area. skip many remaining tests

* fix prepare

* comment out and skip tests with jest mocks

* initial migrate of scripts to vitest, skipping failing precalc datasource tests

* stub vitest project runner

* clean up vitest config type error, and punt on browser test mock error and bump vi* versions

* skip remaining failing tests, add back test commit gate

* try making vitest regular dependency

* update runner to config project vitest

* merge cli options

* fix vitest cli command

* switch to TEST_ROOT env var

* shift jsdom dep for project use

* fix TEST_ROOT

* simplify test commands, tune test config

* update vitest comments

* add data server back to test command

* vitest comments

* drop ts-node for tsx

* add testing of base and template packages, skipping most.  Migrate remaining commands to vitest. Migrate to turf 7 in projects

* fix type error, upgrade node-fetch, fix launcher paths, VectorDatasource not fetching properly?

* add new world fgb and confirm test passing with latest unstable gp docker workspace

* downgrade flatgeobuf to resolve timeout error, add back skipped tests

* migrate to new import.meta.dirname available with node 20.12

* update fetch polyfill and upgrade again to latest flatgeobuf.  subdivided datasource fetch also resolved.

* unskip remaining tests utilizing flatgeobuf, update sideEffects for fetch polyfill

* Switch to esbuild (#278)

* convert function builder to esbuild

* fix other function output dir, cleanup negative zero in cleanCoords

* add buildClient using esbuild with html plugin, refactor App to receive lazy loaded report clients, fix loose client-ui exports

* add esbuild polyfill, address esbuild strict module import - pare down projectClient import paths, switch client away from using top-level gp lib import, shift top-level indexes to prevent pollution of node code in ui code, guard use of process env var

* Switch to generating ReportApp.tsx in .build-web with lazy load of report clients

* on build copy language assets to .build-web

* bring back template smoke tests

* AWS - deploy pure ESM code for Lambda and client, on node 20 (#279)

* upgrade aws-cdk-lib and aws-sdk, add package.json to build to get esm enabled in lambda, move esbuild dep to top of monorepo, add node 20 runtime

* update data scripts to work in monorepo

* fix precalc script env

* build - create isolated mini package per function with own entry point. Add type assertion to language json import

* upgrade zx, refactor translation install and extract to use scripts clarify build script

* add missing esbuild plugins add missing babel plugin for translation extract, add client polyfill globals process true

* cleanup isHostedOnLambda

* process empty

* bump

* directly set client lambda env vars

* add esbuild metafile output

* add ANALYZE  env vars

* fix metafile output path

* Switch to gp core imports in client to not pull backend modules

* Allow minify to be overridden, defaults to true

* fix minify arg passing

* add cloufront access to client bucket to be able to access client files in directories.  Fix dynamic import of translations in browser client

* update translationInstall to be more comprehensive

* update dirname in importTerms and publishTerms, loosen gitignore on i18n dir

* Make sure .build dir created, remove old createManifest

* bump

* simplify generateHandler, add guard to .build dir copy

* Cut out intermediate build in gp .build dir, go straight to project path .build

* simplify build client gp path discovery

* make build client use gp dependencies. removes need for esbuild deps in project

* replace use of esbuild-plugin-html which doesn't support entry point outside of current directory

* upgrade to typescript 5.4.5

* swtich from assert json to with json

* fully switch from assert to with import syntax, esbuild still converts to older assert syntax but should change at some point

* rebuild package lockfile, major non-breaking npm upgrades

* additional upgrades:
- polygon-clipping upgrade resulted in additional vertice in some clip results slightly changing value (<.04 sq meters).
- Update base translations. Fix translations extract with babel import assertion plugin.

* upgrade babel proposal plugins to official

* update husky prepare command, husky install is deprecated

* migrate to new styled-components .attrs() to define caller-defined attributes to pass to components

* switch to transient prop for duration ProgressBar

* Vite for client dev, build, storybook (#282)

* switch to transient prop for duration ProgressBar

* start conversion to Vite for client build, still need to fix import attributes and add dev server

* Migrate start:client to Vite, language dynamic import not working or keeping with:json import assertion

* Migrate gp lib to storybook 8 using Vite, missing project storybook still

* drop babel from gp vite config, causing require error

* add back storybook to build docs

* migrate from start-storybook to just storybook

* refactor report stories to use code generator with story-cache

* add story-cache to base project gitignore

* change report-stories to example-stories. Migrate templates to use them.  reports required to use named export

* migrate create:report to node 20 patterns.  Fix classColumn type error

* glob delete story caches on startup, add vite types using d.ts file for asset import

* switch to Vite glob loader for language modules

* no need to copy language modules into build-web anymore

* add vite to base-project

* export pathUtils, simplify tsconfig

* Drop unused TranslatorSync component

* shift storybook to dependencies for project user

* Change story folder structure

* Add turf/helpers to base-project since common project use

* add all to dependencies to try and solve storybook start error

* export datasource helpers, remove unused vitest workspace, update min node and npm in package.json

* Make project storybook+vite independent of gp version

* make styled-components props transient, drop unused main from base-project package.json

* vite configure web worker

* remove vite worker config since web worker not being used

* fix story sort order

* fix blank-project functions

* attempt fix to favicon install command

* add storybook install script for migraters.  Add initial Migrating docs

* add back default export to report clients require for React.lazy load

* nit Migrating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant