I build and deploy my site to a test server (AWS S3), then hit it with Selenium tests before deploying to the prod server. I call a weather API that only allows me a certain number of calls on the free tier. I would like for NODE_ENV=test nuxt generate
to point at test data instead of the actual API. I've set the dev:
property in nuxt.config.js
but it didn't work. Heres an example of what I'm talking about:
if (process.env.NODE_ENV === 'production') {
// Call the real API
} else { // Test data
this.temperature = '70.01'
this.description = "sunny"
this.iconId = weatherIcons[Math.floor(Math.random() * weatherIcons.length)].ow
this.imgLoaded = true
}
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2479">#c2479</a>)</em></sub></div>