Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Add tests #25

Open
lsjroberts opened this issue Oct 18, 2017 · 11 comments
Open

Add tests #25

lsjroberts opened this issue Oct 18, 2017 · 11 comments

Comments

@lsjroberts
Copy link
Contributor

I am about to start writing some tests so we can make sure new pull requests aren't breaking existing feature.

The policy is no external libraries, but this is kind of a must for testing. Is that ok?

I would like to go with Jest as it does not require any configuration and has a very nice UX.

It does require node to run, but that's a pretty common thing for javascript developers so hopefully a minor hurdle. It is also making progress towards being able to run the tests in the browser so that'll make it even easier.

Developers will still need to install jest though through npm with npm install -g jest.

It'll integrate with Travis CI which can run on each PR so devs don't necessarily have to run it locally before creating a PR. Particularly useful for first time contributors.

Thoughts?

@neauoire
Copy link
Contributor

Is it possible to have a wrapper that could exist side-by-side to the repos and still handle the tests? As much as it is feasible, I would really like it if the repos(client/portal) never included any code that wasn't of our own typing.

@lsjroberts
Copy link
Contributor Author

If you install jest globally with that npm install -g jest command, there'll be nothing in this repo except our own code. The tests will be here and we'll need a note in the readme saying how to run them, but there'll be no package.json or node_modules or anything like you would get in a normal npm project.

@neauoire
Copy link
Contributor

In that case, I'm up for it :)

@saulhardman
Copy link
Contributor

Would you mind explaining your reasoning here @neauoire? When you say "any code that wasn't of our own typing", do you mean code being 'distributed' or 'deployed' to the client/portal sites via Dat? Or do you mean any code in the site folders? The usual way that third-party development dependencies are handled in JavaScript-land is that a package.json file keeps track of those devDependencies and contributors can then install using the npm install command. These dependencies will be installed into a node_modules directory in the root of the projects and then ignored by Git and Dat to ensure that they're never distributed or tracked.

I don't mean to sound critical (or patronising), it's a worthy goal, but I'm just wondering if in the context of development and testing tools it's somewhat misplaced.

The method that @lsjroberts has described circumvents the need to declare or install dependencies within the project folders, but with that we miss out on valuable features like version tracking. What if some tests fail with older versions of the testing tool (e.g. Jest) and so we're required to use the latest version. Rather than this information implicitly belonging in the repository it's instead documented elsewhere (if at all).

On the original topic:

👍 for Jest from me, though I also like AVA. Is it worth getting linting/formatting in place via ESLint and/or Prettier at this stage too? (A separate issue and PR perhaps?)

@lsjroberts
Copy link
Contributor Author

@saulhardman On prettier we did that on the old repo, worth doing on this one too. Separate PR is a good shout. Linting is probably not so necessary if we have prettier, but I'm not against it.

@lsjroberts
Copy link
Contributor Author

@neauoire Could you add me as a collaborator again on this and rotonde-portal if that's ok? I need those perms to be able to set up Travis CI.

@lsjroberts
Copy link
Contributor Author

Initial tests added in #32, more to come on the rest of the scripts.

@lsjroberts lsjroberts changed the title Test library? Add tests Oct 18, 2017
@saulhardman
Copy link
Contributor

@lsjroberts should the testing paraphernalia be added to .datignore so that they're not published?

@lsjroberts
Copy link
Contributor Author

@saulhardman Yes, I wasn't aware that was a thing. I'll do that now.

This was referenced Oct 18, 2017
@lsjroberts
Copy link
Contributor Author

@neauoire Could you add me as a collaborator again on this and rotonde-portal if that's ok? I need those perms to be able to set up Travis CI.

Never mind on that, looks like it just took a little while to find these repos. I'll set this up later today.

@lsjroberts
Copy link
Contributor Author

@neauoire Could you add me as a collaborator again on this and rotonde-portal if that's ok? I need those perms to be able to set up Travis CI.

Never mind on that, looks like it just took a little while to find these repos. I'll set this up later today.

Turns out actually I can't set it up, doh.

screen shot 2017-10-19 at 12 47 42

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants