-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from tschoartschi/master
Check tar.gz urls if they are specified in _from in package.json
- Loading branch information
Showing
9 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const regex = /((\.tar(\.gz)?)|(\.tgz))$/; | ||
|
||
module.exports = function isTarGz(str) { | ||
return regex.test(str); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = '__UNKNOWN_VERSION__'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/fixtures/project-npm-tar-gz-check/node_modules/example-tar-gz/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
tests/fixtures/project-yarn-tar-gz-check/node_modules/example-tar-gz/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var assert = require('chai').assert; | ||
var isTarGz = require('../../lib/utils/is-tar-gz'); | ||
|
||
describe('IsTarGz', function () { | ||
describe('recognizes tar ball', function () { | ||
|
||
it('when url ends with .tar', function () { | ||
var url = 'http://ember-cli.com/example-2.0.0.tar'; | ||
assert.ok(isTarGz(url)); | ||
}); | ||
|
||
it('when url ends with .tar.gz', function () { | ||
var url = 'http://ember-cli.com/example-2.0.0.tar.gz'; | ||
assert.ok(isTarGz(url)); | ||
}); | ||
|
||
it('when url ends with .tgz', function () { | ||
var url = 'http://ember-cli.com/example-2.0.0.tgz'; | ||
assert.ok(isTarGz(url)); | ||
}); | ||
}); | ||
|
||
describe('recognizes that url is not a tar ball', function () { | ||
it('when url contains .tar somewhere', function () { | ||
var url = 'http://ember-cli.com/example-2.0.0.tar.zip'; | ||
assert.notOk(isTarGz(url)); | ||
}); | ||
|
||
it('when url contains .tar.gz somewhere', function () { | ||
var url = 'http://ember-cli.com/example-2.0.0.tar.gz.zip'; | ||
assert.notOk(isTarGz(url)); | ||
}); | ||
|
||
it('when url contains .tgz somewhere', function () { | ||
var url = 'http://ember-cli.com/example-2.0.0.tgz.zip'; | ||
assert.notOk(isTarGz(url)); | ||
}); | ||
|
||
it('when url contains no .tar, .tar.gz or .tgz', function () { | ||
var url = 'http://ember-cli.com/example-2.0.0.zip'; | ||
assert.notOk(isTarGz(url)); | ||
}); | ||
}); | ||
|
||
}); |