小编ife*_*ins的帖子

为gulp/knex创建/删除数据库任务

我有一个Express.js Web应用程序,它使用Knex.js作为SQL查询构建器和迁移引擎.虽然Knex.js具有创建,删除和更改表的方法,但它没有创建/删除数据库本身的方法.

我想知道是否有Knex.js的扩展,甚至是允许你创建/删除数据库的gulp任务.我找不到任何东西.我正在使用PostgreSQL数据库.

database migration express knex.js gulp

13
推荐指数
2
解决办法
1万
查看次数

无法在Xcode 6 Beta 5上运行测试

我有一个使用Kiwi测试框架的iOS项目(我从cocoapods安装的最新版本2.3.0).首先,当我运行测试时,我收到一个错误,它无法找到XCTest.h.所以我按照这个答案的建议:https://stackoverflow.com/a/24651704/1082326,问题就消失了.

但是出现了一个不同的问题,现在当我尝试运行测试时,选择的模拟器是"iPhone 5(8.0)",然后我收到以下错误:

IDEBundleInjection.c: Error 3587 loading bundle
'/Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/teacup-tests.octest': 
The bundle “teacup-tests.octest” couldn’t be loaded because it is damaged or missing 
necessary resources.
DevToolsBundleInjection environment:
XCInjectDiagnostics: (null)
XCInjectBundleInto: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup- 
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/valet.app/valet
XCInjectBundle: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/teacup-tests.octest
TestBundleLocation: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/teacup-tests.octest
TMPDIR: /Users/ifeins/Library/Developer/CoreSimulator/Devices/BC59F7AC-9D3E-4FFC-9726-
97911AA597A6/data/Containers/Data/Application/E1D4A3F0-C06B-485D-BF87-9F5EA70D974A/tmp
DYLD_LIBRARY_PATH: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator
DYLD_INSERT_LIBRARIES: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFra
meworks/IDEBundleInjection.framework/IDEBundleInjection
DYLD_FRAMEWORK_PATH: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator
DYLD_FALLBACK_LIBRARY_PATH: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulat
or8.0.sdk/usr/lib
DYLD_FALLBACK_FRAMEWORK_PATH: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Developer/Library/Frameworks
Run Code Online (Sandbox Code Playgroud)

你知道这可能是什么问题吗?

提前谢谢,Ido

testing ios kiwi xcode6

9
推荐指数
1
解决办法
3399
查看次数

在 Jest 测试环境中使用 jest

我创建了一个 Jest 测试环境,在其中模拟特定模块:

const NodeEnvironment = require('jest-environment-node');
const { lumigo } = require('../../src/services/lumigo');

class TestEnvironment extends NodeEnvironment {
  async setup() {
    await super.setup();
    jest.mock('../../src/services/lumigo');
    lumigo.trace = jest.fn((func) => func);
  }

  async teardown() {
    await super.teardown();
  }

  getVmContext() {
    return super.getVmContext();
  }
}

module.exports = TestEnvironment;
Run Code Online (Sandbox Code Playgroud)

我将我的测试配置为使用此测试环境,如下所示:

/**
 * @jest-environment ./tests/test-environment.js
 */

... rest of the test
Run Code Online (Sandbox Code Playgroud)

但是,当我运行测试时,出现以下错误:

ReferenceError: jest is not defined
Run Code Online (Sandbox Code Playgroud)

如果在我的测试环境文件的顶部我尝试添加:

const jest = require('jest');
Run Code Online (Sandbox Code Playgroud)

我收到警告,Jest is automatically in scope. Do not import "jest", as Jest doesn't …

javascript unit-testing jestjs

7
推荐指数
1
解决办法
742
查看次数