Comments (11)
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.
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.
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.
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.
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
andbabel-jest
to 22.4.1 because the VS Code jest extension was complaining.
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.
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.
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.
@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.
@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.
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.
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)
- README is inconsistent with new repositories HOT 2
- 缺少ERC20合约 HOT 3
- Box won't run HOT 5
- Issue when running 'npm install' in app directory HOT 3
- sha3 error on widows machine HOT 2
- Unbox drizzle unsuccessful HOT 2
- dewed.eth
- 'npm run test' fails after unbox HOT 3
- Can't unbox on CI environments HOT 1
- home.bak.js file is not working and should be removed HOT 2
- SyntaxError: Unexpected token function HOT 3
- Error: EISDIR: illegal operation on a directory, readlink HOT 1
- uncaught at getAccounts Error: Please pass numbers as strings or BigNumber objects to avoid precision errors.
- Make it work with drizzle-react-components 1.2.1 HOT 3
- Update to use React Context API HOT 2
- NPM (6.5.0) causes - uncaught at root at root error HOT 6
- Contract not found on network ID HOT 2
- npm install with app directory fails for Drizzle HOT 1
- MM friendly truffle-config doesn't work as is HOT 1
- npm test fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drizzle-box.