mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: 自动化测试的一些准备
This commit is contained in:
parent
1288bd1aca
commit
5b2a02d360
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,4 +7,4 @@ node_modules
|
|||||||
*err.js
|
*err.js
|
||||||
*stderr.json
|
*stderr.json
|
||||||
.cache
|
.cache
|
||||||
*/spec/**/*.js
|
*/spec/**/*output.js
|
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[submodule "test/projects/tdesign-miniprogram-starter-retail"]
|
||||||
|
path = test/projects/tdesign-miniprogram-starter-retail
|
||||||
|
url = https://github.com/Tencent/tdesign-miniprogram-starter-retail.git
|
||||||
|
[submodule "test/projects/miniprogram-demo"]
|
||||||
|
path = test/projects/miniprogram-demo
|
||||||
|
url = https://github.com/wechat-miniprogram/miniprogram-demo.git
|
@ -4,6 +4,6 @@ module.exports = {
|
|||||||
'ts-node/register'
|
'ts-node/register'
|
||||||
],
|
],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
spec: "test/**/*.spec.ts",
|
spec: "./test/spec/**/*.spec.ts",
|
||||||
timeout: 20000,
|
timeout: 20000,
|
||||||
}
|
}
|
7
changelog.md
Normal file
7
changelog.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## 🌈 v0.0.2 / 2023-08-31
|
||||||
|
|
||||||
|
🚀Features
|
||||||
|
- feat: 添加非懒加载模式的支持
|
||||||
|
|
||||||
|
🐞 Bug Fixes
|
||||||
|
- fix: 修复一些逻辑错误
|
3767
package-lock.json
generated
3767
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,9 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --reporter-option maxDiffSize=1e9",
|
"start": "nw ./test/node-modules",
|
||||||
"start": "nw ./test/node-modules"
|
"test-prepare": "test/spec/prepare.sh",
|
||||||
|
"test": "mocha --reporter-option maxDiffSize=1e9"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
@ -18,6 +19,7 @@
|
|||||||
"@types/mocha": "^10.0.1",
|
"@types/mocha": "^10.0.1",
|
||||||
"@types/node": "^20.4.5",
|
"@types/node": "^20.4.5",
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
|
"miniprogram-ci": "^1.9.8",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^10.0.0",
|
||||||
"ts-node": "^10.9.1"
|
"ts-node": "^10.9.1"
|
||||||
}
|
}
|
||||||
|
4411
pnpm-lock.yaml
generated
4411
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
1
test/projects/miniprogram-demo
Submodule
1
test/projects/miniprogram-demo
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit debce7c5a4f5805f03d6e8188b4dab5b6187e67f
|
1
test/projects/tdesign-miniprogram-starter-retail
Submodule
1
test/projects/tdesign-miniprogram-starter-retail
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit ef92ec100f82dfb724a62a08dfbc1defb50183c2
|
32
test/spec/build-npm-mini.js
Normal file
32
test/spec/build-npm-mini.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
const ci = require('miniprogram-ci');
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这是用于构建小程序npm的脚本
|
||||||
|
*/
|
||||||
|
const argv = process.argv.slice(2);
|
||||||
|
const projectPath = argv[0];
|
||||||
|
(async () => {
|
||||||
|
const project = new ci.Project({
|
||||||
|
appid: 'wxsomeappid',
|
||||||
|
type: 'miniProgram',
|
||||||
|
projectPath: projectPath,
|
||||||
|
privateKeyPath: path.resolve(__dirname, 'empty-key'),
|
||||||
|
ignores: ['node_modules/**/*'],
|
||||||
|
})
|
||||||
|
// 在有需要的时候构建npm
|
||||||
|
const warning = await ci.packNpm(project, {
|
||||||
|
ignores: ['pack_npm_ignore_list'],
|
||||||
|
reporter: (infos) => { console.log(infos) }
|
||||||
|
})
|
||||||
|
console.warn(warning)
|
||||||
|
// 可对warning进行格式化
|
||||||
|
/*
|
||||||
|
warning.map((it, index) => {
|
||||||
|
return `${index + 1}. ${it.msg}
|
||||||
|
\t> code: ${it.code}
|
||||||
|
\t@ ${it.jsPath}:${it.startLine}-${it.endLine}`
|
||||||
|
}).join('---------------\n')
|
||||||
|
*/
|
||||||
|
// 完成构建npm之后,可用ci.preview或者ci.upload
|
||||||
|
})()
|
0
test/spec/empty-key
Normal file
0
test/spec/empty-key
Normal file
13
test/spec/prepare.sh
Executable file
13
test/spec/prepare.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
test_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||||
|
|
||||||
|
project_dir="$test_dir/projects"
|
||||||
|
|
||||||
|
for dir in "$project_dir"/*; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
name="${dir##*/}"
|
||||||
|
"$test_dir/spec/prepare/$name"
|
||||||
|
fi
|
||||||
|
done
|
22
test/spec/prepare/miniprogram-demo
Executable file
22
test/spec/prepare/miniprogram-demo
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
test_dir=$(cd `dirname $0`/../.. && pwd -P)
|
||||||
|
project_dir="$test_dir/projects/${0##*/}"
|
||||||
|
|
||||||
|
cd "$project_dir"
|
||||||
|
|
||||||
|
git submodule set-url miniprogram/packageSkylineExamples https://github.com/wechat-miniprogram/awesome-skyline.git
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
echo "remove @tencent/eslint-config-wxapp"
|
||||||
|
pnpm remove @tencent/eslint-config-wxapp
|
||||||
|
echo "add eslint-config-wxapp"
|
||||||
|
pnpm add eslint-config-wxapp -D
|
||||||
|
|
||||||
|
cd miniprogram
|
||||||
|
|
||||||
|
echo "pnpm install"
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
echo "build miniprogram_npm"
|
||||||
|
node "$test_dir/spec/build-npm-mini.js" "$project_dir"
|
13
test/spec/prepare/tdesign-miniprogram-starter-retail
Executable file
13
test/spec/prepare/tdesign-miniprogram-starter-retail
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
test_dir=$(cd `dirname $0`/../.. && pwd -P)
|
||||||
|
project_dir="$test_dir/projects/${0##*/}"
|
||||||
|
|
||||||
|
cd "$project_dir"
|
||||||
|
|
||||||
|
echo "exec pnpm install"
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
echo "build miniprogram_npm"
|
||||||
|
node "$test_dir/spec/build-npm-mini.js" "$project_dir"
|
@ -15,7 +15,7 @@ describe("wcc - raw", function () {
|
|||||||
it("初次加载1", async function () {
|
it("初次加载1", async function () {
|
||||||
const projectPath = path.resolve(
|
const projectPath = path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
"/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram"
|
"../../../projects/miniprogram-demo/miniprogram"
|
||||||
);
|
);
|
||||||
const args = [
|
const args = [
|
||||||
"-d",
|
"-d",
|
||||||
@ -59,7 +59,7 @@ describe("wcc - raw", function () {
|
|||||||
it("初次加载2", async function () {
|
it("初次加载2", async function () {
|
||||||
const projectPath = path.resolve(
|
const projectPath = path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
"/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram"
|
"../../../projects/miniprogram-demo/miniprogram"
|
||||||
);
|
);
|
||||||
const args = [
|
const args = [
|
||||||
"-d",
|
"-d",
|
||||||
@ -109,7 +109,7 @@ describe("wcc - raw", function () {
|
|||||||
it("组件 - skyline - 自定义路由", async function () {
|
it("组件 - skyline - 自定义路由", async function () {
|
||||||
const projectPath = path.resolve(
|
const projectPath = path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
"/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram"
|
"../../../projects/miniprogram-demo/miniprogram"
|
||||||
);
|
);
|
||||||
const args = [
|
const args = [
|
||||||
"-d",
|
"-d",
|
||||||
@ -152,7 +152,7 @@ describe("wcc - raw", function () {
|
|||||||
it("组件 - skyline - 自定义路由 -2", async function () {
|
it("组件 - skyline - 自定义路由 -2", async function () {
|
||||||
const projectPath = path.resolve(
|
const projectPath = path.resolve(
|
||||||
__dirname,
|
__dirname,
|
||||||
"/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram"
|
"../../../projects/miniprogram-demo/miniprogram"
|
||||||
);
|
);
|
||||||
const args = [
|
const args = [
|
||||||
"-d",
|
"-d",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user