2017-05-30 3 views
0

J'utilise Intern 4.0 (Oui, je sais, c'est une version alpha, mais je veux réécrire mon code et mes tests unitaires en es6).Intern 4: Impossible d'exécuter la suite de tests

J'ai installé le paquetage npm "intern 4.0.0-alpha.4", j'ai réécrit le code, les tests unitaires et la suite en es6.

Mais je suis incapable d'exécuter des tests. Je veux exécuter des tests des scripts NPM: J'édité mon fichier package.json pour obtenir:

"scripts": { 
    "test": "node_modules/.bin/intern" 
} 

Je suis aussi essayé avec:

"scripts": { 
    "test": "node_modules/.bin/intern config=intern.json" 
} 

ou inter-cli:

"scripts": { 
    "test": "intern run --config intern.json" 
} 

Puis-je exécuter la commande npm run test

ici le fichier journal:

0 info it worked if it ends with ok 
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 
1 verbose cli 'C:\\Users\\admin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 
1 verbose cli 'run', 
1 verbose cli 'test' ] 
2 info using [email protected] 
3 info using no[email protected] 
4 verbose run-script [ 'pretest', 'test', 'posttest' ] 
5 info lifecycle [email protected]~pretest: [email protected] 
6 silly lifecycle [email protected]~pretest: no script for pretest, continuing 
7 info lifecycle [email protected]~test: [email protected] 
8 verbose lifecycle [email protected]~test: unsafe-perm in lifecycle true 
9 verbose lifecycle [email protected]~test: PATH: ... 
10 verbose lifecycle [email protected]~test: CWD: D:\Temp\myproject 
11 silly lifecycle [email protected]~test: Args: [ '/d /s /c', 'intern config=intern.json' ] 
12 silly lifecycle [email protected]~test: Returned: code: 1 signal: null 
13 info lifecycle [email protected]~test: Failed to exec test script 
14 verbose stack Error: [email protected] test: `intern config=intern.json` 
14 verbose stack Exit status 1 
14 verbose stack  at EventEmitter.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at EventEmitter.emit (events.js:191:7) 
14 verbose stack  at ChildProcess.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at ChildProcess.emit (events.js:191:7) 
14 verbose stack  at maybeClose (internal/child_process.js:886:16) 
14 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
15 verbose pkgid [email protected] 
16 verbose cwd D:\Temp\myproject 
17 verbose Windows_NT 10.0.14393 
18 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\admin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test" 
19 verbose node v6.10.3 
20 verbose npm v4.4.4 
21 error code ELIFECYCLE 
22 error errno 1 
23 error [email protected] test: `intern config=intern.json` 
23 error Exit status 1 
24 error Failed at the [email protected] test script 'intern config=intern.json'. 
24 error Make sure you have the latest version of node.js and npm installed. 
24 error If you do, this is most likely a problem with the myproject package, 
24 error not with npm itself. 
24 error Tell the author that this fails on your system: 
24 error  intern config=intern.json 
24 error You can get information on how to open an issue for this project with: 
24 error  npm bugs myproject 
24 error Or if that isn't available, you can get their info via: 
24 error  npm owner ls myproject 
24 error There is likely additional logging output above. 
25 verbose exit [ 1, true ] 

Vous avez une idée?

Répondre

1

Vous pouvez utiliser

"scripts": { 
    "test": "intern" 
} 

Parce que intern est un script bin node_modules/.bin, vous n'avez pas besoin d'utiliser node_modules/.bin dans package.json.

Juste pour vérifier, vous pouvez essayer d'exécuter

node node_modules\.bin\intern 

stagiaire doit exécuter les suites que vous avez configurés dans intern.json.

+0

Oui, je l'utilise avec le '4.0.0-alpha.5'. Mais 'npm run test' échoue avec' Feature ', l'object-assign "exists et overwrite not true.'. J'ai essayé sans suite de tests et j'ai la même erreur. Je ne trouve pas pourquoi! – Troopers

+0

Cela ressemble plus à un problème de chargement du testeur plutôt que de vos suites en particulier. À quoi ressemble votre 'intern.json'? Que fait le stagiaire si vous supprimez votre intern.json et que vous l'exécutez? – jason0x43

+0

seulement: '{ \t "plugins": "node_modules/babel-register/lib/Node.js", \t "suites": "tests/unité/test.js" }' J'ai la même erreur quel que soit le contenu du fichier intern.json – Troopers