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

How to add System into Karma #181

Open
peteringram0 opened this issue Oct 18, 2016 · 8 comments
Open

How to add System into Karma #181

peteringram0 opened this issue Oct 18, 2016 · 8 comments

Comments

@peteringram0
Copy link

Hey,

Im getting the following error:

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  ReferenceError: Can't find variable: System
  at blob:http://localhost:9876/06e2d137-ede4-4078-92da-28f33c3e83e4:2

PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 22 ERROR (0.016 secs / 0 secs)
@togakangaroo
Copy link

You haven't mentioned versions of karma, or karma-jspm, or posted your karma.conf file...

@peteringram0
Copy link
Author

Karma 1.4.1
Karma-JSPM 2.2.0
JSPM 0.17.0-beta.39

module.exports = function (config) {
	config.set({
		autoWatch: false,
		singleRun: true,
		browserNoActivityTimeout: 130000,
		frameworks: ['jspm', 'jasmine-ajax', 'jasmine'],
		jspm: {
			config: './src/jspm.config.js',
			loadFiles: [
                                './src/test.spec.js',
			],
			serveFiles: [
				'./src/**/!(*spec).js'
			]
		},
		proxies: {
			'/src/': '/base/src/',
			'/': 'http://placehold.it/1x1', // stops the 404 issue
			'/jspm_packages/': '/src/jspm_packages/'
		},
		browsers: ['PhantomJS'],
		reporters: ['spec'],
		specReporter: {
	    	maxLogLines: 5, // limit number of lines logged per test
	        suppressErrorSummary: true,  // do not print error summary
	        suppressFailed: false,  // do not print information about failed tests
	        suppressPassed: false,  // do not print information about passed tests
	        suppressSkipped: true,  // do not print information about skipped tests
	        showSpecTiming: true // print the time elapsed for each spec
	    },
	});
};

@ffflabs
Copy link

ffflabs commented Feb 15, 2017

This plugin/adapter already injects SystemJS to the files array. The problem lies in the removal of system-polyfills, which causes an error in karma-jspm and -much worse- causes the main SystemJS script to error, because it uses Promise and PhantomJS doesn't support promises yet.

Since this adapter will always add system.src.js as the first served file, there's no room to inject a promise polyfill into it.

TL;DR: we're stuck with jspm 0.17.0-beta.32 for the time being, until @guybedford decides to re-add system polyfills, or phantomjs 2.5 is released (it allegedly support promises), or this adapter includes its own promise polyfill before system.src.js in the files array.

The latter would have to be done after checking the existance of system-polyfills, to determine if we're dealing with SystemJS v20.*

@peteringram0
Copy link
Author

@amenadiel This post is very useful thanks. Looking over everything happening with SystemJS i'm not convinced it will be added back in. Hopefully like you said it gets added back in or this plugin will change so that a polyfill can be injected.

@ffflabs
Copy link

ffflabs commented Feb 22, 2017

@peteringram0 perhaps switching from Phantom to either SlimerJS or NightmareJS woudl help. Those two support promises natively.

I couldn't make my tests pass with jasmine and nightmarejs, but it ran just like PhantomJS was supposed to run.

@ValeryIvanov
Copy link

@amenadiel what error was shown when you tried NightmareJS?

I also tried that but it just says Error: Failed to fetch whatever file is under test.

@ffflabs
Copy link

ffflabs commented Mar 24, 2017

@ValeryIvanov I didn't dig much deeper into Nightmare. The tests that were passing under phantom failed on it, and I had no intention to debug them

@ffflabs
Copy link

ffflabs commented Mar 24, 2017

There's an open PR #187 that solves this issue

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

4 participants