Vuejs - How to add e2e / unit tests after not including them initially in the webpack project creation?

0

I have a project that started with the vuetify webpack (vue init vuetifyjs / webpack). At the time the project was created, the e2e / unit testing option was not selected. But now there is a need for testing.

I checked the manual installation of nightwatch first, and installed all necessary dependencies via npm, such as:

npm install --save-dev webpack-dev-server
npm i -D babel-register chromedriver cross-spawn nightwatch selenium-server

I also inserted the script so that it can be executed:

"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e"'

However, errors occur through the webpack.dev.conf.js file. It appears that devConfigPromise.then(devConfig => { TypeError: devConfigPromise.then is not a function , and really is not, because to check I created another project today from scratch and the file webpack.dev.conf.js is extremely different from mine, as well as it has the export of a Promise , among other new dependencies, which is required to resolve this error of devConfigPromise use .then .

I would like to know if someone has already happened in a situation like this, and knows of a relatively easy solution to this case, since I tried to "integrate" the webpack.dev.conf.js of the new project in my old one, however several problems occur, and I arrived in a point that I do not know how to solve.

I tried to search, but I did not find anything about it so far, which in my view is strange, otherwise it ends up like this: Either you start the project with tests, or create another.

If you help, I can post the code of the configuration files, in case of this project there are three for development, webpack.dev.conf.js , dev-client.js and dev-server.js .

    
asked by anonymous 17.04.2018 / 21:39

1 answer

0

I found the answer in the NA stackoverflow that was answered two days ago on the link:

Briefly explaining the solution to those who have the same problem, you must first find the boilerplate (or template) that corresponds to the version that your project is. Luckily, in my case it was in version 1.1.0 and the template in the answer is the same.

If it is not, check the version of boilerplate you are using and try to start (or some started project) with the e2e testing option. Then copy the entire test folder to your project. Done, add e2e and test in the script as it appears in the response and install the dependencies chromedriver e selenium-server (talvez tenha que instalar a webpack-dev-server ) como modo desenvolvimento, no caso do npm seria com a flag - save-dev '.

I have not yet been able to run the tests in the background, but apparently solved, at least in the case of e2e with nightwatch .

    
20.04.2018 / 01:36