feat: test demo

This commit is contained in:
msojocs 2022-08-28 22:11:13 +08:00
parent 83645b241c
commit 6bfcc7c0d3
12 changed files with 5640 additions and 4 deletions

5
.babelrc.json Normal file
View File

@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-env"
]
}

5
.mocharc.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
require: ["@babel/register"],
recursive: true,
spec: "test/**/*.test.js"
}

View File

@ -18,4 +18,19 @@
懒加载实现是对比 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

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,15 @@
{
"scripts": {
"test": "mocha"
},
"dependencies": {
"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
View 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));
});
});
});

View File

@ -7,6 +7,7 @@ linux版存放于 `node_modules/wcc_linux`
## 生成代码
wine版按 `./vscode/launch.json` 配置执行nwjs生成 `wine.txt` 结尾的文件
linux版执行 `wcc_test.js` `wcsc_test.js` 生成 `linux.txt` 结尾的文件

View File

@ -101,7 +101,7 @@ samples.push([config5, 5])
const test_wine = (config, id) => {
const wine = spawn(
path.resolve(__dirname, "../../../../package.nw/js/vendor/wcc.exe"),
path.resolve(__dirname, "../../../wine/wcc.exe"),
config.args,
{
cwd: config.projectPath,

View File

@ -120,7 +120,7 @@ const test_wine = (config, id) => {
}
const wine = spawn(
path.resolve(__dirname, "../../../../package.nw/js/vendor/wcc.exe"),
path.resolve(__dirname, "../../../wine/wcc.exe"),
config.args,
{
cwd: config.projectPath,

View File

@ -128,7 +128,7 @@ const sample4 = {
samples.push([sample4, 4])
const test_wine = (config, id) => {
const wine = spawn(
path.resolve(__dirname, "../../../../../package.nw/js/vendor/wcsc.exe"),
path.resolve(__dirname, "../../../wine/wcsc.exe"),
config.args,
{
cwd: config.projectPath,

BIN
wine/wcc.exe Executable file

Binary file not shown.

BIN
wine/wcsc.exe Executable file

Binary file not shown.