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

Testing: Explanation of runTests() #162

Open
robmuh opened this Issue Jan 29, 2019 · 3 comments

Comments

3 participants
@robmuh
Copy link
Contributor

robmuh commented Jan 29, 2019

I'm guessing there is a reason none of the test examples include the runTests() call. I inferred from reading main.ts that there is some plan to automatically call that from deno eventually.

May I suggest, at least temporarily, that some clarification be made to the main testing/README.md that includes this runTests() call? I have forked deno_std and am prepared to attempt a documentation update to describe that potentially saving other newbies to the project from searching for (don't take offense) how to get this damn test to actually run. 😁 deno test.js happily returns nothing without the runTests() call, of course. It's just not completely obvious to absolute beginners to add that.


By the way, "Hello!" I'm brand new to the project but have read through all the code for the deno_std libraries and have been using Deno (over Node) to teach command line coding and porting my own stuff. (I'm not gonna lie. I absolutely despise npm, package.json, and node_modules.) I cannot say how much I agree with every point @ry makes. I'm a pretty good writer and coder and have been programming since server-side JavaScript from Netscape was a thing.

Also I know this project is new. But I have been having tremendous success with GitLab, which has subgroups (organizations), built-in devops, and automated mirroring to or from any Git repo (for GitHub mirroring). I am preparing a 30 point comparison that will publish soon for evaluation. I can already see several places where this project would strongly benefit and since it is still young I thought at least I could mention it.

I apologize for this informal content in an issue. I see there is a ticket for IRC (or Discord or whatever) and noticed the first newsletter came out. Happy to help where I can (outside of the 60 hours a week I am teaching and creating curriculum).

@ry

This comment has been minimized.

Copy link
Contributor

ry commented Jan 29, 2019

Thanks for reporting this - the runTests behavior has just recently changed - hence the inconstant docs. Although we liked the ability to run any test file easily - we found that there were situations where we needed more control starting the test runner. The design of the testing library is to be very minimal and very explicit (hence needing to explicitly import the "test" function).

We plan to have a one line boilerplate that people can add to test files so they can be run as main scripts: #152
However we don't currently have the ability to do something like

 if (require.main === module) {
  runTests();
}

We want to do this using import.meta.url ... which is part of my ongoing native ES module work.

Soo.... happy if to have PRs that fix up the docs in the meantime, but I expect to have a better story for running tests in a week or two. : )

(And - welcome!)

@robmuh

This comment has been minimized.

Copy link
Contributor Author

robmuh commented Jan 29, 2019

Thanks for the quick response. I will just add a blockquote container marked temporary and will happily remove after the changes. Should have that tonight. Nothing huge.

@hayd

This comment has been minimized.

Copy link
Contributor

hayd commented Feb 2, 2019

Another point is import() doesn't work at the moment, once we have that testing/main.ts can be more useful (eg Run tests for all test files in a directory).

@ry ry added the testing label Feb 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment