yoavniran/jest-jspm

Path must be a string

selfagency opened this issue · 2 comments

seems like makeJestConfig doesn't want to take an object.

my jest.config.js:

const makeJestConfig = require('jest-jspm')
const jestConfig = makeJestConfig({
  'systemJs': './src/scripts/vendor/system.js',
  'sjsConfigFile': './src/scripts/config.js',
  'jspmPackages': './src/scripts/vendor'
})
console.log(jestConfig)
module.exports = jestConfig

the output:

❯ jest tests/settings --forceExit | bunyan                                                                    1s 419ms
TypeError: Path must be a string. Received { systemJs: './src/scripts/vendor/system.js',
  sjsConfigFile: './src/scripts/config.js',
  jspmPackages: './src/scripts/vendor' }
    at assertPath (path.js:28:11)
    at Object.join (path.js:1239:7)
    at getModuleFromAbsBasePath (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/utils.js:23:79)
    at exports.default (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/jspmConfigLoader.js:11:55)
    at exports.default (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/jspmMappingReader.js:38:56)
    at getModuleMappingsForJspm (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/index.js:42:49)
    at exports.default (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/index.js:68:41)
    at Object.<anonymous> (/Users/daniel/Dev/nylon-web/jest.config.js:2:20)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)

if i pass a string instead:

Error: Cannot find module 'src/scripts/vendor/jspm_packages/system'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at getModuleFromAbsBasePath (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/utils.js:23:56)
    at exports.default (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/jspmConfigLoader.js:11:55)
    at exports.default (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/jspmMappingReader.js:38:56)
    at getModuleMappingsForJspm (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/index.js:42:49)
    at exports.default (/Users/daniel/Dev/nylon-web/node_modules/jest-jspm/lib/index.js:68:41)
    at Object.<anonymous> (/Users/daniel/Dev/nylon-web/jest.config.js:2:20)

makeJestConfig takes the root directory as the first argument (the readme should probably be updated). Example usage:

makeJestConfig(__dirname, {
    sjsConfigFile: 'jspm.config.js'
});

thanks