Skip to content

Commit 0595e01

Browse files
committed
Add unit tests.
1 parent f7b2c14 commit 0595e01

File tree

9 files changed

+12437
-5
lines changed

9 files changed

+12437
-5
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 32 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/config/rush/repo-state.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "bbb9bf8633540946746fc860eba5af3bef09bf3d",
3+
"pnpmShrinkwrapHash": "9ae2383362eac1112df5f8dee8e2c1f08bb6dfbf",
44
"preferredVersionsHash": "40d4640a94cff77f7808a2f1960cc76231eb6f86"
55
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "local-node-rig/profiles/default/config/jest.config.json"
3+
}

webpack/set-webpack-public-path-plugin/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"devDependencies": {
3131
"@rushstack/heft": "workspace:*",
3232
"local-node-rig": "workspace:*",
33-
"webpack": "~5.82.1"
33+
"webpack": "~5.82.1",
34+
"memfs": "3.4.3"
3435
}
3536
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
import { SetPublicPathCurrentScriptPlugin } from '../SetPublicPathCurrentScriptPlugin';
5+
import { testForPlugin } from './testBase';
6+
7+
testForPlugin(SetPublicPathCurrentScriptPlugin.name, () => new SetPublicPathCurrentScriptPlugin());
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
import { SetPublicPathPlugin, type ISetWebpackPublicPathPluginOptions } from '../SetPublicPathPlugin';
5+
import { testForPlugin } from './testBase';
6+
7+
const options: ISetWebpackPublicPathPluginOptions[] = [
8+
{ scriptName: { useAssetName: true } },
9+
{
10+
scriptName: {
11+
name: 'foobar.js'
12+
}
13+
},
14+
{
15+
scriptName: {
16+
name: '[name]_[hash].js',
17+
isTokenized: true
18+
}
19+
},
20+
{
21+
scriptName: { useAssetName: true },
22+
regexVariable: 'REGEXP_VAR'
23+
}
24+
];
25+
for (const pluginOptions of options) {
26+
testForPlugin(
27+
`${SetPublicPathPlugin.name} (with ${JSON.stringify(pluginOptions)}})`,
28+
() =>
29+
new SetPublicPathPlugin({
30+
scriptName: {
31+
useAssetName: true
32+
}
33+
})
34+
);
35+
}

0 commit comments

Comments
 (0)