ava

Error: *.default is not a constructor

妖精的绣舞 提交于 2019-12-04 14:59:59
问题 I get the following error, when testing some javascript code, transpiled from a typescript file. Here is the error: Error: _mapAction2.default is not a constructor Here is the line of code that caused the error: var mapAction = new MapAction(MapActionType.POLYGONDRAGGED, []); Here is the original typescript-file map-action.ts : import { IMapAction} from './imap-action'; import { MapActionType } from './map-action-type.enum'; import {LatLngLiteral} from 'angular2-google-maps/core'; export

Problems with ava asynchronous tests when stubbing with sinon

ε祈祈猫儿з 提交于 2019-12-04 05:51:56
I have a couple of tests I'd like to run on the .then and .catch blocks of one of my dependencies. import test from 'ava'; import sinon from 'sinon'; // Fake dependency code - this would be imported const myDependency = { someMethod: () => {} }; // Fake production code - this would be imported function someCode() { return myDependency.someMethod() .then((response) => { return response; }) .catch((error) => { throw error; }); } // Test code let sandbox; test.beforeEach(() => { sandbox = sinon.sandbox.create(); }); test.afterEach.always(() => { sandbox.restore(); }); test('First async test',

Error: *.default is not a constructor

烂漫一生 提交于 2019-12-03 09:20:22
I get the following error, when testing some javascript code, transpiled from a typescript file. Here is the error: Error: _mapAction2.default is not a constructor Here is the line of code that caused the error: var mapAction = new MapAction(MapActionType.POLYGONDRAGGED, []); Here is the original typescript-file map-action.ts : import { IMapAction} from './imap-action'; import { MapActionType } from './map-action-type.enum'; import {LatLngLiteral} from 'angular2-google-maps/core'; export class MapAction implements IMapAction{ type: MapActionType; paths: Array<LatLngLiteral>; constructor

ava: SyntaxError: Unexpected token import

元气小坏坏 提交于 2019-11-30 10:53:23
So ava comes with build-in ES2015 support , which works fine for my actual test files. However, when I do import {newUser, createUser, login} from './helpers/user'; I can't use import and export in the helper file, I then get: Users/rowe/Code/fv/foxvision-api/test/api/helpers/user.js:1 (function (exports, require, module, __filename, __dirname) { import request from 'supertest'; SyntaxError: Unexpected token import I have no specific babel configuration set up as for the test files it works out of the box. Can anyone explain to me why the helper dependencies are not transpiled with babel?

ava: SyntaxError: Unexpected token import

流过昼夜 提交于 2019-11-29 16:04:41
问题 So ava comes with build-in ES2015 support, which works fine for my actual test files. However, when I do import {newUser, createUser, login} from './helpers/user'; I can't use import and export in the helper file, I then get: Users/rowe/Code/fv/foxvision-api/test/api/helpers/user.js:1 (function (exports, require, module, __filename, __dirname) { import request from 'supertest'; SyntaxError: Unexpected token import I have no specific babel configuration set up as for the test files it works

Linux Shell DAY23

六月ゝ 毕业季﹏ 提交于 2019-11-29 10:00:21
56.给文件增加内容 57.备份etc目录 58.找出重复的单词 59.人员分组 60.比较两个数大小 给文件增加内容 题目要求 在文本文档1.txt第5行(假设文件行数大于5)后面增加如下内容: # This is a test file. # Test insert line into this file. 核心要点 1.给文档指定行后面增加内容,可以用sed搞定 sed -i ‘5a12345\n56789’ 1.txt 2.比较笨的方法是,依次按顺序打印前5行,然后打印要增加的行,再从文本第6行开使一直到结束依次打印剩余的行。 代码 #!/bin/bash #这个脚本用来给文件增加行 n=0 cat 1.txt |while read line do n=$\[$n+1\] if \[ $n -eq 5 \] then echo $line echo -e "# This is a test file.\\n# Test insert line into this file." else echo $line fi done 备份etc目录 题目要求 设计一个shell程序,在每月第一天备份并压缩/etc目录的所有内容,存放在/root/bak目录里,且文件名为如下形式"yymmdd_etc.tar.gz",yy为年,mm为月,dd为日。 核心要点 1

jmeter报错ava.net.ConnectException: Connection refused (Connection refused)

倾然丶 夕夏残阳落幕 提交于 2019-11-27 20:15:32
报错信息如下: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:400) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:243) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:225) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:402) at java.base/java.net.Socket.connect(Socket.java:591) at org.apache.http.conn.scheme.PlainSocketFactory

ava中:>>>和>>区别

懵懂的女人 提交于 2019-11-27 03:20:50
>>>表示不带符号向右移动二进制数,移动后前面统统补0;两个箭头表示带符号移动, 没有<<<这种运算符,因为左移都是补零,没有正负数的区别。 如 -12 的二进制为:1111 1111 1111 1111 1111 1111 1111 0100; -12 >> 3 即带符号右移3位,结果是:1111 1111 1111 1111 1111 1111 1111 1110,十进制为: -2; -12 >>> 3 就是右移三位,前面补零,为:0001 1111 1111 1111 1111 1111 1111 1110,十进制为:536870910。 来源: https://www.cnblogs.com/linliquan/p/11341359.html