demouser123
demouser123

Reputation: 4264

Pattern match error in Spec files for Protractor using TypeScript

I have a project which I need to move from vanilla JS to TypeScript. I have this done multiple times in past, but not sure why this error is creeping up, regarding the spec pattern files being not found.

When I run the project using yarn,

yarn run v1.1.0

$ protractor typeScript/config/dev.conf.js
(node:15928) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[13:00:26] W/configParser - pattern ../e2e/specs/*.spec.ts did not match any files.
[13:00:26] E/launcher - Spec patterns did not match any files.
[13:00:26] E/launcher - Error: Spec patterns did not match any files.
    at Runner.run (C:\Projects\yarn-mocha-ts\node_modules\protractor\built\runner.js:322:19)
    at TaskRunner.run (C:\Projects\yarn-mocha-ts\node_modules\protractor\built\taskRunner.js:110:27)
    at createNextTaskRunner (C:\Projects\yarn-mocha-ts\node_modules\protractor\built\launcher.js:235:28)
    at helper.runFilenameOrFn_.then.then.then (C:\Projects\yarn-mocha-ts\node_modules\protractor\built\launcher.js:260:13)
    at _fulfilled (C:\Projects\yarn-mocha-ts\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Projects\yarn-mocha-ts\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Projects\yarn-mocha-ts\node_modules\q\q.js:796:13)
    at C:\Projects\yarn-mocha-ts\node_modules\q\q.js:604:44
    at runSingle (C:\Projects\yarn-mocha-ts\node_modules\q\q.js:137:13)
    at flush (C:\Projects\yarn-mocha-ts\node_modules\q\q.js:125:13)

I ran yarn run build before the yarn e2e command from the scripts in package.json so that the .ts files are compiled, before being run. However, I am still not able to get the correct url to launch.

Is there something wrong with my configuration. I am using Mocha as framework and Chai-as-promised as assertion framework.

PS - I demo copy of the repository here - repo . You can configure baseUrl to get the example running.

Upvotes: 1

Views: 1711

Answers (1)

Milen Dobrinov
Milen Dobrinov

Reputation: 81

The problem comes from the dev.conf.ts file which is inside ./config, but dev.conf.js in inside ./typeScript/config and when you try to go up only once '../' in you dev.conf.js the wrong e2e folder is found. Try using

specs: [
    '../../e2e/specs/**/*.spec.ts'
],

in your dev.conf.ts file.

Also consider adding ./node_modules to a .gitignore file in the root directory of your project so you don't upload it to github.

Upvotes: 2

Related Questions