fixing linting for remix-tests

pull/4771/head
lianahus 9 months ago
parent dde16c2bd4
commit 2df970be55
  1. 4
      apps/solhint/project.json
  2. 4
      libs/remix-tests/src/compiler.ts
  3. 7
      libs/remix-tests/tests/testRunner.cli.spec.ts
  4. 4
      libs/remix-tests/tests/testRunner.spec.ts

@ -51,8 +51,8 @@
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/solhint/**/*.ts"],
"eslintConfig": "libs/solhint/.eslintrc"
"lintFilePatterns": ["apps/solhint/**/*.ts"],
"eslintConfig": "apps/solhint/.eslintrc"
}
},
"serve": {

@ -25,7 +25,7 @@ export function writeTestAccountsContract (accounts: string[]) {
body += `return accounts[index];`
} else {
body = `return address(0);`
}
}
return testAccountContract.replace('>accounts<', body)
}
@ -91,7 +91,7 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
const filepath: string = (isDirectory ? filename : path.dirname(filename))
const importsCallback = (url, cb) => {
try {
if(fs.existsSync(url)) cb(null, fs.readFileSync(url, 'utf-8'))
if (fs.existsSync(url)) cb(null, fs.readFileSync(url, 'utf-8'))
else {
const urlResolver = new RemixURLResolver()
urlResolver.resolve(url).then((result) => cb(null, result.content)).catch((error) => cb(error.message))

@ -9,10 +9,10 @@ describe('testRunner: remix-tests CLI', function(){
const executablePath = resolve(__dirname + '/../../../dist/libs/remix-tests/bin/remix-tests')
const result = spawnSync('ls', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') })
if(result) {
if (result) {
const dirContent = result.stdout.toString()
// Install dependencies if 'node_modules' is not already present
if(!dirContent.includes('node_modules')) {
if (!dirContent.includes('node_modules')) {
execSync('yarn add @remix-project/remix-lib ../../libs/remix-lib', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') })
execSync('yarn add @remix-project/remix-url-resolver ../../libs/remix-url-resolver', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') })
execSync('yarn add @remix-project/remix-solidity ../../libs/remix-solidity', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') })
@ -21,7 +21,6 @@ describe('testRunner: remix-tests CLI', function(){
}
}
describe('test various CLI options', function() {
it('remix-tests version', () => {
const res = spawnSync(executablePath, ['-V'])
@ -79,8 +78,6 @@ Commands:
})
it('remix-tests running a test file with custom compiler version', () => {
const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
// match initial lines

@ -8,8 +8,6 @@ import { deployAll } from '../src/deployer'
import { runTest, compilationInterface } from '../src/index'
import { ResultsInterface, TestCbInterface, ResultCbInterface } from '../src/index'
// deepEqualExcluding allows us to exclude specific keys whose values vary.
// In this specific test, we'll use this helper to exclude `time` keys.
// Assertions for the existence of these will be made at the correct places.
@ -177,8 +175,6 @@ describe('testRunner', function () {
})
})
describe('assert library NOTEQUAL method tests', function () {
const filename: string = __dirname + '/examples_0/assert_notEqual_test.sol'

Loading…
Cancel
Save