2.1 KiB
2.1 KiB
id | title | challengeType |
---|---|---|
587d7fb5367417b2b2512c02 | Use the Tilde-Character to Always Use the Latest Patch Version of a Dependency | 2 |
Description
~
) character. Here's an example of how to allow updates to any 1.3.x version.
"package": "~1.3.8"
Instructions
~
) character to prefix the version of moment in your dependencies, and allow npm to update it to any new PATCH release.
Note: The version numbers themselves should not be changed.
Tests
tests:
- text: '"dependencies" should include "moment"'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, ''moment'', ''"dependencies" does not include "moment"''); }, xhr => { throw new Error(xhr.responseText); })'
- text: '"moment" version should match "~2.10.2"'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert.match(packJson.dependencies.moment, /^\~2\.10\.2/, ''Wrong version of "moment". It should be ~2.10.2''); }, xhr => { throw new Error(xhr.responseText); })'
Challenge Seed
Solution
// solution required