我正在研究vue.js应用程序,该应用程序已经过开玩笑的测试。为了调试这些测试,我使用了此命令import random
import string
list1 = [random.choice(string.ascii_letters) + random.choice(string.ascii_letters) + random.choice(string.ascii_letters) for _ in xrange(9999)]
# len(list1) == 9999
list2 = [random.choice(string.ascii_letters) + random.choice(string.ascii_letters) + random.choice(string.ascii_letters) for _ in xrange(9999)]
# len(list2) == 9999
ref_list = [[random.choice(string.ascii_letters) + random.choice(string.ascii_letters) + random.choice(string.ascii_letters), random.choice(string.ascii_letters) + random.choice(string.ascii_letters) + random.choice(string.ascii_letters)] for _ in xrange(9999)]
# len(ref_list) == 9999
refs1 = set([t[0] for t in ref_list])
# CPU times: user 2.45 ms, sys: 348 µs, total: 2.8 ms
# Wall time: 2.2 ms
# len(refs1) == 9656 for this run
refs2 = set([t[1] for t in ref_list])
# CPU times: user 658 µs, sys: 3.92 ms, total: 4.58 ms
# Wall time: 4.02 ms
# len(refs2) == 9676 for this run
list1_filtered = [v for v in list1 if v in refs1]
# CPU times: user 1.19 ms, sys: 4.34 ms, total: 5.53 ms
# Wall time: 3.76 ms
# len(list1_filtered) == 702 for this run
list2_filtered = [v for v in list2 if v in refs2]
# CPU times: user 3.05 ms, sys: 4.29 ms, total: 7.33 ms
# Wall time: 4.51 ms
# len(list2_filtered) == 697 for this run
,并且在chrome开发工具中一切正常。
稍后,我们在项目中引入了一些环境变量以使用dotenv设置一些值(可以通过process.env访问变量),测试也可以正常运行,但是在连接调试器时,不会从{{ 1}}文件。
如何在使用Private Sub ContinueCommand_Click()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
If Not IsError(Application.Match("Target", wks.Range("A1").End(xlToRight), 0)) Then
wks.Visible = xlSheetVisible
End If
Next wks
Unload Me
End Sub
文件访问的node --inspect-brk node_modules/.bin/jest --runInBand --config test/jest.config.js
文件中描述的环境变量的vue.js项目上的chrome开发工具中运行/调试玩笑测试?
答案 0 :(得分:0)
导出.env文件内容很有帮助。运行这样的命令export $((cat .env ; cat .test.env)| grep -v "^#" | xargs) && node --inspect-brk node_modules/.bin/jest --runInBand --config test/jest.config.js
,保存导出的.env变量,并在以后运行时足以仅运行测试启动脚本node --inspect-brk node_modules/.bin/jest --runInBand --config test/jest.config.js