I have a following structure
root/Test/runtests.js
root/Test/package.json # npm
root/packages/local/foo/package.json # not npm
root/packages/local/foo/spec/ # root for tests
runtests.js:
var Jasmine = require('jasmine');
var jasmine = new Jasmine();
var spec_files = process.argv[2] + '/**/*Spec.js';
jasmine.loadConfig({
spec_dir: '../',
helpers: [],
spec_files: [
spec_files
],
stopSpecOnExpectationFailure: false,
random: true
});
jasmine.execute();
And I run it from inside root/Test with node runtests.js packages/local/foo/spec
. Whatever I try, it keeps failing by trying to parse packages/local/foo/package.json. It's not surprising it fails, because that json file isn't actually valid json and uses /*
syntax for block comments, but that's beside the point -- why is it being parsed to begin with? How can it be excluded? I tried using !
syntax in spec_files definition, to no avail. Here is what stacktrace look like
(node:48272) UnhandledPromiseRejectionWarning: SyntaxError: Error parsing root\packages\local\foo\package.json: Unexpected token / in JSON at position 7
at JSON.parse (<anonymous>)
at readPackage (internal/modules/cjs/loader.js:239:25)
at readPackageScope (internal/modules/cjs/loader.js:263:19)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:970:17)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Loader.requireShim [as require_] (root\Test\node_modules\jasmine\lib\loader.js:35:3)
at root\Test\node_modules\jasmine\lib\loader.js:28:12
I'm using jasmine ^3.9.0