MithrilJS / docs

Source code for Mithril's documentation site
https://mithril.js.org
MIT License
1 stars 4 forks source link

Testing Tutorial #16

Open JhonSmithRomeroSolorzano opened 3 years ago

JhonSmithRomeroSolorzano commented 3 years ago

Hi every body.

I'm doing the testing tutorial, wich is in https://mithril.js.org/testing.html

I did each step exactly as suggested, with the suggested file structure, but I'm geeting this result.

Result

There is no error but the component was not tested either.

Code

component-test component setup pakage

I want to know what I am skipping, or what step does not have the tutorial that I am skipping. I really appreciate the help you can give me since I have to start testing my application.

osban commented 3 years ago

@JhonSmithRomeroSolorzano I can confirm it doesn't work out of the box. I don't have the time today to figure out why not, but maybe someone else can. I think that out.should.contain("day") doesn't work anymore (it should be something like o(testvalue).equals('expected value') now), but that's not the reason it doesn't work.

mchampaneri commented 3 years ago

I'm facing same.

barneycarroll commented 3 years ago

I'm seeing the same stuff, and I can't figure out why. Worth enumerating the other problems with the test documentation:

  1. It doesn't install Mithril
  2. It doesn't bind the Mithril module to global in test-setup.js
  3. It's confused about whether it's using ospec or mocha - step 1 says to add "test": "mocha" to your scripts but then immediately tells you to use ospec instead; later the test file uses ospec test specifications but mocha assertions.

I've tried variations of the command line and nothing seems to work for this setup. Strange!

mytskine commented 3 years ago

I also struggled with the Mithril documentation for testing. Then I did set up a testing environment for a JS application, using Webpack and Mocha. So I took some time to write a tutorial and a sample application: https://gitlab.com/Mytskine/mithril-real-world. Mocha tests are run locally and with Gitlab-CI. Hope that helps.