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

/blog/posts/20160116-ContinuousTestingOfTypeScriptCode.html #32

Open
damirarh opened this issue Feb 5, 2023 · 14 comments
Open

/blog/posts/20160116-ContinuousTestingOfTypeScriptCode.html #32

damirarh opened this issue Feb 5, 2023 · 14 comments

Comments

@damirarh
Copy link
Owner

damirarh commented Feb 5, 2023

Imported

URL: https://www.damirscorner.com/blog/posts/20160116-ContinuousTestingOfTypeScriptCode.html

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by dadepo on 2016-07-31T03:07:52

That should be

`tsd install jasmine --save (--save comes after jasmine)`

found this out after 5 minutes of scratching my head wondering why it was not installing and after finding this https://github.com/Definite...

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Damir Arh on 2016-07-31T05:20:10

Thank you for the correction. You are absolutely right. I guess I tried too hard to make all the commands look similar. I corrected the mistake in the post so that future readers won't have the same problem.

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by MarcoArruda on 2016-12-14T02:20:03

Nice tutorial!
But I had a problem..
If I use export on classes that I want to test, karma rises an error "Uncaught ReferenceError: exports is not defined".
And if I don't use it, I can't import the class on my application. It does not compile using ///reference like you are doing in test files.

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Damir Arh on 2016-12-17T15:29:36

Yes, this happens because the browser executing the test can't handle the modular JavaScript code that's produced with the above configuration. Karma will need to resolve the dependencies for the browser and bundle the files. You can use Browserify to do that. I've written another blogpost, explaining how to configure Karma in this case. I hope it helps.

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Bertus van Dalen on 2016-12-21T06:37:39

Hello. This is a super great article, really helpful after having gone thru some quite messy setups based on other articles. I can tell you that as of today when changing a file it just works, the bug you mentioned seems to be fixed in the vanilla notepad setup!

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by shakthi nagaraj on 2017-01-19T10:25:55

$ tsd install jasmine --save

>> zero results

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Damir Arh on 2017-01-19T17:01:12

TSD has been deprecated for a while and replaced by Typings. As it seems, recently even the package acquisition doesn't work any more.

You can now call Typings instead of TSD to achieve the same result:


npm install -g typings
typings install dt~jasmine -SG

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Damir Arh on 2017-01-20T08:23:39

I've now updated the article by replacing all TSD references with Typings.

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Damir Arh on 2017-01-20T08:24:40

Indeed, the bug has been fixed. I've removed the mention while updating the article because of switching from TSD to Typings.

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Harie Chintalapati on 2017-04-20T19:33:51

very nice tutorial. I want to know if this include
Angular testing utilities as described in the https://angular.io/docs/ts/...

and another issue i faced is the index.d.ts in typings folder.
running the test only referring to node_modules/@types/core-js/index.d.ts instead of typings/index.d.ts that i manually created. is there any reason for that? also i am getting the below on running a test: 21 04 2017 10:36:37.619:ERROR [framework.browserify]: bundle error
21 04 2017 10:36:37.619:ERROR [framework.browserify]: TypeScript error: node_mod
ules/@types/core-js/index.d.ts(2107,43): Error TS2339: Property 'unscopables' do
es not exist on type 'SymbolConstructor'.

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Harie Chintalapati on 2017-04-24T18:46:44

https://angular.io/docs/ts/...
doesnt mention about browserify. looks like there are sample git projects that dont use broserify but still work. why are we using it here instead of the official setup? also is this setup support Angular Testing Utilities?

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Damir Arh on 2017-04-24T19:11:39

The Angular guide that you linked uses SystemJS in place of Browserify as the module loader. The blogpost you're probably asking about is in no way Angular specific, it can be used with any modularized JavaScript code, therefore I am not using any Angular tooling. I have not tried it, but Angular testing utilities (TestBed and others) should work with my setup as well, potentially with some additional Browserify configuration.

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Harie Chintalapati on 2017-05-11T14:06:45

thankyou for the reply, its a nice post. do you also have a tutorial for setting it up with webpack?

@damirarh
Copy link
Owner Author

damirarh commented Feb 5, 2023

Imported comment written by Damir Arh on 2017-05-11T19:15:34

No, I don't have one yet.

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

No branches or pull requests

1 participant