-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix yarn package name parsing to account for beginning '@' - Add tests to test package name parsing function - Add tests to CI and Deploy workflows
- Loading branch information
1 parent
3ec7c8e
commit 6bf6231
Showing
8 changed files
with
59 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Invoke-Pester -Path (Join-Path $PSScriptRoot "..\..\tests") -Verbose |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
obj/* | ||
output/* | ||
yarn.crescendo/* | ||
sample/node_modules/* | ||
**/node_modules/* |
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,8 @@ | ||
|
||
function Find-PackageNameWithoutVersion($name) { | ||
$idx = $name.LastIndexOf('@') | ||
if ($idx -gt 0) { | ||
$name = $name.Substring(0, $idx) | ||
} | ||
$name | ||
} |
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,38 @@ | ||
#Import-Module "$PSScriptRoot\..\yarn-crescendo\yarn.crescendo.psd1" -Force | ||
BeforeAll { | ||
. "$PSScriptRoot\..\src\Helpers\Find-PackageNameWithoutVersion.ps1" | ||
} | ||
|
||
Describe "Find-PackageNameWithoutVersion" { | ||
It "should return same string with -" { | ||
Find-PackageNameWithoutVersion "some-package" | Should -Be "some-package" | ||
} | ||
|
||
It "should return same string with ." { | ||
Find-PackageNameWithoutVersion "example.com" | Should -Be "example.com" | ||
} | ||
|
||
It "should return same string with _" { | ||
Find-PackageNameWithoutVersion "under_score" | Should -Be "under_score" | ||
} | ||
|
||
It "should return same string starting with numbers" { | ||
Find-PackageNameWithoutVersion "123numeric" | Should -Be "123numeric" | ||
} | ||
|
||
It "should return same string starting @" { | ||
Find-PackageNameWithoutVersion "@npm/thingy" | Should -Be "@npm/thingy" | ||
} | ||
|
||
It "should strip number" { | ||
Find-PackageNameWithoutVersion "[email protected]" | Should -Be "thingy" | ||
} | ||
|
||
It "should strip number with ^" { | ||
Find-PackageNameWithoutVersion "thingy@^1.2.3" | Should -Be "thingy" | ||
} | ||
|
||
It "should strip number" { | ||
Find-PackageNameWithoutVersion "@npm/[email protected]" | Should -Be "@npm/thingy" | ||
} | ||
} |