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

New No-Code Track! 🚀start learning today!

🌟 Dreaming of a bright future? 🎓 Ask about the Treehouse Scholarship program! 🚀

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

  • Treehouse Logo
  • Plans
    Chevron
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
  • Library
    Chevron
    • All Courses
    • Tracks
    • College Credit
  • Techdegree
    Chevron
    • Overview
    • Front End Development
    • Full Stack JavaScript
    • Data Analysis
    • UX Design
    • Python
  • Community
    Chevron
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
  • Resources
    Chevron
    • Career Toolbox
    • CodeForward
    • Free Treehouse Near Me
    • Jobs
    • Blog
    • Support
    • About
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks College Credit
  • Overview Front End Web Development Full Stack JavaScript Python Development Data Analysis UX Design
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Career Toolbox CodeForward Free Treehouse Near Me Jobs Blog Support About
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • Android
      • • 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
    • Showing results for:
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error
    • Close
  • 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 on Dec 23, 2020 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 on Jul 15, 2020 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 on Jul 14, 2019 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 on May 21, 2019 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 on Dec 31, 2018 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 on Dec 3, 2018 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 on Oct 17, 2018 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 on Aug 31, 2018 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 on Aug 22, 2018 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 on May 30, 2018 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 on Mar 18, 2018 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 on Sep 29, 2017 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 on Apr 1, 2017 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 on Mar 3, 2017 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 on Feb 26, 2017 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 on Feb 21, 2017 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 on Dec 10, 2016 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 on Jul 19, 2016 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 on May 31, 2016 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 on May 13, 2016 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 on May 10, 2016 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.

    Treehouse

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

See Full Catalogue

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
  • Python Development
  • Data Analysis
  • UX Design

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
  • ...see more

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
  • ...see more

Explore

  • Plans
  • Affiliates
  • Perks
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
Terms & Conditions | Privacy

© 2025 Treehouse Island, Inc.