mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix global-require issues (#8999)
This commit is contained in:
parent
4d66223f5c
commit
50c4db73cf
@ -44,6 +44,7 @@ module.exports = {
|
|||||||
/* TODO: Remove these when upgrading to `@metamask/eslint-config@2` */
|
/* TODO: Remove these when upgrading to `@metamask/eslint-config@2` */
|
||||||
'array-callback-return': 'error',
|
'array-callback-return': 'error',
|
||||||
'callback-return': 'error',
|
'callback-return': 'error',
|
||||||
|
'global-require': 'error',
|
||||||
/* End v2 rules */
|
/* End v2 rules */
|
||||||
'arrow-parens': 'error',
|
'arrow-parens': 'error',
|
||||||
'no-tabs': 'error',
|
'no-tabs': 'error',
|
||||||
@ -105,6 +106,13 @@ module.exports = {
|
|||||||
rules: {
|
rules: {
|
||||||
'import/no-anonymous-default-export': ['error', { 'allowObject': true }],
|
'import/no-anonymous-default-export': ['error', { 'allowObject': true }],
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
files: [
|
||||||
|
'app/scripts/migrations/*.js',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'global-require': 'off',
|
||||||
|
},
|
||||||
}],
|
}],
|
||||||
|
|
||||||
settings: {
|
settings: {
|
||||||
|
@ -3,6 +3,8 @@ import nock from 'nock'
|
|||||||
import Enzyme from 'enzyme'
|
import Enzyme from 'enzyme'
|
||||||
import Adapter from 'enzyme-adapter-react-16'
|
import Adapter from 'enzyme-adapter-react-16'
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
|
import { JSDOM } from 'jsdom'
|
||||||
|
|
||||||
|
|
||||||
nock.disableNetConnect()
|
nock.disableNetConnect()
|
||||||
nock.enableNetConnect('localhost')
|
nock.enableNetConnect('localhost')
|
||||||
@ -45,8 +47,6 @@ global.log = log
|
|||||||
//
|
//
|
||||||
|
|
||||||
// dom
|
// dom
|
||||||
const { JSDOM } = require('jsdom')
|
|
||||||
|
|
||||||
const jsdom = new JSDOM()
|
const jsdom = new JSDOM()
|
||||||
global.window = jsdom.window
|
global.window = jsdom.window
|
||||||
|
|
||||||
@ -87,5 +87,6 @@ if (!window.crypto) {
|
|||||||
window.crypto = {}
|
window.crypto = {}
|
||||||
}
|
}
|
||||||
if (!window.crypto.getRandomValues) {
|
if (!window.crypto.getRandomValues) {
|
||||||
|
// eslint-disable-next-line global-require
|
||||||
window.crypto.getRandomValues = require('polyfill-crypto.getrandomvalues')
|
window.crypto.getRandomValues = require('polyfill-crypto.getrandomvalues')
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import assert from 'assert'
|
import assert from 'assert'
|
||||||
|
import firstTimeState from '../../../app/scripts/first-time-state'
|
||||||
import migration26 from '../../../app/scripts/migrations/026'
|
import migration26 from '../../../app/scripts/migrations/026'
|
||||||
|
|
||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
@ -32,7 +33,7 @@ describe('migration #26', function () {
|
|||||||
it('should successfully migrate first time state', function (done) {
|
it('should successfully migrate first time state', function (done) {
|
||||||
migration26.migrate({
|
migration26.migrate({
|
||||||
meta: {},
|
meta: {},
|
||||||
data: require('../../../app/scripts/first-time-state'),
|
data: firstTimeState,
|
||||||
})
|
})
|
||||||
.then((migratedData) => {
|
.then((migratedData) => {
|
||||||
assert.equal(migratedData.meta.version, migration26.version)
|
assert.equal(migratedData.meta.version, migration26.version)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import assert from 'assert'
|
import assert from 'assert'
|
||||||
|
import firstTimeState from '../../../app/scripts/first-time-state'
|
||||||
import migration27 from '../../../app/scripts/migrations/027'
|
import migration27 from '../../../app/scripts/migrations/027'
|
||||||
|
|
||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
@ -42,7 +43,7 @@ describe('migration #27', function () {
|
|||||||
it('should successfully migrate first time state', function (done) {
|
it('should successfully migrate first time state', function (done) {
|
||||||
migration27.migrate({
|
migration27.migrate({
|
||||||
meta: {},
|
meta: {},
|
||||||
data: require('../../../app/scripts/first-time-state'),
|
data: firstTimeState,
|
||||||
})
|
})
|
||||||
.then((migratedData) => {
|
.then((migratedData) => {
|
||||||
assert.equal(migratedData.meta.version, migration27.version)
|
assert.equal(migratedData.meta.version, migration27.version)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import assert from 'assert'
|
import assert from 'assert'
|
||||||
|
import firstTimeState from '../../../app/scripts/first-time-state'
|
||||||
import migration28 from '../../../app/scripts/migrations/028'
|
import migration28 from '../../../app/scripts/migrations/028'
|
||||||
|
|
||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
@ -36,7 +37,7 @@ describe('migration #28', function () {
|
|||||||
it('should successfully migrate first time state', function (done) {
|
it('should successfully migrate first time state', function (done) {
|
||||||
migration28.migrate({
|
migration28.migrate({
|
||||||
meta: {},
|
meta: {},
|
||||||
data: require('../../../app/scripts/first-time-state'),
|
data: firstTimeState,
|
||||||
})
|
})
|
||||||
.then((migratedData) => {
|
.then((migratedData) => {
|
||||||
assert.equal(migratedData.meta.version, migration28.version)
|
assert.equal(migratedData.meta.version, migration28.version)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user