嗨,我正在尝试运行一个简单的量角器测试(protracotor的新手),但是我一直收到此错误。下面是我的package.json
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.8",
"@angular/cli": "~8.3.8",
"@angular/compiler-cli": "~8.2.9",
"@angular/language-service": "~8.2.9",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "12.12.7",
"codelyzer": "^5.0.0",
"husky": "^3.0.9",
"jasmine-core": "~3.4.0",
"jasmine-reporters": "^2.3.2",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-junit-reporter": "^2.0.1",
"protractor": "~5.4.0",
"puppeteer": "^2.0.0",
"ts-node": "~7.0.0",
"tslint": "^5.15.0",
"typescript": "~3.6.4"
}
答案 0 :(得分:10)
就我而言,问题是由于组件中的错误导入造成的。
我写错了
Server says: Hello client
Enter something for the server: hi
Client says: hi
而不是在导入下面写:
import { EventEmitter } from 'protractor';
答案 1 :(得分:5)
似乎存在兼容性问题:https://github.com/angular/protractor/issues/5348
我已通过将打字稿从3.7.X降级到 3.6.2 来解决此问题
答案 2 :(得分:1)
如果您不想降级,则可以通过以下方式修复导入(量角器5.4.2):
@Entity
@Table(name ="TRACK")
public class Track {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "TRACK_ID")
private Long trackId;
private String trackName;
@OneToMany(cascade = CascadeType.ALL,
orphanRemoval = true)
@JoinColumn(name = "POINT_ID")
private List<Point> point;
@OneToOne
@JoinColumn(name="TRACK_STATISTIC_ID")
private TrackStatistic trackStatistic;
private long numberOfLikes;
private Date creationTime;
基本上,有一个伪造的进口,我们需要摆脱。随附有补丁程序:
@Entity
@Table(name = "USER")
public class User {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "USER_ID")
private Long userId;
private String firstName;
private String lastName;
@Column(unique = true)
private String username;
private String password;
@Column(unique = true)
private String email;
@Column(unique = true)
private String phoneNumber;
private int age;
private Role role;
private boolean locked;
private long numberOfReports;
@JsonIgnore
@ManyToMany()
@JoinTable(name="FOLLOWER",
joinColumns={@JoinColumn(name="USER_ID")},
inverseJoinColumns={@JoinColumn(name="FOLLOWER_ID")})
private Set<User> followed = new HashSet<User>();
@JsonIgnore
@ManyToMany(mappedBy="followed")
private Set<User> follower = new HashSet<User>();
//How it was before
@OneToMany
@JoinColumn(name = "TRACK_ID")
private List<Track> tracks;
//How is it now
@OneToMany
@JoinColumn(name = "USER_ID")
private List<Track> tracks;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "SHARE_ID")
private List<Share> shares;