Level-Up-JavaScript-Testing-101
Level-Up-JavaScript-Testing-101 copied to clipboard
Import
I have been successful following tests on 1st and 2nd video, but kept on getting FAIL src/App.test.js ● Test suite failed to run on 3rd video.
App.js:
export const add = (x,y) => {
return x+y;
};
App.test.js:
import { add } from './App';
Terminal:
FAIL src/App.test.js
● Test suite failed to run
/Users/nunut/Sites/Level-Up-JavaScript-Testing-101/src/App.test.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { add } from './App';
^
SyntaxError: Unexpected token {
at ScriptTransformer._transformAndBuildScript (node_modules/jest/node_modules/jest-cli/node_modules/jest-runtime/build/script_transformer.js:316:17)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 23.953s
Ran all test suites.
Environment: NPM version: 6.4.1 Node version: 11.2.0 OS: MacOS High Sierra
Try adding babel-jest npm i babel-jest -D.