Skip to content

Commit 42eafa7

Browse files
Require print as a const. Don't pass it as a function arg
1 parent 63bc04f commit 42eafa7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/commands/test.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { Binary } = require('binary-install-raw')
22
const os = require('os')
33
const chalk = require('chalk')
44
const fetch = require('node-fetch')
5-
const { filesystem } = require('gluegun/filesystem')
5+
const { filesystem, print } = require('gluegun')
66
const { fixParameters } = require('../command-helpers/gluegun')
77
const semver = require('semver')
88
const { spawn, exec } = require('child_process')
@@ -24,9 +24,6 @@ ${chalk.dim('Options:')}
2424
module.exports = {
2525
description: 'Runs rust binary for subgraph testing',
2626
run: async toolbox => {
27-
// Obtain tools
28-
let { print } = toolbox
29-
3027
// Read CLI parameters
3128
let {
3229
c,
@@ -90,14 +87,14 @@ module.exports = {
9087
opts.set("latestVersion", json.tag_name)
9188

9289
if(opts.get("docker")) {
93-
runDocker(datasource, opts, print)
90+
runDocker(datasource, opts)
9491
} else {
95-
runBinary(datasource, opts, print)
92+
runBinary(datasource, opts)
9693
}
9794
}
9895
}
9996

100-
async function runBinary(datasource, opts, print) {
97+
async function runBinary(datasource, opts) {
10198
let coverageOpt = opts.get("coverage")
10299
let forceOpt = opts.get("force")
103100
let logsOpt = opts.get("logs")
@@ -110,7 +107,7 @@ async function runBinary(datasource, opts, print) {
110107
const url = `https://github.com/LimeChain/matchstick/releases/download/${versionOpt || latestVersion}/${platform}`
111108

112109
if (logsOpt) {
113-
console.log(`Download link: ${url}`)
110+
print.info(`Download link: ${url}`)
114111
}
115112

116113
let binary = new Binary(platform, url, versionOpt || latestVersion)
@@ -132,7 +129,7 @@ function getPlatform(logsOpt) {
132129
const isM1 = cpuCore.model.includes("Apple M1")
133130

134131
if (logsOpt) {
135-
console.log(`OS type: ${type}\nOS arch: ${arch}\nOS release: ${release}\nOS major version: ${majorVersion}\nCPU model: ${cpuCore.model}`)
132+
print.info(`OS type: ${type}\nOS arch: ${arch}\nOS release: ${release}\nOS major version: ${majorVersion}\nCPU model: ${cpuCore.model}`)
136133
}
137134

138135
if (arch === 'x64' || (arch === 'arm64' && isM1)) {
@@ -158,7 +155,7 @@ function getPlatform(logsOpt) {
158155
throw new Error(`Unsupported platform: ${type} ${arch} ${majorVersion}`)
159156
}
160157

161-
async function runDocker(datasource, opts, print) {
158+
async function runDocker(datasource, opts) {
162159
let coverageOpt = opts.get("coverage")
163160
let forceOpt = opts.get("force")
164161
let versionOpt = opts.get("version")

0 commit comments

Comments
 (0)