Jasmine JavaScript Testing Framework Cheat Sheet 2026
The 30 highest-yield Jasmine JavaScript Testing Framework facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
- Jasmine initially came out in → 2010
- Aside from those listed below, Jasmine is influenced by → Npm
- The Jasmine framework includes a feature called ___ that lets you spy on a particular line of code. → SpyOn()
- Which matcher verifies that a number is close to an expected value within a decimal precision? → toBeCloseTo(num, decimalPlaces)
- Which Jasmine function is used to specify a test suite? → `describe()`
- As a testing framework, Jasmine is → Open Source
- Which Jasmine matcher checks that a value is not undefined? → toBeDefined()
- Can Jasmine describe blocks be nested inside each other? → Yes, to any depth
- What is the purpose of jasmine.nothing() used as an asymmetric matcher? → Asserts that a spy was called with no arguments or matches any call with no arguments
- Which reporter interface method does Jasmine call when a spec begins executing? → specStarted(result)
- What does jasmine.clock().mockDate(new Date('2025-01-01')) do? → Sets the mocked current date to January 1, 2025
- Which Jasmine function is used to indicate that a test specification is pending? → pending()
- What is a "fixture" in Jasmine? → A sample input used for testing
- What file is typically used to configure Jasmine in a Node.js project? → spec/support/jasmine.json
- What is the purpose of jasmine.getEnv().clearReporters()? → Removes all currently registered reporters from the environment
- How do you configure a Jasmine spy to invoke the original implementation? → .and.callThrough()
- What had been created before Jasmine was created? → JSunit
- What is the effect of having a focused spec (fit) or suite (fdescribe) in a Jasmine test file? → Only focused specs and suites run; all others are skipped
- Which function inside an it() block marks that spec as pending in Jasmine? → pending()
- Which of the following is a Jasmine.js substitute? → All of the above
- What does the stopSpecOnExpectationFailure option do in Jasmine? → Stops the current spec after the first failed expectation
- How do you disable an entire describe suite without deleting it? → xdescribe()
- How do you use async/await syntax in a Jasmine it() block? → Declare the function as async and use await inside
- How should the message property be structured in a custom matcher result object to provide context-sensitive failure output? → As a function that returns a string, so Jasmine evaluates it only when needed
- Which jasmine.json option stops Jasmine from running further specs after a set number of failures? → failFast: true
- What does the compare function inside a custom matcher need to return? → An object with a pass property (boolean) and optionally a message
- What does jasmine.arrayContaining([3, 5]) verify about the actual array? → The actual array contains at least 3 and 5 (possibly more)
- What does jasmine.getEnv().allowRespy(true) enable? → Calling spyOn on a method that is already a spy
- Can afterEach() access variables that were modified inside the it() block that just ran? → Yes, because they share the describe block's closure scope
- What argument types does jasmine.stringMatching() accept? → A string or a RegExp
Turn these facts into recall: