timeout unit test

indexworkspace2
bunsenstraat 3 years ago
commit 9e3fe55326
  1. 6
      apps/remix-ide/src/app/tabs/analysis-tab.js
  2. 10
      apps/remix-ide/src/app/tabs/test-tab.js
  3. 2
      apps/remix-ide/src/remixAppManager.js
  4. 2
      libs/remix-tests/src/run.ts
  5. 25
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  6. 3
      libs/remixd/src/bin/remixd.ts

@ -39,7 +39,11 @@ class AnalysisTab extends ViewPlugin {
} }
} }
onActivation () { async onActivation () {
const isSolidityActive = await this.call('manager', 'isActive', 'solidity')
if (!isSolidityActive) {
await this.call('manager', 'activatePlugin', 'solidity')
}
this.renderComponent() this.renderComponent()
} }

@ -48,6 +48,7 @@ module.exports = class TestTab extends ViewPlugin {
appManager.event.on('activate', (name) => { appManager.event.on('activate', (name) => {
if (name === 'solidity') this.updateRunAction() if (name === 'solidity') this.updateRunAction()
console.log('solidity is activated')
}) })
appManager.event.on('deactivate', (name) => { appManager.event.on('deactivate', (name) => {
if (name === 'solidity') this.updateRunAction() if (name === 'solidity') this.updateRunAction()
@ -74,6 +75,14 @@ module.exports = class TestTab extends ViewPlugin {
} }
} }
async onActivation () {
const isSolidityActive = await this.call('manager', 'isActive', 'solidity')
if (!isSolidityActive) {
await this.call('manager', 'activatePlugin', 'solidity')
}
this.updateRunAction()
}
onDeactivation () { onDeactivation () {
this.off('filePanel', 'newTestFileCreated') this.off('filePanel', 'newTestFileCreated')
this.off('filePanel', 'setWorkspace') this.off('filePanel', 'setWorkspace')
@ -637,7 +646,6 @@ module.exports = class TestTab extends ViewPlugin {
el.setAttribute('title', 'No solidity file selected') el.setAttribute('title', 'No solidity file selected')
} else { } else {
el.setAttribute('title', 'The "Solidity Plugin" should be activated') el.setAttribute('title', 'The "Solidity Plugin" should be activated')
// @todo(#2747) we can activate the plugin here
} }
} }
if (!this.runActionElement) { if (!this.runActionElement) {

@ -14,7 +14,7 @@ const requiredModules = [ // services + layout views + system views
const dependentModules = ['git', 'hardhat'] // module which shouldn't be manually activated (e.g git is activated by remixd) const dependentModules = ['git', 'hardhat'] // module which shouldn't be manually activated (e.g git is activated by remixd)
export function isNative (name) { export function isNative (name) {
const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider'] const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting']
return nativePlugins.includes(name) || requiredModules.includes(name) return nativePlugins.includes(name) || requiredModules.includes(name)
} }

@ -82,7 +82,7 @@ commander
const baseURL = 'https://binaries.soliditylang.org/wasm/' const baseURL = 'https://binaries.soliditylang.org/wasm/'
const response: AxiosResponse = await axios.get(baseURL + 'list.json') const response: AxiosResponse = await axios.get(baseURL + 'list.json')
const { releases, latestRelease } = response.data const { releases, latestRelease } = response.data
const compString = releases[compVersion] const compString = releases ? releases[compVersion] : null
if (!compString) { if (!compString) {
log.error(`No compiler found in releases with version ${compVersion}`) log.error(`No compiler found in releases with version ${compVersion}`)
process.exit() process.exit()

@ -23,6 +23,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const [state, setState] = useState({ const [state, setState] = useState({
hideWarnings: false, hideWarnings: false,
autoCompile: false, autoCompile: false,
matomoAutocompileOnce: true,
optimize: false, optimize: false,
compileTimeout: null, compileTimeout: null,
timeout: 300, timeout: 300,
@ -69,7 +70,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const optimize = params.optimize const optimize = params.optimize
const runs = params.runs as string const runs = params.runs as string
const evmVersion = params.evmVersion const evmVersion = params.evmVersion
return { return {
...prevState, ...prevState,
hideWarnings: api.getAppParameter('hideWarnings') as boolean || false, hideWarnings: api.getAppParameter('hideWarnings') as boolean || false,
@ -135,6 +135,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
} }
}, [configurationSettings]) }, [configurationSettings])
const _retrieveVersion = (version?) => {
if (!version) version = state.selectedVersion
if (version === 'builtin') version = state.defaultVersion
return semver.coerce(version) ? semver.coerce(version).version : ''
}
// fetching both normal and wasm builds and creating a [version, baseUrl] map // fetching both normal and wasm builds and creating a [version, baseUrl] map
const fetchAllVersion = async (callback) => { const fetchAllVersion = async (callback) => {
let selectedVersion, allVersionsWasm, isURL let selectedVersion, allVersionsWasm, isURL
@ -281,7 +287,14 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
compileIcon.current.setAttribute('title', 'idle') compileIcon.current.setAttribute('title', 'idle')
compileIcon.current.classList.remove('remixui_spinningIcon') compileIcon.current.classList.remove('remixui_spinningIcon')
compileIcon.current.classList.remove('remixui_bouncingIcon') compileIcon.current.classList.remove('remixui_bouncingIcon')
if (!state.autoCompile || (state.autoCompile && state.matomoAutocompileOnce)) {
_paq.push(['trackEvent', 'compiler', 'compiled_with_version', _retrieveVersion()]) _paq.push(['trackEvent', 'compiler', 'compiled_with_version', _retrieveVersion()])
if (state.autoCompile && state.matomoAutocompileOnce) {
setState(prevState => {
return { ...prevState, matomoAutocompileOnce: false }
})
}
}
} }
const scheduleCompilation = () => { const scheduleCompilation = () => {
@ -305,12 +318,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
compileTabLogic.runCompiler(hhCompilation) compileTabLogic.runCompiler(hhCompilation)
} }
const _retrieveVersion = (version?) => {
if (!version) version = state.selectedVersion
if (version === 'builtin') version = state.defaultVersion
return semver.coerce(version) ? semver.coerce(version).version : ''
}
const _updateVersionSelector = (version, customUrl = '') => { const _updateVersionSelector = (version, customUrl = '') => {
// update selectedversion of previous one got filtered out // update selectedversion of previous one got filtered out
let selectedVersion = version let selectedVersion = version
@ -384,7 +391,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const handleLoadVersion = (value) => { const handleLoadVersion = (value) => {
setState(prevState => { setState(prevState => {
return { ...prevState, selectedVersion: value } return { ...prevState, selectedVersion: value, matomoAutocompileOnce: true }
}) })
updateCurrentVersion(value) updateCurrentVersion(value)
_updateVersionSelector(value) _updateVersionSelector(value)
@ -405,7 +412,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
api.setAppParameter('autoCompile', checked) api.setAppParameter('autoCompile', checked)
checked && compile() checked && compile()
setState(prevState => { setState(prevState => {
return { ...prevState, autoCompile: checked } return { ...prevState, autoCompile: checked, matomoAutocompileOnce: state.matomoAutocompileOnce || checked }
}) })
} }

@ -156,7 +156,8 @@ function errorHandler (error: any, service: string) {
console.error(e) console.error(e)
} }
return data.includes(origin) ? data.includes(origin) : data.includes(domain) const dataArray:string[] = data
return dataArray.includes(origin) ? dataArray.includes(origin) : dataArray.includes(domain)
} catch (e) { } catch (e) {
try { try {
// eslint-disable-next-line // eslint-disable-next-line

Loading…
Cancel
Save