反应本机排毒模拟文件

时间:2019-03-18 14:42:08

标签: react-native detox

请有人告诉我模拟文件如何响应本机排毒测试吗?我关注this article

我使用的是本机反应版本0.57.7和排毒9.1.2

我在根目录中创建了rn-cli.config.js

const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts
module.exports = {
  resolver: { 
    sourceExts: process.env.RN_SRC_EXT
                ? process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts)
                : defaultSourceExts
  }
};

我在带有e2e扩展名的生产文件旁边创建了模拟文件 enter image description here

然后我使用命令运行Metro(我正在使用Windows Powershel 6)

$env:RN_SRC_EXT="e2e.ts";react-native start
react-native run-android

没什么,实际上什么都没有改变/嘲笑

我也尝试过构建并运行排毒

cd android;$env:ENVFILE="../config/default/env";gradle assembleDebug assembleAndroidTest -DtestBuildType=debug;cd ..
detox test -c android.emu.debug.win

但是什么也没发生,我删除了所有的node_modules,android build文件夹,但是没有效果。

我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

您的class Bag<Item> implements Iterable<Item> { private Node first; private class Node { Item item; Node next; } public void add(Item item) { Node oldfirst = first; first = new Node(); first.item = item; first.next = oldfirst; } public Iterator<Item> iterator() { return new ListIterator(); } private class ListIterator implements Iterator<Item> { private Node current = first; public boolean hasNext() { return current != null; } public void remove() {} public Item next() { Item item = current.item; current = current.next; return item; } } public static void main(String[] args) { Bag<Integer> a = new Bag(); a.add(5); a.add(10); for (int w : a) { System.out.println(w.iterator()); } } } 文件正确,但请尝试将其添加到排毒rn-cli.config.js

e2e/config.json

我的是这样的

"testMatch": ["**/__tests__/**/*.js?(x)", "**/?(*.)(e2e).js?(x)"]

我使用的是本机反应版本0.59.8和排毒12.10.2

在使用打字稿时,然后输入

{
    "setupFilesAfterEnv": ["./init.js"],
    "testEnvironment": "node",
    "reporters": ["detox/runners/jest/streamlineReporter"],
    "testMatch": ["**/__tests__/**/*.js?(x)", "**/?(*.)(e2e).js?(x)"],
    "verbose": true
}

带有ts扩展名

相关问题