CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Tests that reside in subfolder can't be found after upgrading to 1.3.0

Open jsparks19 opened this issue 8 years ago • 3 comments

What are you trying to achieve?

Run a test that resides in a subfolder under the root folder.

What do you get instead?

No tests run. If I move my test file to the root folder it runs.

Provide console output if related. Use --verbose mode for more details.

C:\git\codecept-test>codeceptjs run blah_test.js --verbose
CodeceptJS v1.3.0
Using test root "C:\git\codecept-test"


  OK  | 0 passed   // 16ms
   Emitted | global.result ([object Object])
   Emitted | global.after ([object Object])

Details

  • CodeceptJS version: 1.3.0
  • NodeJS Version: 8.9.4
  • Operating System: Windows 7
  • Protractor || WebDriverIO || Nightmare version (if related)
  • Configuration files:

First attempt: Test file I'm trying to run is located at /tests/blah/blah_test.js. We have our tests organized currently and it works with version 1.2.1. After upgrading to 1.3.0 it does not work.

codecept.json: { "tests": "./tests/**/*/*_test.js", "timeout": 10000, "output": "./output", "helpers": { "WebDriverIO": { "url": "someUrl", "browser": "chrome", "host": "localhost", "port": "4444" } }, "include": {}, "bootstrap": false, "mocha": {}, "name": "codecept-test" }

Second attempt: I tried moving the blah_test.js file under /tests in case the recursive glob is not working, but one level deep is not working either. Test file is located at /tests/blah_test.js

codecept.json: { "tests": "./tests/*_test.js", "timeout": 10000, "output": "./output", "helpers": { "WebDriverIO": { "url": "someUrl", "browser": "chrome", "host": "localhost", "port": "4444" } }, "include": {}, "bootstrap": false, "mocha": {}, "name": "codecept-test" }

jsparks19 avatar Jun 27 '18 17:06 jsparks19

yeah, please see the changelog. The locating strategy has changed to more system-friendly. For your case you need to specify the relative path from a config:

codeceptjs run tests/blah/blah_test.js

This change was introduced to allow filename auto-completion to work

DavertMik avatar Jun 29 '18 15:06 DavertMik

@DavertMik Just so I understand, we will always need to specify the path when running an individual test from the command line? Is the tests option in the config only used for locating groups of files when running multiple at a time, such as when using grep?

jsparks19 avatar Jun 29 '18 18:06 jsparks19

@DavertMik Nevermind, looks like the tests config option is still needed when running an individual file or else it doesn't find the test.

jsparks19 avatar Jun 29 '18 19:06 jsparks19