Sto utilizzando Karma e PhantomJS con Jasmine per testare il mio AngularJS. Quando eseguo il mio test di gulp localmente funziona, lancia PhantomJS e faccio tutti i miei test, ma quando i test vengono eseguiti sul server di build falliscono con i seguenti errori:PhantomJS non acquisito quando viene eseguito tramite il build server
Nota che sto usando VSTS e sto usando il loro costruito nel sistema di cloud build (agente ospitato). Dopo aver detto che la sua più o meno un corridore compito e io uso solo per eseguire compiti gulp (costruire, testare, ecc) su checkin
[32m13 07 2016 15:21:32.260:INFO [karma]: [39mKarma v1.1.1 server started at http://localhost:9876/
[32m13 07 2016 15:21:32.262:INFO [launcher]: [39mLaunching browser PhantomJS with unlimited concurrency
[32m13 07 2016 15:21:32.284:INFO [launcher]: [39mStarting browser PhantomJS
[33m13 07 2016 15:22:32.285:WARN [launcher]: [39mPhantomJS have not captured in 60000 ms, killing.
[33m13 07 2016 15:22:34.287:WARN [launcher]: [39mPhantomJS was not killed in 2000 ms, sending SIGKILL.
[33m13 07 2016 15:22:36.288:WARN [launcher]: [39mPhantomJS was not killed by SIGKILL in 2000 ms, continuing.
mio Karma config è:
var configuration = {
basePath: "",
files: listFiles(),
singleRun: true,
autoWatch: false,
//usePolling: true,
//transports: ["xhr-polling", "jsonp-polling"],
frameworks: ["jasmine", "angular-filesort"],
angularFilesort: {
whitelist: [path.join(conf.paths.src, "/**/!(*.html|*.spec|*.mock).js")]
},
ngHtml2JsPreprocessor: {
stripPrefix: "src/",
moduleName: "veriApp"
},
browsers: ["PhantomJS"],
//browsers: ["Chrome"],
plugins: [
"karma-chrome-launcher",
"karma-phantomjs-launcher",
"karma-angular-filesort",
"karma-jasmine",
"karma-ng-html2js-preprocessor"
],
preprocessors: {
"src/**/*.html": ["ng-html2js"]
}
};
Qui ci sono le parti pertinenti del mio package.json. Si noti che un NPM installazione viene eseguita prima che il test viene eseguito
"karma": "1.1.1",
"karma-angular-filesort": "1.0.0",
"karma-jasmine": "1.0.2",
"karma-ng-html2js-preprocessor": "1.0.0",
"phantomjs-prebuilt": "2.1.4",
"karma-phantomjs-launcher": "1.0.0",
"karma-chrome-launcher": "1.0.1",
Ho provato base del parere di varie risposte riguardo a questo, ma nessuno sembra funzionare! Forse mi manca qualcosa?
Anche se non ho idea di cosa sia la maggior parte di questo, sono propenso a chiedere se il server remoto ha installato PhantomJS e se è accessibile tramite il PATH dell'utente in esecuzione. – apokryfos
@apokryfos Dovrebbe fare, ho impostato i miei moduli npm per includere 'phantom-prebuilt' - aggiornerò la mia domanda con le parti rilevanti del mio pacchetto.json – Chris
PhantomJS tenta di avviare un processo interattivo? È così che l'agente di build VSTS non è autorizzato a farlo. –