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

Using ApprovalTests in a typescript test file ! #78

Open
mike03081972 opened this issue Apr 25, 2018 · 12 comments
Open

Using ApprovalTests in a typescript test file ! #78

mike03081972 opened this issue Apr 25, 2018 · 12 comments

Comments

@mike03081972
Copy link

Is it possible to publish also the declaration file for module 'approvals' (.d.ts)

=> npm install @types/approvals`
=> yarn add @types/approvals

@staxmanade
Copy link
Member

Happy to help maintain a .d.ts - mind sending a PR with how this is configured within a typical repo?

@mike03081972
Copy link
Author

mike03081972 commented May 8, 2018 via email

@mike03081972
Copy link
Author

approval-ts-test.zip

Hi,

You will find attached an example project that works under typescript.
The .d.ts files is located in the folder typings

Best regards

@labsvisual
Copy link

@staxmanade wouldn't mind contributing to the repository with typings and their documentation. 😄

@staxmanade
Copy link
Member

@labsvisual Please do - would love some pull requests and help...

@labsvisual
Copy link

@staxmanade on it!

@DanKaplanSES
Copy link

Would it be an option to change the project to a typescript project? I'd be interested in submitting a PR for that. It would still work for JS users.

@staxmanade
Copy link
Member

@DanKaplanSES I would be open to this. @isidore and I have had a few weekend pairing sessions over the summer - perhaps something we could all jump into in the coming months and work on together.

@DanKaplanSES
Copy link

I'm down. Let me know.

@claremacrae
Copy link
Contributor

Hi Jason!

I'm helping someone in the Obsidian plugin community to start writing approval tests for some typescript-based code...

I've pointed them at this issue, to see if the attachments help... Will report here how we get on...

@SkepticMystic
Copy link

SkepticMystic commented Nov 22, 2021

Thanks Clare :)
@mike03081972 I managed to get your example project working.
However, the issue I had before is that I cannot import functions from other files in the project into the test.specs.ts file. If I want to test myFunc from utils.ts, for example, I add import {myFunc} from '../src/utils', but I get the following error:
image

It feels like there should be a way around this. Surely I should be able to import functions into the test file.

EDIT: I can import local functions from other files.
The issue seems to arise from using 3rd-party libs in those other files

@claremacrae
Copy link
Contributor

EDIT: I can import local functions from other files. The issue seems to arise from using 3rd-party libs in those other files

I wonder whether it's worth starting from the other end, from the starter project - which does already import a source file from another location... And seeing if you can add to that the use of a 3rd-party lib.

https://github.com/approvals/ApprovalTests.js.StarterProject

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

6 participants