[bash] Test Fails

Viewer

copydownloadembedprintName: Test Fails
  1. $ npm test
  2. npm WARN config global `--global``--local` are deprecated. Use `--location=global` instead.
  3.  
  4. > GoNext@0.0.1 test
  5. > jest
  6.  
  7.  PASS  frontend/__tests__/ActivitySelector_test.js  
  8.  PASS  frontend/__tests__/ItineraryGenerator_test.js
  9.  FAIL  frontend/__tests__/Round_test.js
  10.   ● Test suite failed to run
  11.  
  12.     Jest encountered an unexpected token
  13.  
  14.     This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
  15.  
  16.     By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
  17.  
  18.     Here's what you can do:
  19.      • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
  20.      • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
  21.      • If you need a custom transformation specify a "transform" option in your config.
  22.      • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
  23.  
  24.     You'll find more details and examples of these config options in the docs:
  25.     https://jestjs.io/docs/en/configuration.html
  26.  
  27.     Details:
  28.  
  29.     C:\Users\Clonix\Documents\GoNext\node_modules\react-native-vector-icons\Feather.js:6
  30.     import createIconSet from './lib/create-icon-set';
  31.     ^^^^^^
  32.  
  33.     SyntaxError: Cannot use import statement outside a module
  34.  
  35.        7 |   View,
  36.        8 | } from 'react-native';
  37.     >  9 | import Feather from 'react-native-vector-icons/Feather';
  38.          | ^
  39.       10 | import Icon5 from 'react-native-vector-icons/FontAwesome5';
  40.       11 | import Icon from 'react-native-vector-icons/FontAwesome';
  41.       12 | import Swiper from 'react-native-deck-swiper';
  42.  
  43.       at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
  44.       at Object.<anonymous> (frontend/screens/Round.js:9:1)
  45.  
  46.  FAIL  frontend/__tests__/Match_test.js
  47.   ● Test suite failed to run
  48.  
  49.     Jest encountered an unexpected token
  50.  
  51.     This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
  52.  
  53.     By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
  54.  
  55.     Here's what you can do:
  56.      • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
  57.      • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
  58.      • If you need a custom transformation specify a "transform" option in your config.
  59.      • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
  60.  
  61.     You'll find more details and examples of these config options in the docs:
  62.     https://jestjs.io/docs/en/configuration.html
  63.  
  64.     Details:
  65.  
  66.     C:\Users\Clonix\Documents\GoNext\node_modules\@fortawesome\react-native-fontawesome\index.js:1
  67.     ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export { default as FontAwesomeIcon } from './dist/components/FontAwesomeIcon'
  68.                                                                                              ^^^^^^
  69.  
  70.     SyntaxError: Unexpected token 'export'
  71.  
  72.       11 | } from 'react-native';
  73.       12 | import {faMapMarkerAlt, faUtensils} from '@fortawesome/free-solid-svg-icons';
  74.     > 13 | import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome';
  75.          | ^
  76.       14 | import Icon from 'react-native-vector-icons/FontAwesome';
  77.       15 | import getStarPath from '../assets/stars/star.js';
  78.       16 | import imgStyles from '../styles/cardImage.js';
  79.  
  80.       at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
  81.       at Object.<anonymous> (frontend/cards/RoundCard.js:13:1)
  82.  
  83.  FAIL  frontend/__tests__/Home_test.js
  84.   ● Home.js tests › renders as expected
  85.  
  86.     expect(received).toMatchSnapshot()
  87.  
  88.     Snapshot name: `Home.js tests renders as expected 1`
  89.  
  90.     - Snapshot  -  3
  91.     + Received  + 43
  92.  
  93.     @@ -1,6 +1,37 @@
  94.       <View
  95.     +   accessibilityIgnoresInvertColors={true}
  96.     +   style={
  97.     +     Object {
  98.     +       "flex"1,
  99.     +     }
  100.     +   }
  101.     + >
  102.     +   <Image
  103.     +     source={
  104.     +       Object {
  105.     +         "testUri""../../../frontend/assets/stars/background.png",
  106.     +       }
  107.     +     }
  108.     +     style={
  109.     +       Array [
  110.     +         Object {
  111.     +           "bottom"0,
  112.     +           "left"0,
  113.     +           "position""absolute",
  114.     +           "right"0,
  115.     +           "top"0,
  116.     +         },
  117.     +         Object {
  118.     +           "height": undefined,
  119.     +           "width": undefined,
  120.     +         },
  121.     +         undefined,
  122.     +       ]
  123.     +     }
  124.     +   />
  125.     +   <View
  126.           style={
  127.             Object {
  128.               "flex"1,
  129.               "justifyContent""space-evenly",
  130.             }
  131.     @@ -13,21 +44,28 @@
  132.                   "color""#F15763",
  133.                   "fontFamily""CircularStd-Medium",
  134.                 },
  135.                 Object {
  136.                   "fontFamily""CircularStd-Bold",
  137.     -           "fontSize"61,
  138.     +             "fontSize"65,
  139.     +             "fontWeight""600",
  140.                   "lineHeight"82.5,
  141.                   "margin""25%",
  142.     -           "marginTop""35%",
  143.     +             "marginTop""45%",
  144.                   "textAlign""center",
  145.     +             "textShadowColor""#55443",
  146.     +             "textShadowOffset": Object {
  147.     +               "height"2,
  148.     +               "width"2,
  149.     +             },
  150.     +             "textShadowRadius"12,
  151.                   "width""50%",
  152.                 },
  153.               ]
  154.             }
  155.           >
  156.     -     Welcome to GoNext!
  157.     +       Welcome To GoNext!
  158.           </Text>
  159.           <View>
  160.             <View
  161.               accessible={true}
  162.               focusable={true}
  163.     @@ -45,10 +83,11 @@
  164.                   "borderRadius"40,
  165.                   "borderWidth"2,
  166.                   "height"45,
  167.                   "justifyContent""center",
  168.                   "margin""5%",
  169.     +             "marginTop""20%",
  170.                   "width"375,
  171.                 }
  172.               }
  173.             >
  174.               <Text
  175.     @@ -104,8 +143,9 @@
  176.                   ]
  177.                 }
  178.               >
  179.                 Restaurant Swiping
  180.               </Text>
  181.     +       </View>
  182.           </View>
  183.         </View>
  184.       </View>
  185.  
  186.       12 |     it('renders as expected'() => {
  187.       13 |         const homerender = renderer.create(<Home></Home>).toJSON()
  188.     > 14 |         expect(homerender).toMatchSnapshot()
  189.          |                            ^
  190.       15 |     })
  191.       16 | })
  192.  
  193.       at Object.<anonymous> (frontend/__tests__/Home_test.js:14:28)
  194.  
  195.  › 1 snapshot failed.
  196.  
  197. ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
  198.  
  199.       39 |
  200.       40 | const tagsDiet = ['Vegan''Vegetarian'];
  201.     > 41 |
  202.          | ^
  203.       42 | const tagsRound = ['10''20''30''40''50'];
  204.       43 |
  205.       44 | const date = new Date();
  206.  
  207.       at Object.get PermissionsAndroid [as PermissionsAndroid] (node_modules/react-native/index.js:188:12)
  208.       at frontend/screens/RestaurantFilters.js:41:32
  209.       at tryCallOne (node_modules/promise/lib/core.js:37:12)
  210.       at node_modules/promise/lib/core.js:123:15
  211.       at flush (node_modules/asap/raw.js:50:29)
  212.  
  213.   ●  Cannot log after tests are done. Did you forget to wait for something async in your test?
  214.     Attempted to log "ERROR: could not process request for location".
  215.  
  216.       45 |
  217.       46 | //  requests the users permission
  218.     > 47 | const requestLocationPermission = async () => {
  219.          |               ^
  220.       48 |   PermissionsAndroid.request(
  221.       49 |     PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
  222.       50 |     {
  223.  
  224.       at console.log (node_modules/@jest/console/build/BufferedConsole.js:197:10)
  225.       at frontend/screens/RestaurantFilters.js:47:15
  226.       at tryCallOne (node_modules/promise/lib/core.js:37:12)
  227.       at node_modules/promise/lib/core.js:123:15
  228.       at flush (node_modules/asap/raw.js:50:29)
  229.  
  230.  PASS  frontend/__tests__/RestaurantFilters_test.js
  231.   ● Console
  232.  
  233.     console.warn
  234.       "PermissionsAndroid" module works only for Android platform.
  235.  
  236.       at PermissionsAndroid.<anonymous> (node_modules/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js:230:15)
  237.       at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
  238.       at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
  239.       at node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:7
  240.       at tryCallTwo (node_modules/promise/lib/core.js:45:5)
  241.       at doResolve (node_modules/promise/lib/core.js:200:13)
  242.       at new Promise (node_modules/promise/lib/core.js:66:3)
  243.  
  244.  FAIL  backend/__tests__/yelpQuery_test.js
  245.   ● POST /restaurants › should not return a list of restaurants if no location provided
  246.  
  247.     expect(received).toBe(expected) // Object.is equality
  248.  
  249.     Expected: "Error getting restaurants: provide a location parameters"
  250.     Received: "Error getting restaurants: provide location parameters"
  251.  
  252.       31 |     const res = await request(baseURL).post("/restaurants").send({});
  253.       32 |     expect(res.statusCode).toBe(500);
  254.     > 33 |     expect(res.body.message).toBe("Error getting restaurants: provide a location parameters")
  255.          |                              ^
  256.       34 |   });
  257.       35 |   it("should not return a list of restaurants if bad params provided", async () => {
  258.       36 |     const badParams = {
  259.  
  260.       at Object.<anonymous> (backend/__tests__/yelpQuery_test.js:33:30)
  261.       at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
  262.       at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
  263.       at tryCallOne (node_modules/promise/lib/core.js:37:12)
  264.       at node_modules/promise/lib/core.js:123:15
  265.       at flush (node_modules/asap/raw.js:50:29)
  266.  
  267. Snapshot Summary
  268.  › 1 snapshot failed from 1 test suite. Inspect your code changes or run `npm test -- -u` to update them.
  269.  
  270. Test Suites: 4 failed, 3 passed, 7 total
  271. Tests:       2 failed, 12 passed, 14 total
  272. Snapshots:   1 failed, 1 passed, 2 total
  273. Time:        3.11 s
  274. Ran all test suites.

Editor

You can edit this paste and save as new:


File Description
  • Test Fails
  • Paste Code
  • 02 Dec-2022
  • 10.45 Kb
You can Share it: