无法分配给只读属性“.js”的#<对象>

我正在构build一个应用程序,并有一些麻烦与处理代理和testing。

我有以下testing:

import proxyquire from 'proxyquire' const fetchMock = () => new Promise((res) => { jobs: [] }) const JenkinsService = proxyquire('../lib/jenkins-service', { 'node-fetch': fetchMock }) describe('JenkinsService#getProject->goodConfs', () => { let service beforeEach(() => service = new JenkinsService({ url: 'http://jenkins.io' })) it('should call fetch method', () => { service.getAll() }) }) 

这失败了,并抛出我以下错误:

不能只读属性的'.js'

我试图简单地testing在我的getAll方法中调用获取模块:

 'use babel' import fetch from 'node-fetch' import CONSTANTS from './constants' export default class JenkinsService { /** * Create a new JenkinsService * @param {Object} configs The configuration needed to access jenkins */ constructor (configs) { this.configs = configs } /** * Get a remote list of projects * @return {Object[]} The project list */ getAll () { if (!this.configs.url) throw new Error(CONSTANTS.NO_URL_IN_CONFS) return fetch(this.configs.url) } } 

任何想法出了什么问题?