Git Product home page Git Product logo

Comments (11)

pemulis avatar pemulis commented on May 27, 2024 3

Here's what I changed in package.json to get the test to pass:

Line 76
"<rootDir>/config/polyfills.js"

Lines 85-86
"^.+/.css$": "<rootDir>/config/jest/cssTransform.js",

"^(?!.*/.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"

I was still getting a "Cannot find module" error until I added to those lines.

from drizzle-box.

drjiro avatar drjiro commented on May 27, 2024

HI, I also try it on Mac. If you try it on not Windows, It may occur for Win32 file system, so that change from "\" to "/". Modify the following lines in 'package.json'.

line 76
"/config/polyfills.js"

line 85-86
"^.+\.css$": "/config/jest/cssTransform.js",
"^(?!.*\.(js|jsx|css|json)$)": "/config/jest/fileTransform.js"

I will pass the test. However, I cannot run it on Chrome by another problem.

from drizzle-box.

pemulis avatar pemulis commented on May 27, 2024

I have the same error as @johngriffin, and got past it by changing just line 76 of package.json:

"<rootDir>/config/polyfills.js"

But now I have a new error:

FAIL  src/App.test.js
● Test suite failed to run

Your test suite must contain at least one test.
  
  at onResult (node_modules/jest/node_modules/jest-cli/build/TestRunner.js:189:18)
      at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:160:7)

Working on debugging that!

from drizzle-box.

pemulis avatar pemulis commented on May 27, 2024

Part of the problem might be that I still had my local test server running while trying to reinstall my node modules. (I had run npm run start in a different Terminal tab.) So I rebooted that, deleted my node_modules/ directory, and reinstalled.

Getting this error now, which leads me to believe I need to change more lines in package.json, as @drjiro suggested:

   FAIL  src/App.test.js
    ● Test suite failed to run

Cannot find module '/Users/j/Coding/cryptokittybox/\config\jest\cssTransform.js'
  
  at Function.Module._resolveFilename (module.js:555:15)
  at Function.Module._load (module.js:482:25)
  at Module.require (module.js:604:17)
  at require (internal/module.js:11:18)

  Test Suites: 1 failed, 1 total
  Tests:       0 total
  Snapshots:   0 total
  Time:        1.673s
  Ran all test suites.

from drizzle-box.

am17torres avatar am17torres commented on May 27, 2024

I'm on OS X Sierra using Visual Studio Code 1.21.1

@pemulis, are you sure your snippet is correct?
Shouldn't "^.+/.css$" actually be "^.+\\.css$"
And the same for "^(?!.*/.(js|jsx|css|json)$)": -> "^(?!.*\\.(js|jsx|css|json)$)":

Doing that got rid of the error Your test suite must contain at least one test. In src/App.test.js and scripts/test.js.

Update 1:

  • Bumped jest and babel-jest to 22.4.1 because the VS Code jest extension was complaining.

screen shot 2018-03-26 at 12 25 09 am

Now I'm getting SyntaxError: Identifier 'jest' has already been declared. Not sure if that is the result of bumping the version which is probably unrelated to this issue. Jest@18 is running the test.js as a test per the comment here

Had to include scripts in the testPathIgnorePatterns block.

"testPathIgnorePatterns": [
    "<rootDir>/(build|docs|node_modules|scripts)"
],

Update 2:

The latest VS Code error is [Jest] ReferenceError: document is not defined despite the package.json script test including --env=jsdom. Again unrelated to this project itself since the test technically passes, but I'll capture any findings for those using the same editor.

FIx: replace testEnvironment from node to jsdom

Complete package.json

