这以前确实有效!
我的管道中的部署步骤是通过 SSH 连接到 DO 框并从 Docker 注册表中提取代码。如前所述,这之前是有效的,这是我当时deploy的一步,从这里.gitlab-ci.yml得到了很好的灵感:Using SSH
deploy:
stage: deploy
image: docker:stable-dind
only:
- master
services:
# Specifying the DinD version here as the latest DinD version introduced a timeout bug
# Highlighted here: https://forum.gitlab.com/t/gitlab-com-ci-stuck-on-docker-build/34401/2
- docker:19.03.5-dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
environment:
name: production
when: manual
before_script:
- mkdir -p ~/.ssh
- echo "$DEPLOYMENT_SERVER_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- eval "$(ssh-agent -S)"
- …Run Code Online (Sandbox Code Playgroud) 我是 Jest 的新手,所以如果这是一个明显的答案,请原谅我,但在滚动文档后我找不到答案。
我有一个函数(funcA) ,它根据接收的参数将不同长度的数组传递给另一个函数(funcB)funcA。funcB我试图根据我提供给 的参数来测试传递给的数组的长度是否正确funcA。我并不关心数组的内容,只是它有一定的长度。这是我目前的尝试:
// Modules
const funcA = require('./funcA')
// Mock
const funcB = jest.fn(pairs => {
return pairs[0]
})
// Test
test('Should pass array of 3623 length', () => {
const result = funcA(75)
expect(result).toBeInstanceOf(Object)
expect(funcB).toHaveBeenCalledWith(expect.any(Array).toHaveLength(3623))
})
Run Code Online (Sandbox Code Playgroud)
我想尝试使用any()如果可以的话,但以下测试结果出现错误:
类型错误:expect.any(...).toHaveLength 不是函数
即使我将 括expect.any(...)在另一组括号中,我也会收到相同的错误。有什么办法可以实现我想要的吗?
我正在使用样板Next.js starter。在 中index.js,express 应用程序的一个实例被定义为expressApp。我只是试图使用我的网站图标来提供服务serve-favicon,但没有运气:
expressApp.use(favicon(path.join(__dirname, "static", "brand", "favicon.ico")));
Run Code Online (Sandbox Code Playgroud)
检查正在解析的路径,它是正确的。next.js 的实现express有何不同?
我一直关注这里的官方指南,但仍然得到错误.GitHub上的用户经历了同样的问题,但没有提到它是如何解决的,只是他的代码中有一个错误调用他的工厂,我无法从他的plnkr中找出任何东西.
控制器:
function ActivitiesController($scope, $state, $window, Authentication, activity, $uibModal, $uibModalInstance) {
var vm = this;
vm.authentication = Authentication;
vm.activity = activity;
vm.openModal = openModal;
vm.okOnModal = okOnModal;
vm.cancelOnModal = cancelOnModal;
function openModal() {
$uibModal.open({
template: "<div class='modal-header'>"
+ "<h3 class='modal-title' id='modal-title'>Friends</h3>"
+ "</div>"
+ "<div class='modal-body list-group' id='modal-body'>"
+ "<a ng-repeat='friend in vm.friends' class='list-group-item'>"
+ "<img class='friend-user-profile-picture' ng-src='{{ friend.friend.profileImageURL }}' alt='{{ friend.friend.displayName }}'>"
+ "<h4 class='list-group-item-heading' ng-bind='friend.friend.displayName'></h4>"
+ "<small class='list-group-item-text' ng-bind='friend.friend.username'></small>"
+ …Run Code Online (Sandbox Code Playgroud) 我有2个模态对话框:
当用户选择要查看的项目时,将检索该项目的当前版本.这些版本显示在模态对话框2的表格中.此表格中的每一行都包含1个版本.共有2列:
因此,第二个模态对话框的这个表是在运行时生成的.这是我的代码:
jQuery的/ JS
function showComponentVersionModal(assocComs ,p, comVersions, comVersionArray) {
$('#component-versions-modal .modal-body tbody').find('tr:gt(0)').remove();
var winW = window.innerWidth;
for (var j in comVersions) {
if (comVersions[j].title === p.text()) {
var newRow = '<tr>' +
'<td><input name="versionCheck" type="radio"/></td> ' +
'<td></td>' +
'</tr>';
if ($('#component-versions-modal .modal-body tbody tr:last td:nth-child(2)').text() !== comVersions[j].version) {
$('#component-versions-modal .modal-body tbody tr:last').after(newRow);
$('#component-versions-modal .modal-body tbody tr:last td:nth-child(2)').text(comVersions[j].version);
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
当用户选择项目时执行此功能,因此,使用它的版本生成第二个模态对话框.
$('input[name="versionCheck"]').on('change', function() {
if ($(this).prop('checked').length <= 0) {
...
} …Run Code Online (Sandbox Code Playgroud) 我想编写一个函数来阻止除数字0-9和返回键以外的任何输入,以便用户可以进行更正.我知道这类问题已被多次询问,但为什么我的代码不起作用.是否与shift键有关?为什么我得到"事件未定义"?
在代码片段中,我可以防止字母,但是像@这样的特殊字符会继续插入.为什么我收到参考错误?
// I have two functions
function formatarCPF(event, controle) {
//this line check the returned value from the functions defined below
var eNumero = permitirApenasNumeros(event.keyCode);
if (!eNumero)
event.preventDefault();
if (event.keyCode != 8) {
var valor = controle.value;
if (valor.length == 3) {
controle.value = (controle.value + ".");
}
if (valor.length == 7) {
controle.value = (controle.value + ".");
}
if (valor.length == 11) {
controle.value = (controle.value + "-");
}
}
}
if(event.keyCode != 8) {
var valor = …Run Code Online (Sandbox Code Playgroud)