• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

How to unit test plugins during developoment?

Scheduled Pinned Locked Moved NodeBB Development
5 Posts 4 Posters 1.5k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • asamolionA Offline
    asamolionA Offline
    asamolion Gamers
    wrote on last edited by
    #1

    If I'm developing a plugin for NodeBB, what is the recommended way to write unit tests for the plugin?

    Has anyone done this who would like to share his workflow?

    1 Reply Last reply
    1
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #2

    Do you mean you want to do integration testing? Running your plugin in a live NobeBB?

    Unit tests would use a mocks (fake functions that always return expected results) to call nodebb and db methods.

    asamolionA 1 Reply Last reply
    0
  • ShardS Offline
    ShardS Offline
    Shard
    wrote on last edited by
    #3

    I've had similar issues trying to meet things up with the style guide.

    1 Reply Last reply
    0
  • asamolionA Offline
    asamolionA Offline
    asamolion Gamers
    replied to yariplus on last edited by
    #4

    @yariplus Yes, integration testing especially. Is there any resource on how to do it with NodeBB and its plugins?

    1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    wrote on last edited by
    #5

    Not particularly... there's no exposure to the testing suite via plugins.

    If you want to test the plugin via eslint, you can run it locally: ./node_modules/.bin/eslint .

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development