vesper icon indicating copy to clipboard operation
vesper copied to clipboard

Samples not working at all

Open MichalLytek opened this issue 7 years ago • 3 comments

I wanted to test how subscriptions work but I'm not able to run the samples, e.g. sample11-subscribers:

E:\#Programowanie\#GitHub\vesper\sample\typescript\sample11-subscribers> npx ts-node index.ts
TypeError: this.connection.createQueryRunner is not a function

I've commented the lines with entityManager but subscriptions still doesn't work. I also don't see an option to set the topic list of subscriptions - only the method name is used as trigger.

@pleerock I appreciate your work but it looks like the samples are just a bunch of lines of code that show the API draft, not the real use cases that users can run and experiment with it. I think that you would catch this bugs if you have tests - I'm shocked that you can create a big framework without single line of tests 😨

MichalLytek avatar Apr 01 '18 17:04 MichalLytek

I appreciate your work but it looks like the samples are just a bunch of lines of code that show the API draft

We are using this framework a few months in production already, its not a draft, everything is working

I think that you would catch this bugs if you have tests - I'm shocked that you can create a big framework without single line of tests 😨

time. Its not an issue, I'll do that later.

TypeError: this.connection.createQueryRunner is not a function

hm hm hm can't imagine why you have this error. I just removed node_modules made npm i and run:

$ ts-node ./sample/typescript/sample1-simple/index.ts 

and everything works, queries are successful. Also run sample11, here is a log to prove:

$ ts-node ./sample/typescript/sample11-subscribers/index.ts 
query: PRAGMA foreign_keys = OFF;
query: BEGIN TRANSACTION
query: SELECT 'DROP TABLE "' || name || '";' as query FROM "sqlite_master" WHERE "type" = 'table' AND "name" != 'sqlite_sequence'
query: DROP TABLE "post";
query: COMMIT
query: PRAGMA foreign_keys = ON;
query: BEGIN TRANSACTION
query: SELECT * FROM "sqlite_master" WHERE "type" = 'table' AND "name" IN ('message')
query: SELECT * FROM "sqlite_master" WHERE "type" = 'index' AND "tbl_name" IN ('message')
query: CREATE TABLE "message" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "text" varchar NOT NULL, "receiver" integer NOT NULL)
query: COMMIT
query: SELECT "Message"."id" AS "Message_id", "Message"."text" AS "Message_text", "Message"."receiver" AS "Message_receiver" FROM "message" "Message"
query {
  messages {
    id
    text
  }
}
{
  "data": {
    "messages": []
  }
}

Can you try to remove node_modules and npm i again? Do you have compiler errors?

pleerock avatar Apr 02 '18 06:04 pleerock

hm hm hm can't imagine why you have this error. I just removed node_modules made npm i and run: and everything works, queries are successful. Also run sample11, here is a log to prove:

Looks like the ormconfig.json file was not enough, I had to create it in the root of the repository. No errors on console about that was misleading 😕 Maybe you could provide public db for samples purposes? It's more newbie-friendly - install & run, no digging in code to make it working.

But subscriptions doesn't work out of the box since you haven't provide graphIQLRoute: true, or playground: true options to the bootstrap. I've managed to run subscriptions in GraphiQL but in Playground I'm still not able.

Also it looks like you have a bug in your code: image

I'm shocked that you can create a big framework without single line of tests 😨 time. Its not an issue, I'll do that later.

From my experience, tests are a huge timesaver during development - I'm able to add new features in constant time, with confidence that everything works, without the need to manually run the examples that might be affected by the changes 😕

We are using this framework a few months in production already, its not a draft, everything is working

I admire. One typo in non-tested codebase and your production is crashed. Sounds like so much fun! 😆 As a developer, I wouldn't trust the big, black-box framework without any tests but looks like there are some stunt mans 😉

MichalLytek avatar Apr 02 '18 07:04 MichalLytek

Maybe you could provide public db for samples purposes?

I have plans to create a public samples

But subscriptions doesn't work out of the box since you haven't provide graphIQLRoute: true, or playground: true options to the bootstrap. I've managed to run subscriptions in GraphiQL but in Playground I'm still not able.

thanks for the report, I'll check it

From my experience, tests are a huge timesaver during development - I'm able to add new features in constant time, with confidence that everything works, without the need to manually run the examples that might be affected by the changes

of course, you know me not a first year, probably you know that Im aware about tests value 😆

I admire. One typo in non-tested codebase and your production is crashed. Sounds like so much fun! 😆 As a developer, I wouldn't trust the big, black-box framework without any tests but looks like there are some stunt mans 😉

you are overstating. As I told its a matter of time, I'll do complete test coverage once I get time for it. It is a new framework and it needs time to achieve all its aspects. Non of tools I developed had tests right from the beginning, don't worry about this concrete aspect, there will be complete test coverage very soon. Framework is quite small actually.

pleerock avatar Apr 02 '18 09:04 pleerock