Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years 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:


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)

#1 follow-up: @brianhogg
2 years 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.

#2 @carldanley
2 years ago

  • Cc carldanley@… added

#3 @kadamwhite
2 years ago

  • Cc kadamwhite added

#4 in reply to: ↑ 1 @DrewAPicture
2 years 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 ;)

#5 @brianhogg
2 years ago

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

#6 @kadamwhite
2 years ago

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

#7 @CrazyJaco
2 years ago

  • Cc CrazyJaco added

#8 @adamsilverstein
2 years 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.

#10 @WraithKenny
2 years ago

  • Cc Ken@… added

#11 @buffler
2 years ago

  • Cc jeremy.buller@… added

#12 @nacin
2 years ago

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

Duplicate of #25096.

#13 @nacin
2 years ago

Oops, actually a duplicate of #25088.

Note: See TracTickets for help on using tickets.