There was an error loading the files from the path

New Page

Path is file error when loading tests with Karma and Webpack

Ask

Asked 7 years, 1 month ago

Modified 7 years, 1 month ago

seen 3k times

This question shows research effort; it is useful and clear

6

This question shows no research effort; unclear or not useful

1

Please mark this question.

View activity on this post.

I’m trying to setup the Karma tester in a webpack project I’m working on. I have a few test files that I tried to include, but Karma keeps giving me the error: Path is a file ‘/_karma_webpack_/app/w/tests/components’. Why does MemoryFileSystem fail with this message? Any help is appreciated.

My karma.conf.js:

// Require webpack configuration rather than duplicating it var webpackConfig = require(‘./webpack.config’); webpackConfig.devtool = ‘inline-source-map’; module.exports = function(config) { config.set({ basePath:”, browsers: [‘Chrome_without_sandbox’], // Note: PhantomJS has too outdated, pre-ES5 WebKit to work with Browserify singleRun: true, customLaunchers: { Chrome_without_sandbox: { base: ‘Chrome’, flags: [‘–no-sandbox’] // w/ sandbox it fails under Docker } }, frameworks: [‘mocha’], files: [‘./app /w /tests/**/*-test.js’], webpack: webpackConfig, webpackMiddleware: { noInfo: true }, preprocessors: { ‘./app/w/tests/**/*-test.js’: [‘webpack’] } }); };

I tried loading files with require.context and wrapping them, but the result is the same…so I thought the problem might be with what MemoryFileSystem was expecting as input.

webpack.config.js

let webpack = require(‘webpack’); var bower_dir = __dirname + ‘/bower_components’; var config = { //devtool: ‘cheap-module-eval-source-map’, devtool: ‘eval’, input: { app: [‘webpack/hot/dev-server’, ‘./app/w/scripts /app.js’] }, resolution: { alias: {} }, output: { path: ‘./app/w/dist’, filename: ‘app.js’, publicPath: ‘/dist/’ } , module: { noParse: [], loaders: [ { test: /\.js$/, loader: ‘eslint!babel?optional[]=runtime’, exclude: /node_modules/}, { test: /\.json $/ , loader: ‘json’}, { test: /\.png$/, loader: “url?limit=10000&mimetype=image/png” }, { test: /\.woff$/, loader: “url? limit= 10000&mimetype=application/font-woff” }, { test: /\.ttf$/, loader: “url?limit=10000&

Error log:

ERROR [karma]: [Error: path is file ‘/_karma_webpack_/app/w/tests/components’] Error: path is file ‘/_karma_webpack_/app/w/tests/components’ on MemoryFileSystem.mkdirpSync( /Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/karma-webpack/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:116:10) on MemoryFileSystem.(anonymous function) [as mkdirp] (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/karma-webpack/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:193:34) on Tapable .<anonymous> (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:244:27) at /Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:187:20 on /Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack /node_modules/async/lib/async.js:239:13 on _arrayEach (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:91:13) at _each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:82:13) to Object.async.forEachOf.async.eachOf (/Users/magnuslien/Documents/ internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:238:9) at Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/ webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)twenty)twenty)twenty)twenty)js:239:13 at _arrayEach(/Users/magnuslien/ Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:91:13) at _each(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/ lib/async.js:82:13) on Object.async.forEachOf.async.eachOf (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:238: 9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/ Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)js:239:13 at _arrayEach(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:91:13) at _each (/Users/magnuslien/Documents/internprosjekter/woop -frontend/node_modules/webpack/node_modules/async/lib/async.js:82:13) on Object.async.forEachOf.async.eachOf (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack /node_modules /async/lib/async.js:238:9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js :215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)13) to _each (/Users/magnuslien/Documents/internprosjekter /woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:82:13) to Object.async.forEachOf.async.eachOf(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:238:9) on Object.async.forEach.async.each( /Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules /webpack/lib/Compiler.js:234:twenty)13) at _each(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:82:13) at Object.async.forEachOf.async.eachOf (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:238:9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop- frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend /node_modules/webpack/lib/Compiler.js:234:twenty)238:9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async /lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)238:9) on Object. async.forEach.async.each(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles(/Users/magnuslien/Documents /internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:twenty)238:9) on Object.async.forEach.async .each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop- frontend/node_modules/webpack/lib/Compiler.js:234:20)238:9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/ async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:twenty)238:9) on Object.async.forEach.async .each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop- frontend/node_modules/webpack/lib/Compiler.js:234:20)238:9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/ async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)twenty)238:9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable .emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)238:9) on Object.async.forEach.async.each (/Users/magnuslien/ Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/ Compile.js:234:20)twenty)238:9) on Object.async.forEach.async.each (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable .emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)238:9) on Object.async.forEach.async.each (/Users/magnuslien/ Documents/internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/ Compile.js:234:20)emitFiles(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)238:9) on Object.async.forEach.async.each(/Users/magnuslien/Documents /internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler .js:234:20)emitFiles(/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler.js:234:20)238:9) on Object.async.forEach.async.each(/Users/magnuslien/Documents /internprosjekter/woop-frontend/node_modules/webpack/node_modules/async/lib/async.js:215:22) on Tapable.emitFiles (/Users/magnuslien/Documents/internprosjekter/woop-frontend/node_modules/webpack/lib/Compiler .js:234:20)

package.json

