Skip to content

Conversation

@jeronimoalbi
Copy link
Member

Closes #2382

jeronimoalbi added 4 commits May 5, 2022 17:55
The package uses Vitest [https://vitest.dev] to run test written in
typescript.
This function allows running typescript tests as part of an integration
tests agains an scaffolded chain.
@jeronimoalbi jeronimoalbi self-assigned this May 5, 2022
@jeronimoalbi jeronimoalbi changed the title tests: add integration test to test generated TS client test: add integration test to test generated TS client May 5, 2022
@fadeev
Copy link
Contributor

fadeev commented May 6, 2022

Are these tests for the current or the new client? We might not want to invest in testing Vuex, because it is on its way out.

@jeronimoalbi
Copy link
Member Author

Are these tests for the current or the new client? We might not want to invest in testing Vuex, because it is on its way out.

The tests are for the typescript client related code, but is true that right now it can be misleading as we have to run npm install in the "vue" folder because of the cosmos package dependencies.

@ilgooz should we wait for the Vue / TS client refactor PR to be finished ? I am not sure if otherwise we would need a small refactor for the tests, I am thinking we might.

@ilgooz
Copy link
Member

ilgooz commented May 8, 2022

This PR is about preparing the environment for testing the generated JS code. There is also one test to test the generic client (generic client's API won't be changed by the refactor), rest of the tests including for the ones related to Vuex should be added by @ignite-hq/web.

We don't need to wait code generation refactoring to be finished to merge this PR, they're not relevant.

jeronimoalbi added 4 commits May 9, 2022 10:39
This fixes the client tests that were giving a timeout because the chain
was not running.
This change proposes a way to organize TS client related integration
tests. The idea is to have the Go and TS files at the same level to make
their relation obvious, instead of having the TS tests inside a sub
testdata dir which hides it.
@jeronimoalbi jeronimoalbi marked this pull request as ready for review May 9, 2022 10:09
@jeronimoalbi jeronimoalbi requested a review from marinhoarthur May 9, 2022 14:34
@tbruyelle
Copy link
Contributor

@jeronimoalbi I merged develop and surprisingly the tests are working, maybe it's not working on my machine because of the npm version...

$ npm version
{
  npm: '8.18.0',
  node: '18.7.0',
  v8: '10.2.154.13-node.9',
  uv: '1.43.0',
  zlib: '1.2.12',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.48.0',
  napi: '8',
  llhttp: '6.0.7',
  openssl: '1.1.1q',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022a',
  unicode: '14.0'
}

@tbruyelle
Copy link
Contributor

@jeronimoalbi on my machine, the cosmosgen tests are failing with this error :

--- FAIL: TestBankModule (6.60s)
    exec.go:109:
        	Error Trace:	/home/tom/src/ignite/cli/integration/cosmosgen/exec.go:109
        	            				/home/tom/src/ignite/cli/integration/cosmosgen/bank_module_test.go:66
        	Error:      	Received unexpected error:
        	            	exit status 1
        	Test:       	TestBankModule
        	Messages:   	generate vuex store
        	            	
        	            	Logs:
        	            	
cannot build app:
        	            	
        	            		lstat /home/tom/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.44.0/x/group/module: no such file or directory

Any hint ?

@jeronimoalbi
Copy link
Member Author

@jeronimoalbi on my machine, the cosmosgen tests are failing.
Any hint ?

Actually no, I will run it locally to see if I can figure it out but I would recommend to wait until #2143 is merged, which should happen soon, before working on this branch because it needs some changes to get fully up to date. Once the related PR is merged I will work on this to bring it up to date.

@jeronimoalbi jeronimoalbi force-pushed the feature/tsclient-integration-tests branch from db3b77d to b3a9043 Compare September 27, 2022 16:34
tbruyelle
tbruyelle previously approved these changes Sep 28, 2022
@jeronimoalbi jeronimoalbi merged commit ec1406b into develop Oct 3, 2022
@jeronimoalbi jeronimoalbi deleted the feature/tsclient-integration-tests branch October 3, 2022 15:52
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
* feat: add integration env function to update config.yml

* feat: add integration env function to install Vue boilerplate deps

* feat: add tstestrunner package to integration tests

The package uses Vitest [https://vitest.dev] to run test written in
typescript.

* feat: add integration env function to run typescript tests

This function allows running typescript tests as part of an integration
tests agains an scaffolded chain.

* ci: exclude "testdata" dir from the integration tests run

* feat: add fetch API support to TS client tests

* chore: rename InstallClientDep to InstallClientVueDeps

* test: add integration TS client test to perform a transfer

* fix: change bank client test to serve chain in gopher and wait

This fixes the client tests that were giving a timeout because the chain
was not running.

* refactor: add tsclient dir to group TS client tests with Go test files

This change proposes a way to organize TS client related integration
tests. The idea is to have the Go and TS files at the same level to make
their relation obvious, instead of having the TS tests inside a sub
testdata dir which hides it.

* refactor: remove InstallClientVueDeps to simplify env API

* refactor: move tstestrunner package into tsclient's testdata dir

* refactor: move TS bank tests to a separate folder

* refactor: move tsclient bank module test to cosmosgen dir

* refactor: move testdata/tstestrunner to integration dir

* feat: change TS tests to discover user generated module packages

The packages for the user modules can be imported in the TS client
integration tests with this change

* refactor: change TS test runner to init global values

This allows the removal of repeated test code into the test runner
domain.

* feat: change test env to allow choosing the TS client test file

The option allows to look for tests inside a single test file, otherwise
it would happen that all test files are checked.

* refactor: change bank module test to send accounts to TS tests

* chore: remove ClientTestDir option for the integration tests

The option is now useless because all the tests must live inside the
"integration" dir and the relative path to a test file can be assigned
using the ClientTestFile option.

* chore: change names for consistency

* refactor: add "testutil" folder to organize tstestrunner code

* fix: import paths for bank module integration test

* refactor: moved client integration support to a separate file

* chore: update changelog

* chore: remove unused ts-client generation command flag

* refactor: change RunClientTests to match latest changes

* refactor: change integration TS testrunner for the latest changes

* refactor: change bank TS module test to work with latest changes

* fix: remove `--proto-all-modules` from TS client integration test

* chore: changed `global` TS variable to `globalThis`

Co-authored-by: Alex Johnson <alex@shmeeload.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests/js: add integration test to test generated TS client

6 participants