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
546e471ca0
commit
62557971db
65
test/spec/wcc/raw/tdesign-miniprogram-starter-retail.spec.ts
Normal file
65
test/spec/wcc/raw/tdesign-miniprogram-starter-retail.spec.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
import assert from 'assert';
|
||||||
|
import path from 'path';
|
||||||
|
import linux from '../../../runner/linux'
|
||||||
|
import windows from '../../../runner/windows'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
describe("[tdesign-miniprogram-starter-retail] wcc - raw", function () {
|
||||||
|
describe("Raw: node output should equal with wine", function () {
|
||||||
|
// afterEach(function(){
|
||||||
|
// if(this.currentTest.state === 'failed'){
|
||||||
|
// console.error('failed', this.currentTest)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
it("case1", async function () {
|
||||||
|
const configPath = resolve(__dirname, './tdesign-miniprogram-starter-retail/case1-cmd.txt')
|
||||||
|
const projectPath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
"../../../projects/tdesign-miniprogram-starter-retail"
|
||||||
|
);
|
||||||
|
const args = [
|
||||||
|
"--config-path",
|
||||||
|
configPath,
|
||||||
|
];
|
||||||
|
const w = (await windows.wcc(args, projectPath)).replace(/\r\n/g, '\n')
|
||||||
|
const n = await linux.wcc(args, projectPath);
|
||||||
|
const storagePath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
`tdesign-miniprogram-starter-retail/${this.test?.title}`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(storagePath, { recursive: true });
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
fs.writeFileSync(`${storagePath}/wine-output.js`, w);
|
||||||
|
fs.writeFileSync(`${storagePath}/node-output.js`, n);
|
||||||
|
assert.equal(w, n);
|
||||||
|
});
|
||||||
|
it("case2", async function () {
|
||||||
|
const configPath = resolve(__dirname, './tdesign-miniprogram-starter-retail/case2-cmd.txt')
|
||||||
|
const projectPath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
"../../../projects/tdesign-miniprogram-starter-retail"
|
||||||
|
);
|
||||||
|
const args = [
|
||||||
|
"--config-path",
|
||||||
|
configPath,
|
||||||
|
];
|
||||||
|
const w = (await windows.wcc(args, projectPath)).replace(/\r\n/g, "\n");
|
||||||
|
const n = await linux.wcc(args, projectPath);
|
||||||
|
const storagePath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
`tdesign-miniprogram-starter-retail/${this.test?.title}`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(storagePath, { recursive: true });
|
||||||
|
} catch (error) {}
|
||||||
|
fs.writeFileSync(`${storagePath}/wine-output.js`, w);
|
||||||
|
fs.writeFileSync(`${storagePath}/node-output.js`, n);
|
||||||
|
assert.equal(w, n);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user