2
私は反応物質、特にスナップショットについてJestを試験しています。これは私のテストで:Jestエラー:テストスイートを実行できませんでした。解決方法は?
import React, { Component } from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import Hello from 'hello';
test('if am then return goodmorning',() => {
const wrapper = shallow(
<Hello timeofday="am">
<strong>Hello World!</strong>
</Hello>
);
expect(toJson(wrapper)).toMatchSnapshot();
});
私がテストしていコンポーネント:
import React from 'react';
export default class Hello extends React.Component {
constructor(props) {
super();
this.props = props;
//todo remove
console.log('testing props', props);
}
render() {
let greet ;
if (this.props) {
greet= this.props.timeofday ==='am' ? 'morning' : 'evening'
}
return <h1>Good {greet}</h1>
}
}
を、私はコマンドラインから冗談を実行すると、私はこのエラーを取得:
jest
FAIL app/components/hello.test.js
● Test suite failed to run
Cannot find module 'hello' from 'hello.test.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
at Object.<anonymous> (app/components/hello.test.js:4:14)
Test Suites: 1 failed, 1 total
なぜ私は実行することはできません冗談?ここの問題は何ですか?テストファイルで