{
  "name": "drizzle-box",
  "version": "1.0.0",
  "devDependencies": {
    "autoprefixer": "6.5.1",
    "babel-core": "6.17.0",
    "babel-eslint": "7.1.1",
    "babel-jest": "22.4.1",
    "babel-loader": "6.2.7",
    "babel-preset-react-app": "^2.0.1",
    "case-sensitive-paths-webpack-plugin": "1.1.4",
    "chalk": "1.1.3",
    "connect-history-api-fallback": "1.3.0",
    "cross-spawn": "4.0.2",
    "css-loader": "0.26.0",
    "detect-port": "1.0.1",
    "dotenv": "2.0.0",
    "drizzle": "^1.0.1",
    "drizzle-react": "^1.0.1",
    "drizzle-react-components": "^1.0.1",
    "eslint": "3.8.1",
    "eslint-config-react-app": "^0.5.0",
    "eslint-loader": "1.6.0",
    "eslint-plugin-flowtype": "2.21.0",
    "eslint-plugin-import": "2.0.1",
    "eslint-plugin-jsx-a11y": "2.2.3",
    "eslint-plugin-react": "6.4.1",
    "extract-text-webpack-plugin": "1.0.1",
    "file-loader": "0.9.0",
    "filesize": "3.3.0",
    "fs-extra": "0.30.0",
    "gzip-size": "3.0.0",
    "html-webpack-plugin": "2.24.0",
    "http-proxy-middleware": "0.17.2",
    "jest": "22.4.1",
    "json-loader": "0.5.4",
    "object-assign": "4.1.0",
    "path-exists": "2.1.0",
    "postcss-loader": "1.0.0",
    "promise": "7.1.1",
    "react-dev-utils": "^0.4.2",
    "recursive-readdir": "2.1.0",
    "strip-ansi": "3.0.1",
    "style-loader": "0.13.1",
    "truffle-contract": "^1.1.8",
    "truffle-hdwallet-provider": "0.0.3",
    "url-loader": "0.5.7",
    "webpack": "1.14.0",
    "webpack-dev-server": "1.16.2",
    "webpack-manifest-plugin": "1.1.0",
    "whatwg-fetch": "1.0.0",
    "zeppelin-solidity": "^1.6.0"
  },
  "dependencies": {
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-redux": "^5.0.2",
    "react-router": "^3.0.2",
    "react-router-redux": "^4.0.7",
    "redux": "^3.6.0",
    "redux-auth-wrapper": "^1.0.0",
    "redux-saga": "^0.15.3",
    "redux-thunk": "^2.2.0"
  },
  "scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",
    "test": "node scripts/test.js --env=jsdom",
    "chain": "geth --datadir=\"/tmp/eth/60/01\" --nodiscover --maxpeers 0 --port 30301 --rpc --rpcapi \"db,eth,net,web3\" --rpcport 8101 --verbosity 6 console"
  },
  "jest": {
    "collectCoverageFrom": [
      "<rootDir>/src/**/*.{js,jsx}"
    ],
    "setupFiles": [
      "<rootDir>/config/polyfills.js"
    ],
    "testPathIgnorePatterns": [
      "<rootDir>/(build|docs|node_modules|scripts)"
    ],
    "testEnvironment": "jsdom",
    "testURL": "http://localhost",
    "transform": {
      "^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
      "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
      "^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
    },
    "transformIgnorePatterns": [
      "node_modules/.+\\.(js|jsx)$"
    ],
    "moduleNameMapper": {
      "^react-native$": "react-native-web"
    }
  },
  "babel": {
    "presets": [
      "react-app"
    ]
  },
  "eslintConfig": {
    "extends": "react-app"
  }
}

from drizzle-box.

stale avatar stale commented on May 27, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from drizzle-box.

JakeGlascock avatar JakeGlascock commented on May 27, 2024

Had a clean unbox of drizzle. I get 'ReferenceError: [BABEL] /apps/drizzle01202019/app/src/App.test.js: Unknown option: base.configFile. Check out http://babeljs.io/docs/usage/options/ for more information about options.' at the
npm run test
step.

Using nvm to use v11.7.0 of node, npm v6.5.0.

After much research (doge style), I found a solution.

truffle unbox must use npm and not yarn as facebook/create-react-app#5259 was the error I was getting. This solution suggested using yarn as

as it's reportedly correctly hoisting packages

So after unboxing, I deleted the app/node_modules directory and re-installed from the app directory with

yarn install

Yarn v1.13.0

After that, the out of the box test that comes with the drizzle box passed using

yarn run test

from drizzle-box.

adrianmcli avatar adrianmcli commented on May 27, 2024

@JakeGlascock thanks for commenting and letting us know the workaround. But unfortunately, we can't expect our users to have Yarn installed. It's likely that this will remain broken until NPM or Babel fixes things.

from drizzle-box.

JakeGlascock avatar JakeGlascock commented on May 27, 2024

@adrianmcli Fair enough. Just wanted to make sure I helped out as I am excited about the Truffle/Drizzle combo and looking forward to all the great things it will be used to do.

from drizzle-box.

stale avatar stale commented on May 27, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from drizzle-box.

stale avatar stale commented on May 27, 2024

This issue has been closed, but can be re-opened if further comments indicate that the problem persists. Feel free to tag maintainers if there is no reply to further comments.

from drizzle-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.