我正在为我的 Web 应用程序设置测试,该应用程序使用 Jest 框架与带有 TypeScript 的 Vue 框架配合使用。一切似乎都工作正常,除了@
我导入中的符号,例如import { Foo } from '@/bar
. 无论是在我的测试文件中还是在源代码中,它都无法理解并返回:
Cannot find module '@/store' from 'src/tests/foo.spec.ts'
Run Code Online (Sandbox Code Playgroud)
这是我的 Jest 配置package.json
:
"jest": {
"moduleFileExtensions": [
"js",
"ts",
"json",
"vue"
],
"testRegex": "(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"transform": {
".*\\.(vue)$": "vue-jest",
"^.+\\.tsx?$": "ts-jest",
"^.+\\.jsx?$": "babel-jest"
},
"testURL": "http://localhost/",
"collectCoverage": true,
"collectCoverageFrom": ["**/*.{ts,vue}", "!**/node_modules/**"],
"coverageReporters": ["html", "text-summary"]
}
Run Code Online (Sandbox Code Playgroud)
有人知道如何使其正常工作吗?
谢谢
我正在开发一个 Vue.js Web 应用程序,并使用 gRPC 来确保通信。
在前端,我使用网络版本的 gRPC grpc-web
:。
一切都运转良好;但是,当我在商店中进行 API 调用时,例如:
async fetchEcho() {
const echoService = new EchoServiceClient('http://localhost:8080', null, null);
const request = new EchoRequest();
request.setMessage('Hello World!');
const call = echoService.echo(request, {'custom-header-1': 'value1'},
(err: grpcWeb.Error, response: EchoResponse) => {
console.log(response.getMessage());
});
}
Run Code Online (Sandbox Code Playgroud)
async/await
在 Vue 文件中进行调用时如何使用该模式,例如:
await fetchEcho();
// ...
Run Code Online (Sandbox Code Playgroud)
并等到 API 调用完成才能恢复我的程序进程?
谢谢!
我在我的Android应用程序中添加了Place Autocompletion.当我单击按钮(chooseLocationButton
)时,它会正确打开自动完成小部件.问题是我想在搜索字段中写一个名字.点击第一次击键后,自动完成小部件关闭,研究没有完成.这是它在Run控制台中编写的内容:
W/IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
Run Code Online (Sandbox Code Playgroud)
这是代码:
AutocompleteFilter.Builder a = new AutocompleteFilter.Builder();
try {
final Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
.setFilter(a.setTypeFilter(AutocompleteFilter.TYPE_FILTER_REGIONS).build())
.build(this);
chooseLocationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE);
}
});
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
// TODO handle exception!
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
// TODO handle exception! Toast?
}
Run Code Online (Sandbox Code Playgroud)
当然,我已经在Google Developer Console中启用了Google Places Android API和Google Map android API.此外,我已将API密钥添加到AndroidManifest.xml中,如下所示:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
Run Code Online (Sandbox Code Playgroud)
在日志中我观察到:
BasicNetwork.performRequest: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试向其中添加本地 RPM 包yum
并安装它。要将它添加到yum
存储库,我运行:yum-config-manager --add-repo file:///path/to/local/package.rpm
然后yum install package
安装它。但是,我得到了这个输出:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.rrzn.uni-hannover.de
* epel: mirror.23media.de
* extras: centos.mirrors.psw.services
* nux-dextop: mirror.li.nux.ro
* updates: mirror.ratiokontakt.de
harbottle.gitlab.io_harbottle-main_7_x86_64_ | 2.9 kB 00:00:00
file:///path/to/local/package.rpm/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /path/to/local/package.rpm/repodata/repomd.xml"
Trying other mirror.
One of the configured repositories failed (added from: file:/path/to/local/package.x86_64.rpm),
and yum doesn't have enough cached data to continue. At this point the only …
Run Code Online (Sandbox Code Playgroud) typescript ×2
android ×1
async-await ×1
autocomplete ×1
babel-jest ×1
centos ×1
google-maps ×1
grpc ×1
grpc-web ×1
jestjs ×1
package ×1
rpm ×1
testing ×1
unit-testing ×1
vue.js ×1
yum ×1