pull/1504/head
yann300 3 years ago
parent 95e6bbba34
commit efc93ab097
  1. 24
      libs/remix-solidity/jest.config.js
  2. 1
      libs/remix-solidity/package.json
  3. 29
      libs/remix-solidity/test/compiler-input.ts
  4. 25
      libs/remix-solidity/tests/compiler-input.spec.ts
  5. 3
      libs/remix-solidity/tsconfig.json
  6. 6
      workspace.json

@ -0,0 +1,24 @@
module.exports = {
name: 'remix-solidity',
preset: '../../jest.config.js',
verbose: true,
silent: false, // Silent console messages, specially the 'remix-simulator' ones
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
transformIgnorePatterns: ["/node_modules/", "/dist/", "\\.pnp\\.[^\\\/]+$"],
rootDir: "./",
testTimeout: 40000,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html', 'json'],
// Coverage
collectCoverage: true,
coverageReporters: ['text', 'text-summary'],
collectCoverageFrom: [
"**/*.ts",
"!**/sol/**",
"!src/types.ts",
"!src/logger.ts"
],
coverageDirectory: '../../coverage/libs/remix-solidity'
};

@ -41,7 +41,6 @@
"@types/node": "^13.1.1", "@types/node": "^13.1.1",
"babel-eslint": "^10.0.0", "babel-eslint": "^10.0.0",
"babelify": "^10.0.0", "babelify": "^10.0.0",
"tape": "^4.6.0",
"typescript": "^3.7.4" "typescript": "^3.7.4"
}, },
"scripts": { "scripts": {

@ -1,29 +0,0 @@
'use strict'
import tape from 'tape'
import { getValidLanguage } from '../src/compiler/compiler-input'
import { Language } from '../src/compiler/types'
tape('compiler-input', function (t) {
t.test('getValidLanguage', function (st) {
st.plan(9)
const correctYul: Language = 'Yul'
const correctSolidity: Language = 'Solidity'
const yulUpperCase = 'Yul'
const yulLowerCase = 'yul'
const solidityUpperCase = 'Solidity'
const solidityLowerCase = 'solidity'
st.equal(getValidLanguage(yulLowerCase), correctYul)
st.equal(getValidLanguage(yulUpperCase), correctYul)
st.equal(getValidLanguage(solidityUpperCase), correctSolidity)
st.equal(getValidLanguage(solidityLowerCase), correctSolidity)
st.equal(getValidLanguage(null), null)
st.equal(getValidLanguage(undefined), null)
st.equal(getValidLanguage(''), null)
st.equal(getValidLanguage('A'), null)
st.equal(getValidLanguage('Something'), null)
})
})

@ -0,0 +1,25 @@
import { getValidLanguage } from '../src/compiler/compiler-input'
import { Language } from '../src/compiler/types'
describe('compiler-input', () => {
test('getValidLanguage', () => {
const correctYul: Language = 'Yul'
const correctSolidity: Language = 'Solidity'
const yulUpperCase = 'Yul'
const yulLowerCase = 'yul'
const solidityUpperCase = 'Solidity'
const solidityLowerCase = 'solidity'
expect(getValidLanguage(yulLowerCase)).toBe(correctYul)
expect(getValidLanguage(yulUpperCase)).toBe(correctYul)
expect(getValidLanguage(solidityUpperCase)).toBe(correctSolidity)
expect(getValidLanguage(solidityLowerCase)).toBe(correctSolidity)
expect(getValidLanguage(null)).toBe(null)
expect(getValidLanguage(undefined)).toBe(null)
expect(getValidLanguage('')).toBe(null)
expect(getValidLanguage('A')).toBe(null)
expect(getValidLanguage('Something')).toBe(null)
})
})

@ -1,8 +1,7 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"types": ["node"], "types": ["jest", "node"]
"esModuleInterop": true
}, },
"include": ["**/*.ts"] "include": ["**/*.ts"]
} }

@ -309,10 +309,10 @@
} }
}, },
"test": { "test": {
"builder": "@nrwl/workspace:run-commands", "builder": "@nrwl/jest:jest",
"options": { "options": {
"commands": ["./../../node_modules/.bin/npm-run-all test"], "jestConfig": "libs/remix-solidity/jest.config.js",
"cwd": "libs/remix-solidity" "tsConfig": "libs/remix-solidity/tsconfig.spec.json"
} }
}, },
"build": { "build": {

Loading…
Cancel
Save