“devDependencies”: { “babel-loader”: “^5.3.2”, “browserify”: “^11.0.1”, “karma”: “^0.12.31”, “karma-chrome-launcher”: “^ 0.2.0”, “karma-mocha”: “^0.2.0”, “karma-sourcemap-loader”: “^0.3.5”, “karma-webpack”: “^1.7.0”, “mocha”: “^2.2.5”, “proxyquireify”: “^3.0.0”, “webpack”: “^1.11.0”, “webpack-dev-server”: “^1.10.1” }

  • karma runner
  • webpack

To share

Share a link to this question

Copy link CC BY-SA 3.0

Follow

Follow this question to receive notifications

asked on August 25, 2015 at 10:38

Magnus user avatar

Magnus Magnus

331 4 4 silver badges 14 14 bronze badges

Add a comment | 

1 answer1

Sorted by: Reset to default

Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)

This answer is helpful

5

This answer is not helpful

View activity on this post.

I had the same problem.

Somehow the webpack.config.js is not allowed to have the input app.

To add

webpackConfig.entry = {};

just below the line

webpackConfig.devtool = ‘inline-source-map’; in your karma.conf.js

It worked for me

Compare

Share a link to this answer

Copy link CC BY-SA 3.0

Follow

Follow this answer to receive notifications

answered on August 27, 2015 at 5:38 PM

User avatar of Joris Wijlens

Joris Wijlens Joris Wijlens

118 4 4 bronze badges

1

  • Cela a résolu le problème, merci ! Après avoir appliqué le correctif, j’ai reçu une nouvelle erreur : callback() : le rappel a déjà été appelé. erreur, mais j’ai résolu cela en réécrivant le modèle glob dans les fichiers : [‘./app/w/tests/*-test.js’].

    – Magnus

    31 août 2015 à 13:11

Ajouter un commentaire | 

Ta Réponse

Merci d’avoir contribué à une réponse à Stack Overflow !

  • Veuillez vous assurer de répondre à la question. Fournissez des détails et partagez vos recherches !

Mais évitez…

  • Demander de l’aide, des éclaircissements ou répondre à d’autres réponses.
  • Faire des déclarations basées sur une opinion ; étayez-les par des références ou une expérience personnelle.

Pour en savoir plus, consultez nos conseils pour rédiger de bonnes réponses.

brouillon enregistré

Brouillon rejeté

Inscrivez-vous ou connectez-vous

Sign up with Google

Sign up using Facebook

Sign up using your email and password

Submit

Post as guest

Yam

E-mail

Required, but never displayed

Post as guest

Yam

E-mail

Required, but never displayed

Post your answer Ignore

By clicking “Post your answer” you agree to our Terms of Service, Privacy Policy and Cookies Policy

Not the answer you are looking for? Browse other tagged questions

  • karma runner
  • webpack

or ask your own question.

  • The overflow blog
  • Five Nines Uptime Without Developer Attrition (Ep. 488)

  • We Hate Scrum and Agile… When Done Badly (Ep. 489)

  • Featured in Meta
  • Recent color contrast changes and accessibility updates

  • Reviewer overboard! Or a request to improve the onboarding guide for new…

  • Collective update: recognized members, articles and GitLab

  • Do I need to explain other people’s answers in code?

Related

1

SourceMapping application code in Karma and Webpack

4

ENFILE: file table overflow with Karma

1

How can I configure webpack 2.2.0 rc3 (rc4) and bootstrap alpha 6 via bootstrap-loader

ten

How to run Typescript unit tests (not AngularJs) with Jasmine and Webpack

seven

Module not found: Error: Could not resolve ‘./app/app.module.ngfactory’

1

error with awesome font on webpack

3

Unable to read property ‘externalModuleIndicator’ from undefined when running unit test using karma and webpack 4

4

Karma tests that run successfully in Angular 7 (Karma 2.0.4) fail after upgrading from Angular 8 (Karma 4.1.0)

1

Babel 7 Update

burning questions from the net

  • Can I create my own license?
  • Has Batman ever been produced as an Arkham fan theory inmate in any medium?
  • How can we extract potassium fluoride from the Earth?
  • Which is stronger: an ability that can be used during skill bonus periods or one that can be used once per short rest?
  • Do characters have to wait 24 hours for a long rest, if a long rest is interrupted?
  • Does the key in which a piece is written affect the playability of the piano?
  • In what situations could a “dirty water leak into” municipal water lines be other than a catastrophic pressure loss?
  • Did the early church believe that Jesus was crucified on a cross or on a tree?
  • What is the use case for disabling an index?
  • Is there a way to keep the thickness of a curve (poly)?
  • Is it illegal to work for someone else while on paid leave?
  • Python decibels with metric precision?
  • Why does space warfare not lead to the total annihilation of both sides?
  • Can the princess escape using shoddy craftsmanship on a one-sided lock?
  • What does “they might use you as a seed” mean in The Marvelous Land of Oz?
  • Patents of military application?
  • Send an email to a colleague in times of mourning
  • Is James Earl Jones the actor who has played the same character the longest?
  • Is there a strong correlation between credit rating and mortgage rate in the United States?
  • A Crossweb puzzle for Herb
  • What is the area of ​​the SSME nozzle knowing only thrust at sea level and in a vacuum?
  • Projection of the direct product of non-abelian simple groups
  • Why does Windows 10 list “Windows_NT” as the operating system?
  • How important is it to have multiple gears on an e-bike?

question flow

Subscribe to RSS

question flow

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.


Video There was an error loading the files from the path

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…