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

Error 'goog.require could not find: soy.idom' when testing my Soy portlet #60

Open
kresimir-coko opened this issue Sep 16, 2017 · 0 comments

Comments

@kresimir-coko
Copy link

Trying to setup front end testing for our new Soy portlets and I am stuck on this error.

Chrome 60.0.3112 (Windows 10 0.0.0) ERROR: 'goog.require could not find: soy.idom'

Chrome 60.0.3112 (Windows 10 0.0.0) ERROR
  Uncaught Error: goog.require could not find: soy.idom
  at node_modules/metal-soy-bundle/build/bundle.js:612


[12:19:19] 'test:unit' errored after 9.57 s
[12:19:19] Error in plugin 'gulp-metal'
Message:
    Karma has exited with 1
[12:19:19] Finished 'test' after 11 s
npm ERR! Test failed.  See above for more details.

I've tried having the test folder in several locations, including the root of the portlet (same depth as the src folder) and in the src/main/resources/META-INF/resources where our code is located (split into different modules as you can see on my repo (https://github.com/kresimir-coko/com-liferay-osb-lcs-private/tree/research/osb-lcs-web).

The test itself isn't related to any components/modules but is just a simple test to try and get it to work.

describe("First Test", function () {
	var counter;

	beforeEach(function () {
		counter = 0;
	});

	it("increments value", function () {
		counter++;
		expect(counter).toEqual(1);
	});

	it("decrements value", function () {
		counter--;
		expect(counter).toEqual(0);
	});
});

Since the portlet I am working on isn't a pure Soy portlet but is build on JSP's I am using Soy templates with MetalJS when building a new module and that is working without any problems.

Another weird thing that happens when I run npm test is all my JS and Soy files get compiled into soy.js files of their respective components.

My gulpfile.js is as follows:

let metal = require('gulp-metal');

metal.registerTasks({
	moduleName: 'osb-lcs-web'
});

And package.json:

{
  "dependencies": {
    "metal-component": "^2.4.5",
    "metal-soy": "^2.4.5"
  },
  "devDependencies": {
    "gulp-metal": "^2.2.2",
    "liferay-module-config-generator": "^1.1.10",
    "metal-cli": "^1.3.1"
  },
  "scripts": {
    "test": "gulp test"
  },
  "name": "osb-lcs-web",
  "version": "1.0.0"
}
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

1 participant