mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: test demo
This commit is contained in:
parent
83645b241c
commit
6bfcc7c0d3
5
.babelrc.json
Normal file
5
.babelrc.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"@babel/preset-env"
|
||||||
|
]
|
||||||
|
}
|
5
.mocharc.js
Normal file
5
.mocharc.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
require: ["@babel/register"],
|
||||||
|
recursive: true,
|
||||||
|
spec: "test/**/*.test.js"
|
||||||
|
}
|
17
README.md
17
README.md
@ -18,4 +18,19 @@
|
|||||||
|
|
||||||
懒加载实现是对比 windows 版本 与 Linux 简版 的生成代码,找出其中的规律;
|
懒加载实现是对比 windows 版本 与 Linux 简版 的生成代码,找出其中的规律;
|
||||||
|
|
||||||
按照规律,将 Linux 版本代码修改为符合 windows 版本结构的代码。
|
按照规律,将 Linux 版本代码修改为符合 windows 版本结构的代码。
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── generatemd5.js
|
||||||
|
├── nodejs --- 预览编译器
|
||||||
|
├── node_modules
|
||||||
|
├── package.json
|
||||||
|
├── package-lock.json
|
||||||
|
├── README.md
|
||||||
|
├── test
|
||||||
|
├── wcc_node --- 可视化编译器
|
||||||
|
├── wcc_node_old --- 可视化编译器 - 旧
|
||||||
|
├── wcsc_node_old --- 可视化编译器 - 旧
|
||||||
|
└── wine --- windows版本编译器
|
||||||
|
```
|
5592
package-lock.json
generated
5592
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -1,5 +1,15 @@
|
|||||||
{
|
{
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"miniprogram-compiler": "^0.2.1"
|
"miniprogram-compiler": "^0.2.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/cli": "^7.18.10",
|
||||||
|
"@babel/core": "^7.18.13",
|
||||||
|
"@babel/preset-env": "^7.18.10",
|
||||||
|
"@babel/register": "^7.18.9",
|
||||||
|
"mocha": "^10.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
test/demo.test.js
Normal file
8
test/demo.test.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const assert = require('assert');
|
||||||
|
describe('Array', function() {
|
||||||
|
describe('#indexOf()', function() {
|
||||||
|
it('should return -1 when the value is not present', function() {
|
||||||
|
assert.equal(-1, [1,2,3].indexOf(4));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -7,6 +7,7 @@ linux版存放于 `node_modules/wcc_linux`
|
|||||||
|
|
||||||
|
|
||||||
## 生成代码
|
## 生成代码
|
||||||
|
|
||||||
wine版按 `./vscode/launch.json` 配置执行nwjs生成 `wine.txt` 结尾的文件
|
wine版按 `./vscode/launch.json` 配置执行nwjs生成 `wine.txt` 结尾的文件
|
||||||
linux版执行 `wcc_test.js` `wcsc_test.js` 生成 `linux.txt` 结尾的文件
|
linux版执行 `wcc_test.js` `wcsc_test.js` 生成 `linux.txt` 结尾的文件
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ samples.push([config5, 5])
|
|||||||
|
|
||||||
const test_wine = (config, id) => {
|
const test_wine = (config, id) => {
|
||||||
const wine = spawn(
|
const wine = spawn(
|
||||||
path.resolve(__dirname, "../../../../package.nw/js/vendor/wcc.exe"),
|
path.resolve(__dirname, "../../../wine/wcc.exe"),
|
||||||
config.args,
|
config.args,
|
||||||
{
|
{
|
||||||
cwd: config.projectPath,
|
cwd: config.projectPath,
|
||||||
|
@ -120,7 +120,7 @@ const test_wine = (config, id) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
const wine = spawn(
|
const wine = spawn(
|
||||||
path.resolve(__dirname, "../../../../package.nw/js/vendor/wcc.exe"),
|
path.resolve(__dirname, "../../../wine/wcc.exe"),
|
||||||
config.args,
|
config.args,
|
||||||
{
|
{
|
||||||
cwd: config.projectPath,
|
cwd: config.projectPath,
|
||||||
|
@ -128,7 +128,7 @@ const sample4 = {
|
|||||||
samples.push([sample4, 4])
|
samples.push([sample4, 4])
|
||||||
const test_wine = (config, id) => {
|
const test_wine = (config, id) => {
|
||||||
const wine = spawn(
|
const wine = spawn(
|
||||||
path.resolve(__dirname, "../../../../../package.nw/js/vendor/wcsc.exe"),
|
path.resolve(__dirname, "../../../wine/wcsc.exe"),
|
||||||
config.args,
|
config.args,
|
||||||
{
|
{
|
||||||
cwd: config.projectPath,
|
cwd: config.projectPath,
|
||||||
|
BIN
wine/wcc.exe
Executable file
BIN
wine/wcc.exe
Executable file
Binary file not shown.
BIN
wine/wcsc.exe
Executable file
BIN
wine/wcsc.exe
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user