mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
|
|
import assert from 'assert';
|
|
import { describe } from "mocha";
|
|
import path from 'path';
|
|
import linux from '../../../runner/module-linux'
|
|
import windows from '../../../runner/module-windows'
|
|
import * as fs from 'fs'
|
|
|
|
describe("wcsc - module", function () {
|
|
describe("linux output should deep equal with wine", function () {
|
|
// afterEach(function(){
|
|
// if(this.currentTest.state === 'failed'){
|
|
// console.error('failed', this.currentTest)
|
|
// }
|
|
// })
|
|
it("初次加载1", async function () {
|
|
const p = path.resolve(__dirname, './data/1720324528222-wcsc-options.json')
|
|
const storagePath = path.resolve(
|
|
__dirname,
|
|
`miniprogram-demo/${this.test?.title}`
|
|
);
|
|
try {
|
|
fs.mkdirSync(storagePath, { recursive: true });
|
|
} catch (error) {}
|
|
|
|
const w = await windows.wcsc(p);
|
|
// console.log('windows:', typeof w)
|
|
const n = await linux.wcsc(p, storagePath);
|
|
// console.log('linux:', typeof n)
|
|
assert.equal(typeof n, typeof w);
|
|
fs.writeFileSync(
|
|
`${storagePath}/wine-output.json`,
|
|
JSON.stringify(w, null, 4)
|
|
);
|
|
fs.writeFileSync(
|
|
`${storagePath}/node-output.json`,
|
|
JSON.stringify(n, null, 4)
|
|
);
|
|
assert.deepEqual(n, w);
|
|
});
|
|
it("初次加载2", async function () {
|
|
const p = path.resolve(__dirname, './data/1720337273873-wcsc-options.json')
|
|
const storagePath = path.resolve(
|
|
__dirname,
|
|
`miniprogram-demo/${this.test?.title}`
|
|
);
|
|
try {
|
|
fs.mkdirSync(storagePath, { recursive: true });
|
|
} catch (error) {}
|
|
|
|
const w = await windows.wcsc(p);
|
|
// console.log('windows:', typeof w)
|
|
const n = await linux.wcsc(p, '');
|
|
// console.log('linux:', typeof n)
|
|
|
|
assert.equal(typeof n, typeof w);
|
|
fs.writeFileSync(
|
|
`${storagePath}/wine-output.json`,
|
|
JSON.stringify(w, null, 4)
|
|
);
|
|
fs.writeFileSync(
|
|
`${storagePath}/node-output.json`,
|
|
JSON.stringify(n, null, 4)
|
|
);
|
|
assert.deepEqual(n, w);
|
|
});
|
|
});
|
|
});
|