2016-11-22 1 views
0

Essayer de tester mangouste: https://github.com/Automattic/mongoosemangouste lorsqu'une erreur se la version changement ne peut lire la propriété « remplacer » undefined

Lorsque j'ai changé version de noeud du npm.cmd « run-script » « test » ne travail et me donne le message:

C:\2016\IT\nb\M11\22\mongoose\test\connection.test.js:145 
var repl2 = repl1.replace('mongodb://', '').split(','); 
       ^

Voici ce que je reçois:

"C:\Program Files\nodejs\npm.cmd" "run-script" "test" 

> [email protected] test C:\2016\IT\nb\M11\21\mongoose 
> mocha test/*.test.js test/**/*.test.js 

C:\2016\IT\nb\M11\21\mongoose\test\connection.test.js:145 
    var repl2 = repl1.replace('mongodb://', '').split(','); 
       ^

TypeError: Cannot read property 'replace' of undefined 
    at Suite.<anonymous> (C:\2016\IT\nb\M11\21\mongoose  \test\connection.test.js:145:22) 
    at Object.create (C:\2016\IT\nb\M11\21\mongoose\node_modules\mocha\lib\interfaces\common.js:114:19) 
    at context.describe.context.context (C:\2016\IT\nb\M11\21\mongoose\node_modules\mocha\lib\interfaces\bdd.js:44:27) 
    at Suite.<anonymous> (C:\2016\IT\nb\M11\21\mongoose\test\connection.test.js:136:3) 
    at Object.create (C:\2016\IT\nb\M11\21\mongoose\node_modules\mocha\lib\interfaces\common.js:114:19) 
    at context.describe.context.context (C:\2016\IT\nb\M11\21\mongoose\node_modules\mocha\lib\interfaces\bdd.js:44:27) 
    at Object.<anonymous> (C:\2016\IT\nb\M11\21\mongoose\test\connection.test.js:16:1) 
    at Module._compile (module.js:570:32) 
    at Object.Module._extensions..js (module.js:579:10) 
    at Module.load (module.js:487:32) 
    at tryModuleLoad (module.js:446:12) 
    at Function.Module._load (module.js:438:3) 
    at Module.require (module.js:497:17) 
    at require (internal/module.js:20:19) 
    at C:\2016\IT\nb\M11\21\mongoose\node_modules\mocha\lib\mocha.js:222:27 
    at Array.forEach (native) 

npm ERR! Windows_NT 10.0.10586 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mircea\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "test" 
npm ERR! node v6.9.1 
npm ERR! npm v3.10.8 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] test: `mocha test/*.test.js test/**/*.test.js` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] test script 'mocha test/*.test.js test/**/*.test.js'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the mongoose package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  mocha test/*.test.js test/**/*.test.js 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs mongoose 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls mongoose 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\2016\IT\nb\M11\21\mongoose\npm-debug.log 
Done. 

TypeError: Cannot read property 'replace' of undefined 

Avant d'installer le noeud-v6.9.1

"C:\Program Files\nodejs\npm.cmd" "run-script" "test" 

> [email protected] test C:\2016\IT\nb\M11\21\mongoose 
> mocha test/*.test.js test/**/*.test.js 

Not testing multi-mongos support 

You're not testing shards! 
Please set the MONGOOSE_SHARD_TEST_URI env variable. 
e.g: `mongodb://localhost:27017/database 
Sharding must already be enabled on your database 


(node:11752) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ..... 
You're not testing replica sets! 
Please set the MONGOOSE_SET_TEST_URI env variable. 
e.g: `mongodb://localhost:27017/db,localhost…` 

.................................!................. 
(node:11752) DeprecationWarning: Mongoose: Query.prototype.stream() is deprecated in mongoose >= 4.5.0, use Query.prototype.cursor() instead 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    !....................................................... 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ........................................................ 
    ............................. 

    1651 passing (2m) 
    2 failing 

    1) model create() creates in parallel: 
    Error: timeout of 1000ms exceeded. Ensure the done() callback is being called in this test. 


    2) query stream: pipe: 
    Uncaught Error: ENOENT: no such file or directory, open 'C:\tmp\_mongoose_stream_out.txt' 




Done. 

npm ERR! Windows_NT 10.0.10586 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mircea\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "test" 
npm ERR! node v7.1.0 
npm ERR! npm v3.10.8 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] test: `mocha test/*.test.js test/**/*.test.js` 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the [email protected] test script 'mocha test/*.test.js test/**/*.test.js'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the mongoose package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  mocha test/*.test.js test/**/*.test.js 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs mongoose 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls mongoose 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\2016\IT\nb\M11\21\mongoose\npm-debug.log 

J'ai été en mesure d'exécuter le test après avoir abandonné la base de données en utilisant Robomongo.

je reçois: 1652 passant (3m) 3 ne

+0

Où est votre connexion mongodb uri? – hyades

Répondre

0

ligne 144 de connexion code définit repl1 comme process.env.MONGOOSE_SHARD_TEST_URI signifie la variable d'environnement n'est pas définie. Il doit être réglé sur l'uri pour l'échantillon de mongo testé.

Il ressemble à votre dans Windows, et vous pouvez le faire en définissant les variables d'environnement pour fournir au nœud les informations dont il a besoin pour fonctionner dans l'environnement sélectionné. MONGOOSE_SHARD_TEST_URI = yourURI node connection.test.js - Voir plus here

+0

J'ai eu cet environnement et avant d'installer node-v6.9.1 il me demande de définir MONGOOSE_SHARD_TEST_URI; Je l'ai fait et ça marche je pense. – MToma

+0

J'ai été en mesure d'exécuter un test après avoir laissé tomber la base de données en utilisant Robomongo Je reçois: 1652 passant (3m) 3 défaillant – MToma