Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
ember-mockdate-shim
Advanced tools
ES6 accessible module for MockDate within your Ember application
ES6 accessible module for MockDate within your Ember applications.
ember install ember-mockdate-shim
MockDate's set
and reset
methods are renamed to freezeDateAt
and unfreezeDate
respectively.
import { freezeDateAt, unfreezeDate } from 'ember-mockdate-shim';
freezeDateAt(new Date('1/12/2017'));
unfreezeDate();
This is primarily useful for keeping the time data consistent between tests (ie: for visual diffs a la Percy). Any library methods that rely on new Date()
will return consistent outputs. For example: moment()
and faker.date.recent
You can use this in the beforeEach
and afterEach
hooks of your tests, or anywhere else you want to freeze the date at, how ever many times you want!
Please note that acceptance test support is only available in Ember >2.15.1 as that is when backburner.js
introduced the ability to make "now" configurable. More info here.
For use cases outside of tests, keep in mind that the shim is not included in production builds. See index.js for more info.
ember serve
yarn test
(Runs ember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit https://ember-cli.com/.
FAQs
ES6 accessible module for MockDate within your Ember application
We found that ember-mockdate-shim demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.