Facing an issue while trying to mock 'datasourceRequest' from 'BackendSrv' class

I am writing unit test for DataSource.tsx file by taking google’s StackDriver as reference.I am using CorpGlory repo https://github.com/CorpGlory/types-grafana for mocking purpose.
But i when i do yarn test i am getting the error ’

Cannot find module ‘grafana/app/core/services/backend_srv’ from ‘DataSource.test.ts’

even though the module is present at that location.
The Code Snippet for .test.tsx is

The plugin.json file

“name”: “tsdb-datasource”,
“version”: “1.0.0”,
“description”: “TSDB Grafana Data Source”,
“scripts”: {
“build”: “grafana-toolkit plugin:build”,
“test”: “grafana-toolkit plugin:test”,
“dev”: “grafana-toolkit plugin:dev”,
“watch”: “grafana-toolkit plugin:dev --watch”
“author”: “Abhi”,
“license”: “Apache-2.0”,
“dependencies”: {
@grafana/data”: “^6.7.2”,
@grafana/runtime”: “^6.7.2”,
@grafana/toolkit”: “^6.7.2”,
@grafana/ui”: “^6.7.2”,
@types/enzyme”: “^3.10.5”,
@types/enzyme-adapter-react-16”: “^1.0.6”,
@types/react-test-renderer”: “^16.9.2”
“devDependencies”: {
@types/lodash”: “latest”,
“enzyme”: “^3.11.0”,
“enzyme-adapter-react-16”: “^1.15.2”
“resolutions”: {
@babel/preset-env”: “7.9.0”

jest.config.js file contents

// This file is needed because it is used by vscode and other tools that

// call jest directly. However, unless you are doing anything special

// do not edit this file

const standard = require(’@grafana/toolkit/src/config/jest.plugin.config’);

// This process will use the same config that yarn test is using

module.exports = standard.jestConfig();



Need help on this issue please.Thanks in Advance