@mimicprotocol/cli 0.0.1-rc.19 → 0.0.1-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands/test.js
CHANGED
|
@@ -37,21 +37,24 @@ const core_1 = require("@oclif/core");
|
|
|
37
37
|
const child_process_1 = require("child_process");
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
class Test extends core_1.Command {
|
|
40
|
+
runOrExit(cmd, args, cwd) {
|
|
41
|
+
const result = (0, child_process_1.spawnSync)(cmd, args, { cwd, stdio: 'inherit' });
|
|
42
|
+
if (result.status !== 0)
|
|
43
|
+
this.exit(result.status ?? 1);
|
|
44
|
+
}
|
|
40
45
|
async run() {
|
|
41
46
|
const { flags } = await this.parse(Test);
|
|
42
47
|
const baseDir = path.resolve(flags.directory);
|
|
43
48
|
const testPath = path.join(baseDir, 'tests');
|
|
44
49
|
if (!flags.skipCompile) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return;
|
|
48
|
-
const compile = (0, child_process_1.spawnSync)('yarn', ['mimic', 'compile'], { cwd: baseDir, stdio: 'inherit' });
|
|
49
|
-
if (compile.status !== 0)
|
|
50
|
-
return;
|
|
50
|
+
this.runOrExit('yarn', ['mimic', 'codegen'], baseDir);
|
|
51
|
+
this.runOrExit('yarn', ['mimic', 'compile'], baseDir);
|
|
51
52
|
}
|
|
52
|
-
(0, child_process_1.spawnSync)('yarn', ['tsx', './node_modules/mocha/bin/mocha.js', `${testPath}/**/*.spec.ts`], {
|
|
53
|
+
const result = (0, child_process_1.spawnSync)('yarn', ['tsx', './node_modules/mocha/bin/mocha.js', `${testPath}/**/*.spec.ts`], {
|
|
54
|
+
cwd: baseDir,
|
|
53
55
|
stdio: 'inherit',
|
|
54
56
|
});
|
|
57
|
+
this.exit(result.status ?? 1);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
Test.description = 'Runs task tests';
|
|
@@ -107,7 +107,7 @@ class FunctionHandler {
|
|
|
107
107
|
lines.push(` ${methodName}(${methodParams}): ${returnType} {`);
|
|
108
108
|
lines.push(` const encodedData = ${contractName}Utils.encode${capitalizedName}(${inputs.map((p) => p.escapedName).join(', ')})`);
|
|
109
109
|
importManager.addType('environment');
|
|
110
|
-
const contractCallLine = `environment.contractCall(this._address, this._chainId,
|
|
110
|
+
const contractCallLine = `environment.contractCall(this._address, this._chainId, encodedData.toHexString(), this._timestamp)`;
|
|
111
111
|
if (returnType === 'void') {
|
|
112
112
|
lines.push(` ${contractCallLine}`);
|
|
113
113
|
}
|
package/package.json
CHANGED