raulvillares / 3sacrowd

Tic-Tac-Toe puzzle using plain javascript :video_game:
https://raulvillares.github.io/3sacrowd/index.html
35 stars 69 forks source link

Add tests #20

Open raulvillares opened 7 years ago

raulvillares commented 7 years ago

You can add the simpliest test you can think of. This should be progressive. There's no need to code a big suite of tests to commit at once.

I would like to use Tape. Read this article by js guru Eric Elliott:

https://medium.com/javascript-scene/why-i-use-tape-instead-of-mocha-so-should-you-6aa105d8eaf4

rnice01 commented 7 years ago

I'd like to help with this!

raulvillares commented 7 years ago

Thanks @rnice01 !

rnice01 commented 7 years ago

Hey @raulvillares, I'm having a difficult time trying to set up a testing environment with RequireJS. I tried using the RequireJS NPM package but still wasn't able to load in the different modules for testing. Have you set up a testing environment with RequireJS before and could you help me figure it out? Thanks!

raulvillares commented 7 years ago

Hi @rnice01

I'm new at testing with this environment, so don't worry too much about it. We're not in a hurry, this is meant to learn and to have fun. Thanks for your time spent!

I just pushed some dummy testing files. You need to install the Node adapter (npm install requirejs).

It seems to work fine for a js file with no extra requirejs dependencies (for example info.js). I have to figure out how to make it work with a js file with extra dependencies (for example levels.js). Maybe you can help me here.

More info:

https://stackoverflow.com/a/44406661 http://requirejs.org/docs/node.html#3

prabodhmeshram commented 6 years ago

Hi @raulvillares, Is this still open for contribution ? I would like to jump in if needed.

raulvillares commented 6 years ago

Sure! It would be great. I'm a little confused about js testing.

rohanraj7316 commented 6 years ago

@raulvillares is this still open i want to work on this ??

raulvillares commented 6 years ago

Go ahead @rohanraj7316 . Thanks!

reddysridhar53 commented 6 years ago

Hi @raulvillares, Is this enhancement still open ?

raulvillares commented 6 years ago

Hi @raulvillares, Is this enhancement still open ?

Thanks for your interest. @rohanraj7316 is working on it by the moment. I'll let you know if this changes.

reddysridhar53 commented 6 years ago

@raulvillares Thanks.

rohanraj7316 commented 6 years ago

@raulvillares
can you brief me on progressive testing?

raulvillares commented 6 years ago

@raulvillares can you brief me on progressive testing?

The first step would be get to test some code with require.js dependencias. As I commented weeks before, I wasn't able to achieve it:

https://github.com/raulvillares/3sacrowd/issues/20#issuecomment-310340813

nicktamburro commented 6 years ago

Are you still looking for some tests? I'm teaching myself test-driven dev and would love to play around a bit! I've been using Mocha, but would be great to learn tape!

rohanraj7316 commented 6 years ago

@nicktamburro writing test-case is not the issue how to integrate tape existing code is the main issue? do you have any idea regarding that ???

nicktamburro commented 6 years ago

I think so! I won't be able to take a look until late this evening (in California), but I'll play with it a little then!

On Sat, Mar 17, 2018 at 12:09 AM unio-7316 notifications@github.com wrote:

@nicktamburro https://github.com/nicktamburro writing test-case is not the issue how to integrate tape existing code is the main issue? do you have any idea regarding that ???

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raulvillares/3sacrowd/issues/20#issuecomment-373899944, or mute the thread https://github.com/notifications/unsubscribe-auth/AX6aIQHYbBGfVvf-yZN1YrfddrS1Amq_ks5tfLa5gaJpZM4N4eAZ .

-- Sent from my iPhone

kevinpeno commented 6 years ago

Just as a suggestion, it might be best if you (or another non-first timer) configure the tape module and tests first then ask first timers to write new test cases. Setting up a testing environment can be a bit daunting for a newcomer. Heck, understanding "unit" in "Unit tests" is difficult enough for a seasoned vet. :)

KatFrog commented 6 years ago

Hey, is this one still open? And is it possible for me to use Jasmine to set up the tests? I actually have some experience setting up test suites with Jasmine.

raulvillares commented 6 years ago

Hey, is this one still open? And is it possible for me to use Jasmine to set up the tests? I actually have some experience setting up test suites with Jasmine

Sure KatFrog, go for it. Thanks!

alzaar commented 5 years ago

Hi, is this still open? I would like to work on it.

raulvillares commented 5 years ago

Hi, is this still open? I would like to work on it.

Yes it is. Go for it @alzaar and thanks!

EmOnTheWeb commented 5 years ago

Managed to get Tape set up for files with dependancies too , here's what I did -

1) Install Tape npm install tape

2) Install your requirejs Node adapter so you can use the requirejs module loader with Node npm install requirejs

3) Get Node to support ES6 so it doesn’t choke on the key word import. To do that I followed this article https://khanghoang.github.io/me/javascript,/nodejs,/react/2016/07/22/set-up-babel-to-use-import-and-export.html

After installing babel-register and babel-preset-es2015 I added an entry file called entryFileTest.js that requires the other test files after babel-register

require(‘babel-register’); require(‘./levelsTest.js’); require('./infoTest.js');

4) The file paths have to be adjusted so that the node version of requirejs can fetch the files. I am not sure how this is working behind the scenes but in infoTest.js I changed

requirejs([“../require-config”, “../js/info”]

to

requirejs([“./require-config.js”, “./js/info.js”]

and made the same changes in levelsTest.js

and to get levels.js to include its dependencies, in this case properties.js , in levels.js I had to change the path from

js/properties to

./properties.js

crucially this does not break the import when we run the game in the browser so we could adjust all these paths in files with dependencies

Then to run the tests: node -r ./test/entryFileTest.js from the root

Now to actually write a test !

@raulvillares submitted PR for review

raulvillares commented 5 years ago

Merged.

Great job @EmOnTheWeb !

ghost commented 4 years ago

Still open ? is my first contribution and I think would be a great start.

titivermeesch commented 4 years ago

This issue is still open and will probably remain open. Have a look at the codebase and write some tests for it. Even just one simple test is ok, as said above no need for huge test cases but they are welcome.

williamw29 commented 2 years ago

Is this project still under development? Would like too see if I can help out at all.

titivermeesch commented 2 years ago

Is this project still under development? Would like too see if I can help out at all.

Yes it is. New features or tests are definitely welcome! If you have any questions, feel free to reach out

williamw29 commented 2 years ago

Thanks! Will do!

garykhong commented 2 years ago

Hi,

I would like to add a simple test to infoTest.js. How do I create the pull request?

titivermeesch commented 2 years ago

Hi,

I would like to add a simple test to infoTest.js. How do I create the pull request?

You should be able to create new pull requests from the PL tab on the project