raulvillares / 3sacrowd

Tic-Tac-Toe puzzle using plain javascript :video_game:

Home Page:https://raulvillares.github.io/3sacrowd/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add tests

raulvillares opened this issue · comments

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

I'd like to help with this!

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!

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

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

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

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

Go ahead @rohanraj7316 . Thanks!

Hi @raulvillares,
Is this enhancement still open ?

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.

@raulvillares
can you brief me on progressive testing?

@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:

#20 (comment)

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!

@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 ???

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. :)

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.

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!

commented

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

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

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

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');

  1. 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

Merged.

Great job @EmOnTheWeb !

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

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.

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

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

Thanks! Will do!

Hi,

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

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