Skip to content

Commit

Permalink
Upgrade NUglify 1.6.4 and add SupportNewSyntax() test case. (#501)
Browse files Browse the repository at this point in the history
Co-authored-by: johnny <johnny@wantgoo.com>
  • Loading branch information
supershowwei and johnny-wantgoo committed Jul 7, 2020
1 parent d8c2ca6 commit 8b1de34
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/BundlerMinifier.Core/BundlerMinifier.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUglify" Version="1.5.14" />
<PackageReference Include="NUglify" Version="1.6.4" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/BundlerMinifier/BundlerMinifier.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<PackageReference Include="Microsoft.Build.Framework" Version="15.1.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.1.0-*" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" PrivateAssets="All" />
<PackageReference Include="NUglify" Version="1.5.14" PrivateAssets="All" />
<PackageReference Include="NUglify" Version="1.6.4" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
Expand Down
11 changes: 11 additions & 0 deletions src/BundlerMinifierTest/BundlerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void Cleanup()
File.Delete("../../../artifacts/file3.min.js");
File.Delete("../../../artifacts/file4.min.html");
File.Delete("../../../artifacts/test7.min.js");
File.Delete("../../../artifacts/test8.min.js");
}

[TestMethod]
Expand Down Expand Up @@ -200,5 +201,15 @@ public void PreventDoubleProcessing()
var secondFileTime = File.GetLastWriteTimeUtc(filePath);
Assert.AreEqual(firstFileTime, secondFileTime);
}

[TestMethod]
public void SupportNewSyntax()
{
_processor.Process(TEST_BUNDLE.Replace("test1", "test8"));

string jsResult = File.ReadAllText("../../../artifacts/test8.min.js");

Assert.AreEqual("function test(n){for(const t of n)console.log(t)}test([1,2,3,4]);", jsResult);
}
}
}
6 changes: 6 additions & 0 deletions src/BundlerMinifierTest/artifacts/file4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function test(arr) {
for (const abc of arr) {
console.log(abc);
}
}
test([1, 2, 3, 4]);
8 changes: 8 additions & 0 deletions src/BundlerMinifierTest/artifacts/test8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"outputFileName": "test8.min.js",
"inputFiles": [
"file4.js"
]
}
]
4 changes: 2 additions & 2 deletions src/BundlerMinifierVsix/BundlerMinifierVsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@
<HintPath>..\..\packages\NuGet.VisualStudio.3.5.0\lib\net45\NuGet.VisualStudio.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="NUglify, Version=1.5.14.0, Culture=neutral, PublicKeyToken=15bc7810aec21b5e, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUglify.1.5.14\lib\net40\NUglify.dll</HintPath>
<Reference Include="NUglify, Version=1.6.4.0, Culture=neutral, PublicKeyToken=15bc7810aec21b5e, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUglify.1.6.4\lib\net40\NUglify.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand Down
2 changes: 1 addition & 1 deletion src/BundlerMinifierVsix/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
<package id="NuGet.VisualStudio" version="3.5.0" targetFramework="net46" />
<package id="NUglify" version="1.5.14" targetFramework="net46" />
<package id="NUglify" version="1.6.4" targetFramework="net46" />
</packages>

0 comments on commit 8b1de34

Please sign in to comment.