Skip to content

Commit 88ad87f

Browse files
authored
test: add e2e build test (#97)
* test: add e2e build test * Update build.test.ts * tweak * refactor: mv folder
1 parent 029bb1b commit 88ad87f

18 files changed

Lines changed: 504 additions & 1 deletion

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ build
1010
# vitepress
1111
**/.vitepress/dist
1212
**/.vitepress/cache
13+
14+
# e2e
15+
packages/scaffold/test/e2e/fixtures/dist
16+
packages/scaffold/test/e2e/fixtures/.scaffold
17+
packages/scaffold/test/e2e/fixtures/typings
18+
packages/scaffold/test/e2e/fixtures/.gitignore
19+
!packages/scaffold/test/e2e/snap/dist

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"eslint-plugin-format": "^1.0.1",
2626
"husky": "^9.1.7",
2727
"lint-staged": "^15.4.3",
28+
"tsx": "^4.19.2",
2829
"typescript": "^5.7.3",
2930
"unbuild": "^3.3.1",
3031
"vitest": "^3.0.4"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { Build, Config } from "../../../src/index.js";
2+
3+
async function main() {
4+
const config = await Config.loadConfig({
5+
source: ["src", "static"],
6+
dist: `dist`,
7+
name: "Test Plugin",
8+
id: "test-plugin",
9+
namespace: "test-plugin",
10+
updateURL: `https://github.com/{{owner}}/{{repo}}/releases/download/releaser/{{updateJson}}`,
11+
xpiDownloadLink: "https://github.com/{{owner}}/{{repo}}/releases/download/v{{version}}/{{xpiName}}.xpi",
12+
13+
build: {
14+
assets: [
15+
"static/**/*.*",
16+
],
17+
define: {
18+
buildTime: "{{buildTime}}",
19+
},
20+
fluent: {
21+
ignore: ["lint-on-item-added11", "section-item"],
22+
},
23+
prefs: {
24+
prefix: "extensions.testplugin",
25+
},
26+
esbuildOptions: [],
27+
makeUpdateJson: {
28+
hash: false,
29+
updates: [
30+
{
31+
version: "0.4.5",
32+
update_link: "https://example.com/example.xpi",
33+
applications: {
34+
gecko: {
35+
strict_min_version: "60.0",
36+
},
37+
},
38+
},
39+
],
40+
},
41+
},
42+
43+
// If you need to see a more detailed build log, uncomment the following line:
44+
// logLevel: "trace",
45+
});
46+
47+
const build = new Build(config);
48+
await build.run();
49+
}
50+
51+
main();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "test-plugin",
3+
"type": "module",
4+
"version": "1.0.0",
5+
"private": "true",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/northword/zotero-plugin-scaffold.git"
9+
}
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
meaasge-1 = General Settings
2+
meaasge-2-message-1 =
3+
.label = example
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"manifest_version": 2,
3+
"applications": {
4+
"zotero": {
5+
"strict_min_version": "6.999",
6+
"strict_max_version": "7.*"
7+
}
8+
}
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<linkset>
2+
<html:link rel="localization" href="__addonRef__-preferences.ftl" />
3+
</linkset>
4+
<vbox id="__addonRef__"">
5+
<groupbox>
6+
<label>
7+
<html:h2 data-l10n-id="meaasge-1" />
8+
</label>
9+
<checkbox data-l10n-id="meaasge-3" preference="boolean" native="true" />
10+
</groupbox>
11+
</vbox>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable no-undef */
2+
pref("string", "0.0.0");
3+
pref("boolean", true);
4+
pref("number", 123);
5+
pref(
6+
"break-line",
7+
"123",
8+
);
9+
pref("fake-number", "123");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test-plugin-meaasge-1 = General Settings
2+
test-plugin-meaasge-2-message-1 =
3+
.label = example
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"manifest_version": 2,
3+
"applications": {
4+
"zotero": {
5+
"strict_min_version": "6.999",
6+
"strict_max_version": "7.*",
7+
"id": "test-plugin",
8+
"update_url": "https://github.com/northword/zotero-plugin-scaffold/releases/download/releaser/update.json"
9+
}
10+
},
11+
"name": "Test Plugin",
12+
"version": "1.0.0"
13+
}

0 commit comments

Comments
 (0)