WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 8 months ago

Last modified 8 months ago

#24870 closed enhancement (duplicate)

Add JavaScript unit tests to core

Reported by: adamsilverstein Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.2
Component: Unit Tests Keywords: needs-unit-tests
Focuses: Cc:

Description

With more JavaScript entering core (like the new revisions screen), it would be great to build some JavaScript unit tests. I am opening this ticket to stimulate some discussion! I'm new to JavaScript unit testing, so could use some help from those with more experience.

There are many javascript unit testing frameworks: Qunit and Jasmine seem like likely candidates. Those who have experience with JavaScript unit test - please offer direction!

So far, I set up Jasmine.js and phantomjs (headless javascript engine), which seemed relatively painless. I'm going to work on writing some actual tests next, starting with revisions. Once I have something useful, I will post the results here.

Change History (13)

comment:1 follow-up: brianhogg9 months ago

Adding a quick comment so I can get notified of the discussion. Have done some unit testing with Backbone.js/Underscore.js/Jasmine-jquery in the past, so will help where I can! Was also working great as a javascript-based TDD tool.

comment:2 carldanley9 months ago

  • Cc carldanley@… added

comment:3 kadamwhite9 months ago

  • Cc kadamwhite added

comment:4 in reply to: ↑ 1 DrewAPicture9 months ago

Replying to brianhogg:

Adding a quick comment so I can get notified of the discussion.

If you want to receive updates for a particular ticket, you can just select the 'Add to Cc' checkbox under the ticket description ;)

comment:5 brianhogg9 months ago

Thanks - definitely didn't see that way down under modify ticket :)

comment:6 kadamwhite9 months ago

I would love to help with this! Long-overdue, in my opinion.

comment:7 CrazyJaco9 months ago

  • Cc CrazyJaco added

comment:8 adamsilverstein8 months ago

note: this was discussed in the JavaScript dev chat in IRC, and work has started on this in #25088; once we have a foundation and sample test we can start building out more tests.

comment:10 WraithKenny8 months ago

  • Cc Ken@… added

comment:11 buffler8 months ago

  • Cc jeremy.buller@… added

comment:12 nacin8 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #25096.

comment:13 nacin8 months ago

Oops, actually a duplicate of #25088.

Note: See TracTickets for help on using tickets.