Skip to main content

🚀 In our NEW AI Bootcamp you'll build a working app in 28 days, no experience required. Free to all subscription levels.

✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

Join the Treehouse affiliate program and earn 25% recurring commission! 🤑

  • Treehouse Logo
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
    • All Courses
    • Tracks
    • AI Bootcamp
    • College Credit
    • Techdegree Bootcamps
    • Front End Development
    • Full Stack JavaScript
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
    • Explore
    • Career Toolbox
    • Free Treehouse Near Me
    • Affiliates
    • Blog
    • Support
    • About
    • Learn
    • Beginner's Guide to Coding
    • Data Analysis with SQL & Python
    • Front-End Web Development
    • Python Programming Basics
    • Techdegree Bootcamp Overview
    • UX Design Fundamentals
    • AI Tools for Beginners
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks AI Bootcamp College Credit
  • Techdegree Bootcamps Front End Web Development Full Stack JavaScript
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Explore Career Toolbox Free Treehouse Near Me Affiliates Blog Support About
    Learn Beginner's Guide to Coding Data Analysis with SQL & Python Front-End Web Development Python Programming Basics Techdegree Bootcamp Overview UX Design Fundamentals AI Tools for Beginners
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
Loading banner... Start your free trial at Treehouse
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • APIs
      • • Coding for Kids
      • • College Credit
      • • Computer Science
      • • CSS
      • • Data Analysis
      • • Databases
      • • Design
      • • Development Tools
      • • Digital Literacy
      • • Game Development
      • • Go Language
      • • HTML
      • • Java
      • • JavaScript
      • • Learning Resources
      • • Machine Learning
      • • No-Code
      • • PHP
      • • Professional Growth
      • • Python
      • • Quality Assurance
      • • React
      • • Ruby
      • • Security
      • • Swift
      • • Vibe Coding
  • Deloris Luckett
    Deloris Luckett
    6,418 Points

    The subtraction function in subtraction.js throws an error if it's called with anything other than numbers. Write a spec

    Posted December 23, 2020 7:46pm by Deloris Luckett
    Deloris Luckett
    6,418 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Georg Ekeberg
    Georg Ekeberg
    5,702 Points

    Unable to find the right solution by testing for an error thrown

    Posted July 15, 2020 1:31pm by Georg Ekeberg
    Georg Ekeberg
    5,702 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Eden Gomez
    Eden Gomez
    22,787 Points

    Can somebody please give me a hint with what method should I use for this challenge?

    Posted July 14, 2019 5:23pm by Eden Gomez
    Eden Gomez
    22,787 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    0 Answers

  • Aaron Bell
    Aaron Bell
    6,113 Points

    How does this spec not check for subtraction's desired behavior?

    Posted May 21, 2019 4:44pm by Aaron Bell
    Aaron Bell
    6,113 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    5 Answers

  • Roland Abregorivas
    Roland Abregorivas
    16,784 Points

    Dont understand the question regarding subtraction Spec. Can someone explain what they are looking for.

    Posted December 31, 2018 12:21am by Roland Abregorivas
    Roland Abregorivas
    16,784 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    0 Answers

  • liamthornback2
    liamthornback2
    9,618 Points

    "Bummer: We tried your spec with a version of subtraction.js that DOESN'T work correctly, expecting the test to fail..."

    Posted December 3, 2018 4:56pm by liamthornback2
    liamthornback2
    9,618 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    2 Answers

  • Ivan Sardelić
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    Ivan Sardelić
    Full Stack JavaScript Techdegree Graduate 18,248 Points

    I don't see what I'm missing here :/

    Posted October 17, 2018 3:28pm by Ivan Sardelić
    .a{fill-rule:evenodd;}techdegree seal-36
    Ivan Sardelić
    Full Stack JavaScript Techdegree Graduate 18,248 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Vitaly Kashubin
    Vitaly Kashubin
    8,449 Points

    Can't find a fault! Could you please help me?

    Posted August 31, 2018 3:19pm by Vitaly Kashubin
    Vitaly Kashubin
    8,449 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Kaitlyn Dodds
    Kaitlyn Dodds
    32,545 Points

    Can't figure out why my solution doesn't pass.

    Posted August 22, 2018 7:55pm by Kaitlyn Dodds
    Kaitlyn Dodds
    32,545 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    3 Answers

  • Alex Rogers
    Alex Rogers
    9,844 Points

    Yet another chai docs question (throwing an error)

    Posted May 30, 2018 3:48pm by Alex Rogers
    Alex Rogers
    9,844 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    0 Answers

  • Mohammed Ali
    Mohammed Ali
    10,625 Points

    Struggling with Javascript Unit Testing 'Code Challenge: Catching an Error'

    Posted March 18, 2018 1:07pm by Mohammed Ali
    Mohammed Ali
    10,625 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    3 Answers

  • nico dev
    nico dev
    20,364 Points

    Why is a callback and a variable assignment needed here, instead of testing the function straightaway?

    Posted September 29, 2017 5:25am by nico dev
    nico dev
    20,364 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Santiago Cabrera
    Santiago Cabrera
    11,087 Points

    Don't understand why it doesn't work

    Posted April 1, 2017 5:07am by Santiago Cabrera
    Santiago Cabrera
    11,087 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Harold Stewart
    Harold Stewart
    9,322 Points

    Javascript unit testing challenge

    Posted March 3, 2017 5:59pm by Harold Stewart
    Harold Stewart
    9,322 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    2 Answers

  • adammccann
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    adammccann
    Python Web Development Techdegree Student 12,554 Points

    expect(subtraction("a","b")).to.throw('subtraction only works with numbers!') How could this not work?

    Posted February 26, 2017 5:20am by adammccann
    .a{fill-rule:evenodd;}techdegree
    adammccann
    Python Web Development Techdegree Student 12,554 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Christopher Lebbano
    Christopher Lebbano
    15,338 Points

    Test spec, not sure why this isn't working

    Posted February 21, 2017 6:41pm by Christopher Lebbano
    Christopher Lebbano
    15,338 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Ioannis Leontiadis
    Ioannis Leontiadis
    9,828 Points

    Catching an Error?

    Posted December 10, 2016 10:23pm by Ioannis Leontiadis
    Ioannis Leontiadis
    9,828 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Fábio Nascimento
    Fábio Nascimento
    10,418 Points

    What is wrong with my code?

    Posted July 19, 2016 12:57pm by Fábio Nascimento
    Fábio Nascimento
    10,418 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Alejandro Molina
    Alejandro Molina
    3,997 Points

    Stuck on code challenge

    Posted May 31, 2016 9:48pm by Alejandro Molina
    Alejandro Molina
    3,997 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Faddah Wolf
    Faddah Wolf
    12,811 Points

    put in correct answer, works in my code editor, does not work in test for JavaScript Unit Testing

    Posted May 13, 2016 6:27am by Faddah Wolf
    Faddah Wolf
    12,811 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Nikola Brežnjak
    Nikola Brežnjak
    10,897 Points

    The subtraction function in subtraction.js throws an error if it's called with anything other than numbers.

    Posted May 10, 2016 6:40am by Nikola Brežnjak
    Nikola Brežnjak
    10,897 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    3 Answers

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
SEE ALL

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
SEE ALL

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
SEE ALL

About Us

  • About
  • Blog
  • Community
  • Stories
  • Contact
  • Gift Card

Explore

  • Plans
  • Affiliates
  • Perks
  • Shop
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses

Treehouse is an online technology education platform founded in 2011. Treehouse offers more than 700 self-paced, video-based courses in web development, programming, data analysis, design, and AI, plus two project-based bootcamp programs in Front End Web Development and Full Stack JavaScript. Individual Treehouse plans start at $25 per month and include a 7-day free trial. Treehouse serves individual learners, businesses, schools, and public libraries. Cardholders at participating U.S. public libraries can use Treehouse for free. Select Treehouse courses, offered with University Pathways International, are recommended for college credit by ACE and NCCRS. Treehouse learners earn digital certificates for completed Tracks.

Terms & Conditions · Privacy · © 2026 Treehouse Island, Inc.
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
  • Discord