Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard for files not working #3186

Closed
wwarme opened this issue Oct 15, 2018 · 2 comments
Closed

Wildcard for files not working #3186

wwarme opened this issue Oct 15, 2018 · 2 comments

Comments

@wwarme
Copy link

wwarme commented Oct 15, 2018

Expected behaviour

Karma recognizes and executes test-files in the directories matched by minimatch path (see config below).

Actual behaviour

After upgrading Karma from 1.5 to 3.0 neither wildcard /*.* nor extglob '/*.+(ts|tsx)' is working. Explicitely linking .ts files does work, doing so with .tsx files does not execute any tests provided in .tsx files. Linking single .tsx-files in the karma conf file array does work though!
Defining a Test.ts and a Test.tsx file in the project root and linking them via /*.(ts|tsx) also does work! More explicitely (paths are equal on files and preprocessors setting):
packages/*/test/**/*.* - not working
packages/*/test/**/*.+(ts|tsx) - not working
packages/*/test/**/*.tsx - not working
packages/*/test/**/*.ts - working, but only executes .ts test-files
packages/core/test/security/SecurityWrapper.tsx - working, but requires explicit definition of all single .tsx test files

Tests execute as expected (if executed).
Test files (.ts and .tsx) are recognized by watcher, thus karma even reruns when changing a .tsx file, but is not executing the tests.

Environment Details

  • Karma version (output of karma --version): 3.0.0
  • Webpack version: 4.20.1
  • node.js version: 8.12.0
  • OS: Windows 8.1 Pro
  • Relevant part of your karma.config.js file
module.exports = function karmaConfig(config) {
config.set({
    frameworks: ['mocha', 'intl-shim'],
    reporters: ['spec','junit'],
    files: [
        //We need this, otherwise we will get an error, everytime we use "assign" with Redux
        './node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js',
        './node_modules/babel-polyfill/browser.js',
        'packages/*/test/**/*.*'
    ],
    preprocessors: {
        'packages/*/test/**/*.*':['webpack','sourcemap']
    },
    browsers: [
        'PhantomJS'
    ],
    port:9888,
    webpack: require('./webpack.test.config.js'),
    junitReporter: {
        outputDir: 'reports/unittests'
    }
});
};
@johnjbarton
Copy link
Contributor

Try investigating with --log-level=DEBUG. Try testing without webpack: does it work then?

@wwarme
Copy link
Author

wwarme commented Oct 17, 2018

Yeah of course... Thanks for the tipp, investigating with loglevel debug made it. looks Like one of the test files is causing phantomjs to silently stop or crash:
17 10 2018 10:40:21.767:DEBUG [phantomjs.launcher]: TypeError: undefined is not an object (evaluating 'index_1.default.onReset')

Thank you so far, I think this can be closed since not karma related. Sorry for the false alert...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants